未齐套提示
This commit is contained in:
@@ -97,9 +97,14 @@ class sf_production_plan(models.Model):
|
|||||||
actual_start_date = fields.Date('实际开工日期', compute='_compute_actual_start_date', store=True)
|
actual_start_date = fields.Date('实际开工日期', compute='_compute_actual_start_date', store=True)
|
||||||
actual_end_date = fields.Date('实际完工日期', compute='_compute_actual_end_date', store=True)
|
actual_end_date = fields.Date('实际完工日期', compute='_compute_actual_end_date', store=True)
|
||||||
print_count = fields.Char('打印次数', default='T0C0', readonly=True)
|
print_count = fields.Char('打印次数', default='T0C0', readonly=True)
|
||||||
|
|
||||||
sequence = fields.Integer('序号')
|
sequence = fields.Integer('序号')
|
||||||
|
|
||||||
|
hide_action_open_mrp_production = fields.Boolean(
|
||||||
|
string='显示待工艺确认按钮',
|
||||||
|
compute='_compute_hide_action_open_mrp_production',
|
||||||
|
default=False
|
||||||
|
)
|
||||||
|
|
||||||
@api.depends('sale_order_id.state', 'sale_order_id.mrp_production_ids.schedule_state', 'sale_order_id.order_line',
|
@api.depends('sale_order_id.state', 'sale_order_id.mrp_production_ids.schedule_state', 'sale_order_id.order_line',
|
||||||
'sale_order_id.mrp_production_ids.state')
|
'sale_order_id.mrp_production_ids.state')
|
||||||
def _compute_status(self):
|
def _compute_status(self):
|
||||||
@@ -329,3 +334,33 @@ class sf_production_plan(models.Model):
|
|||||||
'res_id': self.sale_order_id.id,
|
'res_id': self.sale_order_id.id,
|
||||||
'view_mode': 'form',
|
'view_mode': 'form',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@api.depends('sale_order_id.mrp_production_ids.state')
|
||||||
|
def _compute_hide_action_open_mrp_production(self):
|
||||||
|
for record in self:
|
||||||
|
mrp_production_ids = record.sale_order_id.mrp_production_ids.filtered(
|
||||||
|
lambda p: p.state == 'technology_to_confirmed' and p.product_id.id == record.product_id.id
|
||||||
|
)
|
||||||
|
record.hide_action_open_mrp_production = bool(mrp_production_ids) and record.supply_method in (
|
||||||
|
'automation', 'manual')
|
||||||
|
|
||||||
|
def action_open_mrp_production(self):
|
||||||
|
mrp_production_ids = self.sale_order_id.mrp_production_ids.filtered(
|
||||||
|
lambda p: p.state == 'technology_to_confirmed' and p.product_id.id == self.product_id.id
|
||||||
|
).ids
|
||||||
|
action = {
|
||||||
|
'res_model': 'mrp.production',
|
||||||
|
'type': 'ir.actions.act_window',
|
||||||
|
}
|
||||||
|
if len(mrp_production_ids) == 1:
|
||||||
|
action.update({
|
||||||
|
'view_mode': 'form',
|
||||||
|
'res_id': mrp_production_ids[0],
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
action.update({
|
||||||
|
'name': _("制造订单列表"),
|
||||||
|
'domain': [('id', 'in', mrp_production_ids)],
|
||||||
|
'view_mode': 'tree,form',
|
||||||
|
})
|
||||||
|
return action
|
||||||
|
|||||||
@@ -39,8 +39,11 @@
|
|||||||
<field name="plan_remark"/>
|
<field name="plan_remark"/>
|
||||||
<field name="processing_time"/>
|
<field name="processing_time"/>
|
||||||
<field name="material_check"/>
|
<field name="material_check"/>
|
||||||
<button name="action_open_sale_order" type="object" string="供货方式待确认" class="btn-primary"
|
<field name="hide_action_open_mrp_production" invisible="1"/>
|
||||||
|
<button name="action_open_sale_order" type="object" string="供货方式待确认" class="btn-primary"
|
||||||
attrs="{'invisible': [('supply_method', '!=', False)]}"/>
|
attrs="{'invisible': [('supply_method', '!=', False)]}"/>
|
||||||
|
<button name="action_open_mrp_production" type="object" string="待工艺确认" class="btn-primary"
|
||||||
|
attrs="{'invisible': [('hide_action_open_mrp_production', '=', False)]}"/>
|
||||||
<field name="planned_start_date"/>
|
<field name="planned_start_date"/>
|
||||||
<field name="actual_start_date"/>
|
<field name="actual_start_date"/>
|
||||||
<field name="actual_end_date"/>
|
<field name="actual_end_date"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user