坯料尺寸显示修改
This commit is contained in:
@@ -196,11 +196,14 @@ 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:
|
||||||
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)}"
|
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)}"
|
||||||
else:
|
else:
|
||||||
line.embryo_long = None
|
line.embryo_long = None
|
||||||
|
|
||||||
@@ -399,29 +402,30 @@ 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
|
||||||
# BOM_数量
|
if bom_line_ids:
|
||||||
total_product_qty = sum(line.product_qty for line in bom_line_ids)
|
# BOM_数量
|
||||||
bom_product_ids = bom_line_ids.mapped('product_id')
|
total_product_qty = sum(line.product_qty for line in bom_line_ids)
|
||||||
product_purchase_orders = self.env['purchase.order'].sudo().search([
|
bom_product_ids = bom_line_ids.mapped('product_id')
|
||||||
('state', 'in', ('purchase', 'done')),
|
product_purchase_orders = self.env['purchase.order'].sudo().search([
|
||||||
('order_line.product_id', 'in', bom_product_ids.ids)
|
('state', 'in', ('purchase', 'done')),
|
||||||
])
|
('order_line.product_id', 'in', bom_product_ids.ids)
|
||||||
# 购订单_数量
|
])
|
||||||
total_outsourcing_purchase_quantity = sum(
|
# 购订单_数量
|
||||||
sum(
|
total_outsourcing_purchase_quantity = sum(
|
||||||
order.order_line.filtered(
|
sum(
|
||||||
lambda line: line.product_id in bom_product_ids
|
order.order_line.filtered(
|
||||||
).mapped('product_qty')
|
lambda line: line.product_id in bom_product_ids
|
||||||
|
).mapped('product_qty')
|
||||||
|
)
|
||||||
|
for order in product_purchase_orders
|
||||||
)
|
)
|
||||||
for order in product_purchase_orders
|
quantity = total_outsourcing_purchase_quantity / total_product_qty
|
||||||
)
|
if float_compare(quantity, record.product_uom_qty,
|
||||||
quantity = total_outsourcing_purchase_quantity / total_product_qty
|
precision_rounding=record.product_id.uom_id.rounding) == -1:
|
||||||
if float_compare(quantity, record.product_uom_qty,
|
purchase_request = self.env['purchase.request'].sudo().search(
|
||||||
precision_rounding=record.product_id.uom_id.rounding) == -1:
|
[('line_ids.product_id', 'in', bom_product_ids.ids),
|
||||||
purchase_request = self.env['purchase.request'].sudo().search(
|
('line_ids.purchase_state', 'not in', ('purchase', 'done')), ('state', '!=', 'done')])
|
||||||
[('line_ids.product_id', 'in', bom_product_ids.ids),
|
outsourcing_purchase_request.extend(purchase_request.ids)
|
||||||
('line_ids.purchase_state', 'not in', ('purchase', 'done')), ('state', '!=', 'done')])
|
|
||||||
outsourcing_purchase_request.extend(purchase_request.ids)
|
|
||||||
record.outsourcing_purchase_request = json.dumps(outsourcing_purchase_request)
|
record.outsourcing_purchase_request = json.dumps(outsourcing_purchase_request)
|
||||||
if outsourcing_purchase_request:
|
if outsourcing_purchase_request:
|
||||||
record.hide_action_purchase_orders = True
|
record.hide_action_purchase_orders = True
|
||||||
|
|||||||
@@ -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"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user