优化制造订单列表

This commit is contained in:
jinling.yang
2024-07-31 17:00:14 +08:00
parent c0d006d139
commit 0675937588
2 changed files with 10 additions and 8 deletions

View File

@@ -815,17 +815,17 @@ class MrpProduction(models.Model):
def do_update_program(self): def do_update_program(self):
program_production = self program_production = self
if len(program_production) >= 1: if len(program_production) >= 1:
same_product_id = None # same_product_id = None
is_not_same_product = 0 # is_not_same_product = 0
for item in program_production: for item in program_production:
if same_product_id is None: # if same_product_id is None:
same_product_id = item.product_id # same_product_id = item.product_id
if item.product_id != same_product_id: # if item.product_id != same_product_id:
is_not_same_product += 1 # is_not_same_product += 1
if item.state != "rework" and item.programming_state != "已编程未下发": if item.state != "rework" and item.programming_state != "已编程未下发":
raise UserError("请选择状态为返工且已编程未下发的制造订单") raise UserError("请选择状态为返工且已编程未下发的制造订单")
if is_not_same_product >= 1: # if is_not_same_product >= 1:
raise UserError("您选择的记录中含有其他产品的制造订单,请选择同一产品的制造订单") # raise UserError("您选择的记录中含有其他产品的制造订单,请选择同一产品的制造订单")
grouped_program_ids = {k: list(g) for k, g in groupby(program_production, key=lambda x: x.programming_no)} grouped_program_ids = {k: list(g) for k, g in groupby(program_production, key=lambda x: x.programming_no)}
program_to_production_names = {} program_to_production_names = {}
for programming_no, program_production in grouped_program_ids.items(): for programming_no, program_production in grouped_program_ids.items():

View File

@@ -465,6 +465,8 @@
<separator/> <separator/>
<filter string="返工且已编程" name="filter_rework_programmed" <filter string="返工且已编程" name="filter_rework_programmed"
domain="[('state', '=', 'rework'),('programming_state', '=', '已编程')]"/> domain="[('state', '=', 'rework'),('programming_state', '=', '已编程')]"/>
<filter string="返工且已编程未下发" name="filter_rework_programmed_not_delivered"
domain="[('state', '=', 'rework'),('programming_state', '=', '已编程未下发')]"/>
<separator/> <separator/>
<filter name="filter_programming" string="编程中" <filter name="filter_programming" string="编程中"
domain="[('programming_state', '=', '编程中')]"/> domain="[('programming_state', '=', '编程中')]"/>