模型sale,purchase,return and transfer都是继承的transaction模型,而inventory具有与transaction_id相关的Many2one字段transaction字段,即使使用{{ 1}}模型中的1}}并尝试将其保存在inherit模型中的sale中会导致错误 id
sale,purchase,return and transfer
transaction
inventory
transaction_id
inherit
sale
id
代码
使用odoo的 _inherit 和 _inherits 功能。
_inherit
_inherits
可以满足您的条件。