现有字段(基本插件):
journal_id = fields.Many2one('account.journal', related='statement_id.journal_id', string='Journal', store=True, readonly=True)
New Field(custom addons):
journal_id = fields.Many2one('account.journal',string='Journal')
我想将现有字段更改为新字段,如上例所示。
答案 0 :(得分:0)
您需要使用从要覆盖的模型继承的模型创建新的插件。然后根据需要定义字段。
class YourModel(models.Model):
_inherit = 'other.model'
journal_id = fields.Many2one('account.journal',string='Journal')
答案 1 :(得分:0)
试试这段代码......
journal_id = fields.Many2one('account.journal',
related='statement_id.journal_id', string='Journal', store=True, readonly=True)
New Field(custom addons):
journal_id = fields.Many2one('account.journal',string='Journal',related=False,store=False, readonly=False)