我从res.config.settings继承并向其中添加了一些新字段,以显示在视图中,但是即使没有添加该字段,我也会得到一个不存在的字段的错误消息
此模型继承了res.config.settings并添加了新字段
class SaleSettingInherit(models.TransientModel):
_inherit = 'res.config.settings'
debit = fields.Many2one('account.account', related='company_id.debit')
credit = fields.Many2one('account.account', related='company_id.credit')
class ResCompanyInherit(models.Model):
_inherit = 'res.company'
debit = fields.Many2one('account.account')
credit = fields.Many2one('account.account')
这是我的视图文件,我在其中调用要显示的新字段
<odoo>
<record model="ir.ui.view" id="res_config_settings_view_form_inherit">
<field name="name">res.config.settings.view.form.inherit</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="sale.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='group_discount_per_so_line']/../.." position="after" />
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_right_pane">
<div class="content-group" attrs="{'invisible': [('group_discount_per_so_line','=',False)]}">
<div class="mt16">
<label for="debit"/>
<field name="debit" string="Debit" />
</div>
<div class="mt16">
<label for="credit"/>
<field name="credit" string="Credit" />
</div>
</div>
</div>
</div>
</field>
</record>
</odoo>
我希望将2个新字段借方和贷方添加到视图中,但出现错误:
ValueError:字段days_between_two_followups
不存在
错误上下文:
查看res.config.settings.view.form.inherit.sale
[view_id:615,xml_id:sale.res_config_settings_view_form,模型:res.config.settings,parent_id:153]