Accept Merge Request #2214: (feature/齐套检查与下达生产 -> develop)

Merge Request: 物料需求计划增加字段显示

Created By: @管欢
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @管欢
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2214
This commit is contained in:
管欢
2025-06-19 09:58:10 +08:00
committed by Coding
2 changed files with 17 additions and 8 deletions

View File

@@ -39,11 +39,7 @@ class SfProductionDemandPlan(models.Model):
company_id = fields.Many2one(
related='sale_order_id.company_id',
store=True, index=True, precompute=True)
partner_id = fields.Many2one(
comodel_name='res.partner',
related='sale_order_line_id.order_partner_id',
string="客户",
store=True, index=True)
customer_name = fields.Char('客户', related='sale_order_id.customer_name')
order_remark = fields.Text(related='sale_order_id.remark',
string="订单备注", store=True)
glb_url = fields.Char(related='sale_order_line_id.glb_url', string='glb文件地址')
@@ -74,6 +70,9 @@ class SfProductionDemandPlan(models.Model):
qty_to_deliver = fields.Float(
"待交货数量", related='sale_order_line_id.qty_to_deliver')
model_long = fields.Char('尺寸', compute='_compute_model_long')
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类',
related='product_id.blank_type')
embryo_long = fields.Char('坯料尺寸', compute='_compute_embryo_long')
materials_id = fields.Char('材料', compute='_compute_materials_id', store=True)
model_machining_precision = fields.Selection(selection=_get_machining_precision, string='精度',
related='product_id.model_machining_precision')
@@ -197,6 +196,14 @@ class SfProductionDemandPlan(models.Model):
else:
line.model_long = None
@api.depends('product_id.model_long', 'product_id.model_width', 'product_id.model_height')
def _compute_embryo_long(self):
for line in self:
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)}"
else:
line.embryo_long = None
@api.depends('product_id.materials_id')
def _compute_materials_id(self):
for line in self:

View File

@@ -13,7 +13,7 @@
<field name="id" optional="hide"/>
<field name="priority"/>
<field name="status"/>
<field name="partner_id"/>
<field name="customer_name"/>
<field name="order_remark"/>
<field name="glb_url" optional="hide"/>
<field name="product_id"/>
@@ -28,6 +28,8 @@
<field name="qty_delivered"/>
<field name="qty_to_deliver"/>
<field name="model_long"/>
<field name="blank_type"/>
<field name="embryo_long"/>
<field name="materials_id"/>
<field name="model_machining_precision"/>
<field name="model_process_parameters_ids" widget="many2many_tags"/>
@@ -80,7 +82,7 @@
<field name="product_id"/>
<field name="part_name"/>
<field name="part_number"/>
<field name="partner_id"/>
<field name="customer_name"/>
<field name="supply_method"/>
<field name="materials_id"/>
<field name="model_process_parameters_ids"/>
@@ -89,7 +91,7 @@
<group expand="0" string="Group By">
<filter name="group_by_priority" string="优先级" domain="[]" context="{'group_by': 'priority'}"/>
<filter name="group_by_status" string="状态" domain="[]" context="{'group_by': 'status'}"/>
<filter name="group_by_partner_id" string="客户" domain="[]" context="{'group_by': 'partner_id'}"/>
<filter name="group_by_customer_name" string="客户" domain="[]" context="{'group_by': 'customer_name'}"/>
<filter name="group_by_is_incoming_material" string="客供料" domain="[]"
context="{'group_by': 'is_incoming_material'}"/>
<filter name="group_by_supply_method" string="供货方式" domain="[]"