Accept Merge Request #2283: (feature/7249 -> develop)

Merge Request: 合并 develop 分支到 feature/7249

Created By: @陈烨
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @陈烨
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2283
This commit is contained in:
陈烨
2025-07-14 14:29:24 +08:00
committed by Coding
3 changed files with 7 additions and 4 deletions

View File

@@ -23,7 +23,7 @@ class MrpBom(models.Model):
"""重写name_get方法只显示BOM编码"""
result = []
for record in self:
# 只显示BOM编码如果编码为空则显示名称
display_name = record.code or record.name or f'BOM-{record.id}'
# 只显示BOM编码如果编码为空则显示产品名称
display_name = record.code or record.product_tmpl_id.name or f'BOM-{record.id}'
result.append((record.id, display_name))
return result

View File

@@ -222,6 +222,9 @@ class SfDemandPlan(models.Model):
line_ids = self.line_ids.filtered(lambda p: p.status == '30')
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')
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 float_compare(sum_product_uom_qty, self.product_uom_qty,
precision_rounding=self.product_id.uom_id.rounding) == 1:

View File

@@ -21,7 +21,7 @@ class SfProductionDemandPlan(models.Model):
status = fields.Selection([
('10', '草稿'),
('20', '待确认'),
('30', '需求确认'),
('30', '待工艺设计'),
('50', '待下达生产'),
('60', '已下达'),
('100', '取消'),
@@ -589,7 +589,7 @@ class SfProductionDemandPlan(models.Model):
def unlink(self):
for item in self:
if item.status not in ('10', '20', '30'):
raise ValidationError(u'只能删除状态为【草稿,待确认,需求确认】的需求计划。')
raise ValidationError(u'只能删除状态为【草稿,待确认,待工艺设计】的需求计划。')
else:
super(SfProductionDemandPlan, item).unlink()