如果有条件,我需要在“pos.order.line”中创建新记录;在“onchange”函数中
这是我的代码,我得到了这个错误:
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. Model: Point of Sale Order Lines (pos.order.line), Field: Order Ref (order_id) .
如果我还没有保存订单,如何获取订单id
class PosOrder(models.Model):
_inherit = "pos.order.line"
@api.onchange('product_id')
def onchange_product(self):
if condition:
new_pos_order_line = self.create({
'product_id': ....,
'price_unit': ....,
'qty':1,
})
需要帮忙吗? 谢谢
目前没有回答
相关问题 更多 >
编程相关推荐