我想在客户关系经理或者更准确地说是在机会的形式视图中。在原来,我有两个按钮,像“标记为赢”和“标记为失败”。我把这些按钮换成了其他4个按钮,比如“FFS-Win”、“FFS-Lost”、“Package-Win”和“Package-Lost”。现在我想用另外4个标签替换标签“Won”和“Lost”,它们显示在绿色或红色的背景上,相当于按钮。在
此时此刻我做到了:
继承视图(XML)
<record id="cmp_crm_lead_form" model="ir.ui.view">
<field name="name">cmp.crm.lead.form</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
<field name="arch" type="xml">
<data>
<button name="action_set_won" position="replace">
<button name="ffs_set_won" string="FFS - Success" type="object" class="oe_highlight o_wow" attrs="{'invisible': ['|', ('active','=',False), ('probability', '=', 100)]}"/>
<button name="package_set_won" string="Package - success" type="object" class="oe_highlight o_wow" attrs="{'invisible': ['|', ('active','=',False), ('probability', '=', 100)]}"/>
</button>
<xpath expr="//form/header/button[2]" position="replace">
<button name="ffs_set_lost" string="FFS - Lost" type="action" class="oe_highlight" context="{'default_lead_id': active_id}" attrs="{'invisible': [('active', '=', False),('probability', '<', 100)]}"/>
<button name="package_set_lost" string="Package - Lost" type="action" class="oe_highlight" context="{'default_lead_id': active_id}" attrs="{'invisible': [('active', '=', False),('probability', '<', 100)]}"/>
</xpath>
<xpath expr="//form/sheet/div[2]" position="replace">
<div class="label label-danger pull-right" attrs="{'invisible': [('ffs_lost', '=', False)]}">FFS - Lost</div>
<div class="label label-danger pull-right" attrs="{'invisible': [('package_lost', '=', False)]}">Package - Lost</div>
</xpath>
<xpath expr="//form/sheet/div[3]" position="replace">
<div class="label label-success pull-right" attrs="{'invisible': [('ffs_success', '=', False)]}">FFS - Success</div>
<div class="label label-success pull-right" attrs="{'invisible': [('package_success', '=', False)]}">Package - Success</div>
</xpath>
</data>
</field>
</record>
模型(Python)
^{pr2}$直到我添加了不可见属性,它才起作用。现在我无法进入窗体视图,因为我收到一个错误:
Uncaught Error: Unknown field ffs_lost in domain [["ffs_lost","=",false]]
问题涉及到模型中这4个字段中的每一个。 模块更新了,数据库中有字段,我可以在开发人员模式下看到它们,但是odoo仍然无法识别它们。在
目前没有回答
相关问题 更多 >
编程相关推荐