View Odoo9.0C如何从继承视图添加新的manyOne字段?
当我们想向继承的视图(如account.invoice.order)添加新的manyOne字段时,请告诉我正确的步骤是什么。类似于:View Odoo9.0C如何从继承视图添加新的manyOne字段?,view,odoo-9,qweb,View,Odoo 9,Qweb,当我们想向继承的视图(如account.invoice.order)添加新的manyOne字段时,请告诉我正确的步骤是什么。类似于: <template id="new_id" inherit_id="module_name.qweb_template_id" name="Template name as you want"> <!-- specify the target that you want to add the many2one field
<template id="new_id" inherit_id="module_name.qweb_template_id" name="Template name as you want">
<!-- specify the target that you want to add the many2one field
than the place after,before or inside -->
<xpath expr="//target_where_you_want_to_add" position="after/before/inside">
<field name="your_one_to_many_field_name" />
</xpath>
</template>
最难的部分是针对写作场所
例如,如果要将该字段添加到id=“div\u id”的div内的div标记中,并且该div包含class=“class\u name”
或者在该div中名为field1的字段后加上
<xpath expr="//div[@id='div_id']/div[@class='class_name']/field[@name='field1']" position="after">
<!-- // is like a shortcut -->
<xpath expr="//field[@name='field1']" position="after">
或在名为field1的字段之后
<xpath expr="//div[@id='div_id']/div[@class='class_name']/field[@name='field1']" position="after">
<!-- // is like a shortcut -->
<xpath expr="//field[@name='field1']" position="after">
因此,使用标记名和属性(如id、类等)查看谁可以定位要放置字段的位置,。。。(odoo 9中不支持字符串)感谢您的回复,实际上我想添加一个“manyOne”字段,而不是one2many。另一方面,这个字段在sale.order.line中已经存在,我的最终目标是在帐户发票报告qweb上显示它的值。请花一分钟时间查看我在其他qwestion主题中发布的字段。希望这对你有帮助谢谢大家,我会尝试修复我的模块现在,希望它工作,有一个美好的一天