Odoo:如何制作可以接受其他类型模型的通用模型多态

问题描述

enter image description here

模型sale,purchase,return and transfer都是继承的transaction模型,而inventory具有与transaction_id相关的Many2one字段transaction字段,即使使用{{ 1}}模型中的1}}并尝试将其保存在inherit模型中的sale中会导致错误 id

代码

inventory

解决方法

使用odoo的 _inherit _inherits 功能。

可以满足您的条件。