<recordid="action_your_pipeline"model="ir.actions.server"> <fieldname="name">Crm: My Pipeline</field> <fieldname="model_id"ref="crm.model_crm_team"/> <fieldname="state">code</field> <fieldname="code">action = model.action_your_pipeline()</field> </record>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
@api.model defaction_your_pipeline(self): action = self.env.ref('crm.crm_lead_action_pipeline').read()[0] user_team_id = self.env.user.sale_team_id.id ifnot user_team_id: user_team_id = self.search([], limit=1).id action['help'] = _("""<p class='o_view_nocontent_smiling_face'>Add new opportunities</p><p> Looks like you are not a member of a Sales Team. You should add yourself as a member of one of the Sales Team. </p>""") if user_team_id: action['help'] += "<p>As you don't belong to any Sales Team, Odoo opens the first one by default.</p>"
action_context = safe_eval(action['context'], {'uid': self.env.uid}) if user_team_id: action_context['default_team_id'] = user_team_id