From 5b94a0624c83a24d2872d408489804a960c80bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Thu, 5 Dec 2024 16:55:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E8=89=BA=E8=AE=BE=E8=AE=A1=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=B7=A5=E5=BA=8F=E5=8F=AA=E9=80=89=E6=8B=A9=E4=BA=86?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=97=B6=E7=A1=AE=E8=AE=A4=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/sf_technology_design.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sf_manufacturing/models/sf_technology_design.py b/sf_manufacturing/models/sf_technology_design.py index a38e7897..392aa021 100644 --- a/sf_manufacturing/models/sf_technology_design.py +++ b/sf_manufacturing/models/sf_technology_design.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -from odoo import fields, models +from odoo import fields, models, api, _ +from odoo.exceptions import ValidationError class sf_technology_design(models.Model): @@ -29,3 +30,11 @@ class sf_technology_design(models.Model): def unlink_technology_design(self): self.active = False + + + @api.model_create_multi + def create(self, vals_list): + for vals in vals_list: + if not vals.get('route_id'): + raise ValidationError(_("工序不能为空")) + return super(sf_technology_design, self).create(vals_list)