如何在odoo 10中将一个模型的数据插入另一个模型?

时间:2018-12-23 05:41:46

标签: python odoo

我正在odoo中设置模块,在该模块中需要维护一种模型(注册)的原始数据作为登录到另一种模型(RegistrationLogs)的日志。 我想通过向导调用将注册模型的数据插入RegistrationLogs,并且原始模型的数据需要更新。

2 个答案:

答案 0 :(得分:0)

您可以将many2one模型上的registration.logs字段添加到registraion的协同模型中,在模型create的{​​{1}}函数上,按registration create。要更新数据,需要将注册日志模型的字段设置为registration.logscomputed

答案 1 :(得分:0)

第一次初始化;

log_register_value = fields.Float(compute="_register_value_compute")

def _log_register_value_compute(self):
  self.log_register_value = self.register_value

之后,您可以选择一种api方法并应用。

看看:https://www.odoo.com/documentation/11.0/reference/orm.html#model-reference

相关问题