Reputation: 75
Hi ,it is Odoo 10E
I find I am very difficult to figure out how to re-arrange the view icons below. I want the default view as List view instead of Kanban view.
I have tried both Studio, Edit Action, Modifying crm_lead_views.xml but it still does not work. I am afraid there may be something wrong I have not been aware of.
In fact, when it is in Kanban view and creating a new opportunity, the default form is too simple. I must have a default creating form in a comprehensive form (that is why I want the List view). If there is a way to change the Create button in Kanban that directs to a comprehensive opportunity creation form, that also solve my issue.
thank you for attention.
Upvotes: 2
Views: 317
Reputation: 14768
What a coincidence, i've stumbled upon the same problem yesterday...
The dashboard buttons - e.g. "My Pipeline" - work with a server action which calls crm.team
's action_your_pipeline()
.
To change it, you have to override this method. I will share my code:
from odoo import api, models
class CrmTeam(models.Model):
_inherit = 'crm.team'
@api.model
def action_your_pipeline(self):
""" overridden to change the views order"""
action = super(CrmTeam, self).action_your_pipeline()
tree_view_id = self.env.ref('crm.crm_case_tree_view_oppor').id
form_view_id = self.env.ref('crm.crm_case_form_view_oppor').id
kanb_view_id = self.env.ref('crm.crm_case_kanban_view_leads').id
action['views'] = [
[tree_view_id, 'tree'],
[form_view_id, 'form'],
[kanb_view_id, 'kanban'],
[False, 'graph'],
[False, 'calendar'],
[False, 'pivot']
]
return action
Upvotes: 0
Reputation: 1538
In the crm_lead_menu.xml you can find the ir.actions. You need to override the action:
<record model="ir.actions.act_window" id="action_external_id">
...
<field name="view_mode">tree,kanban,graph,pivot,form,calendar</field> <!--Put the views the order you want-->
...
</record>
I hope this help you!
Upvotes: 0