提交7268,7271等bug修改
This commit is contained in:
@@ -23,7 +23,7 @@ class MrpBom(models.Model):
|
|||||||
"""重写name_get方法,只显示BOM编码"""
|
"""重写name_get方法,只显示BOM编码"""
|
||||||
result = []
|
result = []
|
||||||
for record in self:
|
for record in self:
|
||||||
# 只显示BOM编码,如果编码为空则显示名称
|
# 只显示BOM编码,如果编码为空则显示产品名称
|
||||||
display_name = record.code or record.name or f'BOM-{record.id}'
|
display_name = record.code or record.product_tmpl_id.name or f'BOM-{record.id}'
|
||||||
result.append((record.id, display_name))
|
result.append((record.id, display_name))
|
||||||
return result
|
return result
|
||||||
@@ -219,6 +219,9 @@ class SfDemandPlan(models.Model):
|
|||||||
line_ids = self.line_ids.filtered(lambda p: p.status == '30')
|
line_ids = self.line_ids.filtered(lambda p: p.status == '30')
|
||||||
sum_product_uom_qty = sum(line_ids.mapped('plan_uom_qty'))
|
sum_product_uom_qty = sum(line_ids.mapped('plan_uom_qty'))
|
||||||
customer_location_id = self.env['ir.model.data']._xmlid_to_res_id('stock.stock_location_customers')
|
customer_location_id = self.env['ir.model.data']._xmlid_to_res_id('stock.stock_location_customers')
|
||||||
|
for line in self.line_ids:
|
||||||
|
if line.manual_quotation and line.custom_made_type == 'automation':
|
||||||
|
raise ValidationError(f"产品{line.product_id.name}为人工编程,不能选择自动化产线加工")
|
||||||
if not self.overdelivery_allowed and line_ids.filtered(lambda p: p.location_id.id == customer_location_id):
|
if not self.overdelivery_allowed and line_ids.filtered(lambda p: p.location_id.id == customer_location_id):
|
||||||
if float_compare(sum_product_uom_qty, self.product_uom_qty,
|
if float_compare(sum_product_uom_qty, self.product_uom_qty,
|
||||||
precision_rounding=self.product_id.uom_id.rounding) == 1:
|
precision_rounding=self.product_id.uom_id.rounding) == 1:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
status = fields.Selection([
|
status = fields.Selection([
|
||||||
('10', '草稿'),
|
('10', '草稿'),
|
||||||
('20', '待确认'),
|
('20', '待确认'),
|
||||||
('30', '需求确认'),
|
('30', '待工艺设计'),
|
||||||
('50', '待下达生产'),
|
('50', '待下达生产'),
|
||||||
('60', '已下达'),
|
('60', '已下达'),
|
||||||
('100', '取消'),
|
('100', '取消'),
|
||||||
@@ -587,7 +587,7 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
def unlink(self):
|
def unlink(self):
|
||||||
for item in self:
|
for item in self:
|
||||||
if item.status not in ('10', '20', '30'):
|
if item.status not in ('10', '20', '30'):
|
||||||
raise ValidationError(u'只能删除状态为【草稿,待确认,需求确认】的需求计划。')
|
raise ValidationError(u'只能删除状态为【草稿,待确认,待工艺设计】的需求计划。')
|
||||||
else:
|
else:
|
||||||
super(SfProductionDemandPlan, item).unlink()
|
super(SfProductionDemandPlan, item).unlink()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user