需求计划材料销售订单行取值问题
This commit is contained in:
@@ -14,7 +14,6 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
|
|
||||||
def _get_machining_precision(self):
|
def _get_machining_precision(self):
|
||||||
machinings = self.env['sf.machining.accuracy'].sudo().search([])
|
machinings = self.env['sf.machining.accuracy'].sudo().search([])
|
||||||
|
|
||||||
list = [(m.sync_id, m.name) for m in machinings]
|
list = [(m.sync_id, m.name) for m in machinings]
|
||||||
return list
|
return list
|
||||||
|
|
||||||
@@ -35,7 +34,8 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
sale_order_id = fields.Many2one(comodel_name="sale.order",
|
sale_order_id = fields.Many2one(comodel_name="sale.order",
|
||||||
string="销售订单", readonly=True)
|
string="销售订单", readonly=True)
|
||||||
sale_order_line_id = fields.Many2one(comodel_name="sale.order.line",
|
sale_order_line_id = fields.Many2one(comodel_name="sale.order.line",
|
||||||
string="销售订单行", readonly=True)
|
string="销售订单明细", readonly=True)
|
||||||
|
sale_order_line_number = fields.Char(string='销售订单行', compute='_compute_sale_order_line_number', store=True)
|
||||||
company_id = fields.Many2one(
|
company_id = fields.Many2one(
|
||||||
related='sale_order_id.company_id',
|
related='sale_order_id.company_id',
|
||||||
store=True, index=True, precompute=True)
|
store=True, index=True, precompute=True)
|
||||||
@@ -167,6 +167,14 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
if sale_order_state == 'cancel' or not record.sale_order_line_id:
|
if sale_order_state == 'cancel' or not record.sale_order_line_id:
|
||||||
record.status = '100' # 取消
|
record.status = '100' # 取消
|
||||||
|
|
||||||
|
@api.depends('sale_order_line_id.product_id.name')
|
||||||
|
def _compute_sale_order_line_number(self):
|
||||||
|
for line in self:
|
||||||
|
if line.product_id:
|
||||||
|
line.sale_order_line_number = line.sale_order_line_id.product_id.name[-1]
|
||||||
|
else:
|
||||||
|
line.sale_order_line_number = None
|
||||||
|
|
||||||
@api.depends('product_id.part_number', 'product_id.model_name')
|
@api.depends('product_id.part_number', 'product_id.model_name')
|
||||||
def _compute_part_number(self):
|
def _compute_part_number(self):
|
||||||
for line in self:
|
for line in self:
|
||||||
@@ -191,7 +199,7 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
def _compute_materials_id(self):
|
def _compute_materials_id(self):
|
||||||
for line in self:
|
for line in self:
|
||||||
if line.product_id:
|
if line.product_id:
|
||||||
line.materials_id = f"{line.product_id.materials_id.name}*{line.product_id.materials_type_id.name}"
|
line.materials_id = f"{line.product_id.materials_id.name}/{line.product_id.materials_type_id.name}"
|
||||||
else:
|
else:
|
||||||
line.materials_id = None
|
line.materials_id = None
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<field name="name">sf.production.demand.plan.tree</field>
|
<field name="name">sf.production.demand.plan.tree</field>
|
||||||
<field name="model">sf.production.demand.plan</field>
|
<field name="model">sf.production.demand.plan</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree string="需求计划" default_order="sequence,create_date desc" editable="bottom"
|
<tree string="需求计划" default_order="sequence desc,create_date desc" editable="bottom"
|
||||||
class="demand_plan_tree">
|
class="demand_plan_tree">
|
||||||
<header>
|
<header>
|
||||||
<button string="打印" name="button_action_print" type="object"
|
<button string="打印" name="button_action_print" type="object"
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
<field name="product_remark" optional="hide"/>
|
<field name="product_remark" optional="hide"/>
|
||||||
<field name="order_code" optional="hide"/>
|
<field name="order_code" optional="hide"/>
|
||||||
<field name="sale_order_id" optional="hide"/>
|
<field name="sale_order_id" optional="hide"/>
|
||||||
<field name="sale_order_line_id" optional="hide"/>
|
<field name="sale_order_line_number" optional="hide"/>
|
||||||
<field name="order_state"/>
|
<field name="order_state"/>
|
||||||
<field name="route_id" optional="hide"/>
|
<field name="route_id" optional="hide"/>
|
||||||
<field name="contract_date"/>
|
<field name="contract_date"/>
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
<field name="contract_code"/>
|
<field name="contract_code"/>
|
||||||
<field name="plan_remark"/>
|
<field name="plan_remark"/>
|
||||||
<field name="processing_time"/>
|
<field name="processing_time"/>
|
||||||
<field name="material_check"/>
|
<field name="material_check" optional="hide"/>
|
||||||
<field name="hide_action_open_mrp_production" invisible="1"/>
|
<field name="hide_action_open_mrp_production" invisible="1"/>
|
||||||
<field name="hide_action_purchase_orders" invisible="1"/>
|
<field name="hide_action_purchase_orders" invisible="1"/>
|
||||||
<field name="hide_action_stock_picking" invisible="1"/>
|
<field name="hide_action_stock_picking" invisible="1"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user