我正在尝试编译模块,但它显示了此错误
Element '<group name="sale_condition">' cannot be located in parent view
Error context:
View `product.template.only.form.view.marge`
[view_id: 1240, xml_id: n/a, model: product.template, parent_id: 560]
None" while parsing /home/PycharmProjects/account_invoice_margin/views/product_view.xml:4, near
<record id="product_template_only_form_view_marge" model="ir.ui.view">
<field name="name">product.template.only.form.view.marge</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="stock.view_template_property_form"/>
<field name="arch" type="xml">
<group name="sale_condition" position="inside">
<label for="taux_marge" groups="account_invoice_margin.group_margin_security"/>
<div groups="account_invoice_margin.group_margin_security">
<field name="taux_marge" class="oe_inline"/>
</div>
<label for="marge_product" groups="account_invoice_margin.group_margin_security"/>
<div groups="account_invoice_margin.group_margin_security">
<field name="marge_product" class="oe_inline"/>
</div>
</group>
</field>
</record>
我了解该错误是由于不在父视图中的“ sale_condition”引起的。您可以通过给我一个替代方法来帮助我,我可以在哪里添加此组以使其正常工作?知道我无法在插件文件中更改
在odoo 10 mais pas dans odoo 12中存在具有“ sale_condition”属性的组。
<group name="sale_condition" string="Sale Conditions">
<label for="warranty" groups="stock.group_production_lot"/>
<div groups="stock.group_production_lot">
<field name="warranty" class="oe_inline"/> months
</div>
<label for="sale_delay"/>
<div>
<field name="sale_delay" attrs="{'readonly':[('sale_ok','=',False)]}" class="oe_inline" style="vertical-align:baseline"/> days
</div>
答案 0 :(得分:0)
您可以继承创建了组名=“ sale_condition”的视图
答案 1 :(得分:0)
我认为您正在尝试在Odoo 12中找到Odoo 10视图的组sale_condition,但该视图组未在Odoo 12的stock.view_template_property_form视图中定义。您是否正在将模块从Odoo 10移植到Odoo 12?
由于您只需要该组来定位视图中的位置(其中将包含字段taux_marge和marge_product),我便会忘记sale_condition并在Odoo 12中使用开发人员模式相对于组/字段/定位新位置等在Odoo 12的视图中确实存在,例如在价目表尝试以下内容之后:
<xpath expr="//group[@name='pricelists']" position="after">
<group name="marge" string="Marge">
<group>
<label for="taux_marge" groups="account_invoice_margin.group_margin_security"/>
<div groups="account_invoice_margin.group_margin_security">
<field name="taux_marge" class="oe_inline"/>
</div>
<label for="marge_product" groups="account_invoice_margin.group_margin_security"/>
<div groups="account_invoice_margin.group_margin_security">
<field name="marge_product" class="oe_inline"/>
</div>
</group>
</group>
</xpath>