我在做Odoo 8。
我在我的合作伙伴表单上添加了一个智能按钮,以显示合作伙伴的当前商机。当我单击该按钮时,我想要打开已过滤的机会列表。这是可行的,但不是在机会列表中(应该是crm_case_tree_view_oppor);它会打开一个潜在客户列表(在crm_case_tree_view_leads中有我的机会)。
因此,当我单击create按钮(在列表顶部)时,它会打开lead表单,而不是opportunity表单。
下面是我的代码:
我继承的合作伙伴表单中的智能按钮:
<button class="oe_inline oe_stat_button" type="action" name="%(action_current_opportunity_partner_list)d" icon="fa fa-star-o">
<field string="Opp. en cours" name="opportunity_current_count" widget="statinfo"/>
</button>以及相关联的操作:
<record id="action_current_opportunity_partner_list" model="ir.actions.act_window">
<field name="domain">[('partner_id.id', '=', active_id), ('probability', '!=', 0), ('probability', '!=', 100)]</field>
<field name="view_mode">tree,form</field>
</record>我如何告诉Odoo打开商机列表(crm.crm_case_tree_view_oppor),然后让按钮create来创建商机而不是lead?
发布于 2016-07-08 00:48:28
您需要在ir.actions.act_window上添加一个view_id,如下所示:
<field name="view_id" ref="crm.crm_case_tree_view_oppor" />不要忘记在模块依赖项(__openerp__.py)中设置crm
对于第二个问题(创建),将上下文添加到您的操作:
<field name="context">{'stage_type': 'opportunity', 'default_type': 'opportunity', 'default_user_id': uid, 'needaction_menu_ref': 'sale.menu_sale_quotations'}</field>这是从Opportunities菜单项后面的window操作复制的。
发布于 2016-07-08 21:31:05
因此,我只需将我的按钮替换为:
<button class="oe_inline oe_stat_button" type="action" name="crm.crm_case_category_act_oppor11" icon="fa fa-star" context="{'search_default_partner_id': active_id}">
<field string="Opportunités" name="opportunity_total_count" widget="statinfo"/>
</button>只需将名称改为"crm.crm_case_category_act_oppor11“并删除我自己的操作即可。
现在起作用了。
列表以前是有效的,而不是“创建”按钮。我没有任何解释。
https://stackoverflow.com/questions/38250169
复制相似问题