我正在向 Odoo 企业 11 中的“product.supplierinfo”模块添加一个自定义字符串字段 (stock_value),但我无法让它正确显示标签。
我继承了模块,然后向模块和通过 xpath 的视图添加了一个新字段。
问题:与新字段相关的字符串未显示。
模块:
class class_name(models.Model):
_inherit = 'product.supplierinfo'
stock_value = fields.Integer(string="Stock")
看法:
<!-- Stock value in the vendors -->
<record id="view_product_product_supplierinfo_form_view" model="ir.ui.view">
<field name="name">product.supplierinfo.product.form</field>
<field name="model">product.supplierinfo</field>
<field name="inherit_id" ref="product.product_supplierinfo_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='price']" position="after">
<field name="stock_value" />
</xpath>
</field>
</record>
结果:如您所见,价格值下方为零,但未显示字符串标签“库存”。
尝试了其他事情:
添加下一个代码:
<separator />
<label for="stock_value" string="Stock Value"/>
给我
将字段放入组中给了我
我还尝试在最后一个视图中将位置更改为“之前”,但我无法让它看起来像它应该的那样。我尝试使用@string,但它不再有效。
感谢您的帮助。