未齐套提示
This commit is contained in:
@@ -3,6 +3,7 @@ from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.tools import float_compare
|
||||
from datetime import datetime, timedelta
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class sf_production_plan(models.Model):
|
||||
@@ -101,7 +102,7 @@ class sf_production_plan(models.Model):
|
||||
|
||||
hide_action_open_mrp_production = fields.Boolean(
|
||||
string='显示待工艺确认按钮',
|
||||
compute='_compute_hide_action_open_mrp_production',
|
||||
compute='_compute_hid_button',
|
||||
default=False
|
||||
)
|
||||
|
||||
@@ -117,6 +118,12 @@ class sf_production_plan(models.Model):
|
||||
default=False
|
||||
)
|
||||
|
||||
hide_action_view_programming = fields.Boolean(
|
||||
string='显示编程单按钮',
|
||||
compute='_compute_hid_button',
|
||||
default=False
|
||||
)
|
||||
|
||||
@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')
|
||||
def _compute_status(self):
|
||||
@@ -339,14 +346,18 @@ class sf_production_plan(models.Model):
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
@api.depends('sale_order_id.mrp_production_ids.state')
|
||||
def _compute_hide_action_open_mrp_production(self):
|
||||
@api.depends('sale_order_id.mrp_production_ids.state', 'sale_order_id.mrp_production_ids.programming_state')
|
||||
def _compute_hid_button(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')
|
||||
programming_mrp_production_ids = record.sale_order_id.mrp_production_ids.filtered(
|
||||
lambda p: p.programming_state == '编程中' and p.product_id.id == record.product_id.id
|
||||
)
|
||||
record.hide_action_view_programming = bool(programming_mrp_production_ids)
|
||||
|
||||
def _compute_hide_action_purchase_orders(self):
|
||||
for record in self:
|
||||
@@ -442,3 +453,14 @@ class sf_production_plan(models.Model):
|
||||
if 'views' in action:
|
||||
action['views'] += [(state, view) for state, view in action['views'] if view != 'form']
|
||||
return action
|
||||
|
||||
def action_view_programming(self):
|
||||
self.ensure_one()
|
||||
programming_mrp_production_ids = self.sale_order_id.mrp_production_ids.filtered(
|
||||
lambda p: p.programming_state == '编程中' and p.product_id.id == self.product_id.id
|
||||
).mapped('programming_no')
|
||||
if programming_mrp_production_ids:
|
||||
programming_no = list(set(programming_mrp_production_ids))
|
||||
numbers_str = "、".join(programming_no)
|
||||
raise ValidationError(f"编程单号:{numbers_str},请去云平台处理")
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.demand_plan_tree th:not(.o_list_record_selector,.row_no,[data-name=sequence]) {
|
||||
.demand_plan_tree .o_list_table_ungrouped th:not(.o_list_record_selector,.row_no,[data-name=sequence]) {
|
||||
min-width: 98px !important;
|
||||
}
|
||||
|
||||
.demand_plan_tree .o_list_table_grouped th:not(.o_list_record_selector,.row_no,[data-name=sequence]) {
|
||||
min-width: 98px !important;
|
||||
width: 98px !important;
|
||||
}
|
||||
@@ -43,6 +43,7 @@
|
||||
<field name="hide_action_open_mrp_production" invisible="1"/>
|
||||
<field name="hide_action_purchase_orders" invisible="1"/>
|
||||
<field name="hide_action_stock_picking" invisible="1"/>
|
||||
<field name="hide_action_view_programming" invisible="1"/>
|
||||
<button name="action_open_sale_order" type="object" string="供货方式待确认" class="btn-primary"
|
||||
attrs="{'invisible': [('supply_method', '!=', False)]}"/>
|
||||
<button name="action_open_mrp_production" type="object" string="待工艺确认" class="btn-primary"
|
||||
@@ -51,6 +52,8 @@
|
||||
attrs="{'invisible': [('hide_action_purchase_orders', '=', False)]}"/>
|
||||
<button name="action_view_stock_picking" type="object" string="调拨单" class="btn-primary"
|
||||
attrs="{'invisible': [('hide_action_stock_picking', '=', False)]}"/>
|
||||
<button name="action_view_programming" type="object" string="编程单" class="btn-primary"
|
||||
attrs="{'invisible': [('hide_action_view_programming', '=', False)]}"/>
|
||||
<field name="planned_start_date"/>
|
||||
<field name="actual_start_date"/>
|
||||
<field name="actual_end_date"/>
|
||||
|
||||
Reference in New Issue
Block a user