修改 销售订单确认时,生成产品BOM时校验单位用量值的提示信息
This commit is contained in:
@@ -3,6 +3,7 @@ import logging
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
class ResProductCategory(models.Model):
|
class ResProductCategory(models.Model):
|
||||||
@@ -49,7 +50,7 @@ class ResMrpBomMo(models.Model):
|
|||||||
def bom_create_line_has(self, embryo):
|
def bom_create_line_has(self, embryo):
|
||||||
product = self.product_tmpl_id
|
product = self.product_tmpl_id
|
||||||
if product.unit_number in (0, None, False):
|
if product.unit_number in (0, None, False):
|
||||||
raise ValueError(f'单件用量的值不能为{product.unit_number}')
|
raise ValidationError(f'产品{product.name}单件用量的值不能为{product.unit_number}')
|
||||||
vals = {
|
vals = {
|
||||||
'bom_id': self.id,
|
'bom_id': self.id,
|
||||||
'product_id': embryo.id,
|
'product_id': embryo.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user