坯料尺寸显示修改

This commit is contained in:
guanhuan
2025-06-24 11:32:41 +08:00
parent 4274b9fe99
commit fe3492ceb5
2 changed files with 29 additions and 25 deletions

View File

@@ -196,10 +196,13 @@ class SfProductionDemandPlan(models.Model):
else: else:
line.model_long = None line.model_long = None
@api.depends('product_id.model_long', 'product_id.model_width', 'product_id.model_height') @api.depends('product_id.model_long', 'product_id.model_width', 'product_id.model_height', 'product_id.blank_type')
def _compute_embryo_long(self): def _compute_embryo_long(self):
for line in self: for line in self:
if line.product_id: if line.product_id:
if line.product_id.blank_type == '圆料':
line.embryo_long = f"Ø{round(line.product_id.model_width, 3)}*{round(line.product_id.model_long, 3)}"
else:
line.embryo_long = f"{round(line.product_id.model_long, 3)}*{round(line.product_id.model_width, 3)}*{round(line.product_id.model_height, 3)}" line.embryo_long = f"{round(line.product_id.model_long, 3)}*{round(line.product_id.model_width, 3)}*{round(line.product_id.model_height, 3)}"
else: else:
line.embryo_long = None line.embryo_long = None
@@ -399,6 +402,7 @@ class SfProductionDemandPlan(models.Model):
outsourcing_purchase_request.extend(pr_ids.ids) outsourcing_purchase_request.extend(pr_ids.ids)
if record.supply_method == 'outsourcing' and not record.sale_order_line_id.is_incoming_material: if record.supply_method == 'outsourcing' and not record.sale_order_line_id.is_incoming_material:
bom_line_ids = record.product_id.bom_ids.bom_line_ids bom_line_ids = record.product_id.bom_ids.bom_line_ids
if bom_line_ids:
# BOM_数量 # BOM_数量
total_product_qty = sum(line.product_qty for line in bom_line_ids) total_product_qty = sum(line.product_qty for line in bom_line_ids)
bom_product_ids = bom_line_ids.mapped('product_id') bom_product_ids = bom_line_ids.mapped('product_id')

View File

@@ -28,7 +28,7 @@
<field name="qty_delivered"/> <field name="qty_delivered"/>
<field name="qty_to_deliver"/> <field name="qty_to_deliver"/>
<field name="model_long"/> <field name="model_long"/>
<field name="blank_type"/> <field name="blank_type" optional="hide"/>
<field name="embryo_long"/> <field name="embryo_long"/>
<field name="materials_id"/> <field name="materials_id"/>
<field name="model_machining_precision"/> <field name="model_machining_precision"/>