需求计划对应产品的调拨单显示不正确
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
""",
|
""",
|
||||||
'category': 'sf',
|
'category': 'sf',
|
||||||
'website': 'https://www.sf.jikimo.com',
|
'website': 'https://www.sf.jikimo.com',
|
||||||
'depends': ['sf_plan', 'jikimo_printing'],
|
'depends': ['sf_plan'],
|
||||||
'data': [
|
'data': [
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'views/demand_plan.xml',
|
'views/demand_plan.xml',
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
route_id = fields.Many2one('stock.route', string='路线', related='sale_order_line_id.route_id', store=True)
|
route_id = fields.Many2one('stock.route', string='路线', related='sale_order_line_id.route_id', store=True)
|
||||||
contract_date = fields.Date('合同日期', related='sale_order_id.contract_date')
|
contract_date = fields.Date('合同日期', related='sale_order_id.contract_date')
|
||||||
date_order = fields.Datetime('下单日期', related='sale_order_id.date_order')
|
date_order = fields.Datetime('下单日期', related='sale_order_id.date_order')
|
||||||
contract_code = fields.Char('合同号', related='sale_order_id.contract_code')
|
contract_code = fields.Char('合同号', related='sale_order_id.contract_code', store=True)
|
||||||
plan_remark = fields.Text("计划备注")
|
plan_remark = fields.Text("计划备注")
|
||||||
material_check = fields.Selection([
|
material_check = fields.Selection([
|
||||||
('0', "未齐套"),
|
('0', "未齐套"),
|
||||||
@@ -160,9 +160,11 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
if pending_productions:
|
if pending_productions:
|
||||||
record.status = '50' # 待下达生产
|
record.status = '50' # 待下达生产
|
||||||
# 检查所有制造订单的排程单状态
|
# 检查所有制造订单的排程单状态
|
||||||
if record.sale_order_id.mrp_production_ids and all(
|
if record.sale_order_id.mrp_production_ids:
|
||||||
order.product_id == record.product_id and order.schedule_state != '未排' for order in
|
product_productions = record.sale_order_id.mrp_production_ids.filtered(
|
||||||
record.sale_order_id.mrp_production_ids):
|
lambda p: p.product_id.id == record.product_id.id
|
||||||
|
)
|
||||||
|
if product_productions and all(order.schedule_state != '未排' for order in product_productions):
|
||||||
record.status = '60' # 已下达
|
record.status = '60' # 已下达
|
||||||
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' # 取消
|
||||||
@@ -458,7 +460,9 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
record.hide_action_stock_picking = False
|
record.hide_action_stock_picking = False
|
||||||
record.hide_action_outsourcing_stock_picking = False
|
record.hide_action_outsourcing_stock_picking = False
|
||||||
if record.supply_method in ('automation', 'manual'):
|
if record.supply_method in ('automation', 'manual'):
|
||||||
manufacturing_orders = record.sale_order_id.mrp_production_ids
|
manufacturing_orders = record.sale_order_id.mrp_production_ids.filtered(
|
||||||
|
lambda p: p.product_id.id == record.product_id.id
|
||||||
|
)
|
||||||
record.hide_action_stock_picking = bool(manufacturing_orders.mapped('picking_ids').filtered(
|
record.hide_action_stock_picking = bool(manufacturing_orders.mapped('picking_ids').filtered(
|
||||||
lambda p: p.state == 'assigned'))
|
lambda p: p.state == 'assigned'))
|
||||||
elif record.supply_method in ('purchase', 'outsourcing'):
|
elif record.supply_method in ('purchase', 'outsourcing'):
|
||||||
|
|||||||
@@ -85,6 +85,7 @@
|
|||||||
<field name="materials_id"/>
|
<field name="materials_id"/>
|
||||||
<field name="model_process_parameters_ids"/>
|
<field name="model_process_parameters_ids"/>
|
||||||
<field name="plan_remark"/>
|
<field name="plan_remark"/>
|
||||||
|
<field name="contract_code"/>
|
||||||
<group expand="0" string="Group By">
|
<group expand="0" string="Group By">
|
||||||
<filter name="group_by_priority" string="优先级" domain="[]" context="{'group_by': 'priority'}"/>
|
<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_status" string="状态" domain="[]" context="{'group_by': 'status'}"/>
|
||||||
@@ -97,6 +98,8 @@
|
|||||||
context="{'group_by': 'deadline_of_delivery'}"/>
|
context="{'group_by': 'deadline_of_delivery'}"/>
|
||||||
<filter name="group_by_materials_id" string="材料" domain="[]"
|
<filter name="group_by_materials_id" string="材料" domain="[]"
|
||||||
context="{'group_by': 'materials_id'}"/>
|
context="{'group_by': 'materials_id'}"/>
|
||||||
|
<filter name="group_by_contract_code" string="合同号" domain="[]"
|
||||||
|
context="{'group_by': 'contract_code'}"/>
|
||||||
</group>
|
</group>
|
||||||
</search>
|
</search>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
Reference in New Issue
Block a user