【发布时间】:2022-07-21 17:18:15
【问题描述】:
我可以在向导中从另一个模型调用该函数。但有一个问题。当我从另一个模型调用该函数时,我无法使用这些字段。
调用函数代码:
self.env['inventory.menu'].action_delete()
另一个模型的函数:
def action_delete(self):
print("girdi", self.price)
vals = {
'ref_code': self.ref_code,
'products_id': self.products_id.id,
'product_description': self.product_description,
'teslim_alan': self.teslim_alan,
'teslim_eden': self.teslim_eden,
'quantity': self.scrap_quantity,
'price': self.price,
'unit_price': self.unit_price,
'warehouse_id': self.warehouse_id.id
}
self.env['scrap'].create(vals)
我收到此错误:
The operation cannot be completed:
- Create/update: a mandatory field is not set.
- Delete: another model requires the record being deleted. If possible, archive it instead.
我该如何解决?谢谢..
【问题讨论】: