工作中心概述看板视图

This commit is contained in:
gqh
2022-11-16 09:41:34 +08:00
parent ba92f616a0
commit ec9f82f09c
9 changed files with 452 additions and 36 deletions

View File

@@ -220,18 +220,26 @@ class StockRule(models.Model):
for company_id, productions_values in productions_values_by_company.items():
# create the MO as SUPERUSER because the current user may not have the rights to do it (mto product launched by a sale for example)
'''创建制造订单'''
productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(
productions_values)
self.env['stock.move'].sudo().create(productions._get_moves_raw_values())
self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
'''
创建工单
'''
productions._create_workorder()
productions.lot_producing_id._get_next_serial(productions.company_id,productions.product_id)
productions.action_generate_serial()
productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \
(
p.move_dest_ids.procure_method != 'make_to_order' and not p.move_raw_ids and not p.workorder_ids)).action_confirm()
for production in productions:
'''
创建制造订单时生成序列号
'''
production.lot_producing_id._get_next_serial(production.company_id, production.product_id)
production.action_generate_serial()
origin_production = production.move_dest_ids and production.move_dest_ids[
0].raw_material_production_id or False
orderpoint = production.orderpoint_id