下达计划按钮重复点击生成重复数据

This commit is contained in:
guanhuan
2025-07-16 09:32:28 +08:00
parent 7eea5a0ff2
commit 5a98b20988
6 changed files with 22 additions and 113 deletions

View File

@@ -36,7 +36,7 @@ class PurchaseOrderLine(models.Model):
@api.model
def create(self, vals):
res = super(PurchaseOrderLine, self).create(vals)
if not res.demand_plan_line_id:
if not res.demand_plan_line_id and res.order_id.origin:
origin = [origin.replace(' ', '') for origin in res.order_id.origin.split(',')]
if self.env.context.get('demand_plan_line_id'):
res.demand_plan_line_id = self.env.context.get('demand_plan_line_id')