Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import fields, models
|
||||
from odoo import fields, models, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class sf_technology_design(models.Model):
|
||||
@@ -29,3 +30,11 @@ class sf_technology_design(models.Model):
|
||||
|
||||
def unlink_technology_design(self):
|
||||
self.active = False
|
||||
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
for vals in vals_list:
|
||||
if not vals.get('route_id'):
|
||||
raise ValidationError(_("工序不能为空"))
|
||||
return super(sf_technology_design, self).create(vals_list)
|
||||
|
||||
@@ -59,7 +59,7 @@ class ProductionTechnologyWizard(models.TransientModel):
|
||||
for special in special_design:
|
||||
workorders_values = []
|
||||
if special.active is False:
|
||||
is_cancel = False
|
||||
# is_cancel = False
|
||||
# 工单采购单外协出入库单皆需取消
|
||||
domain = [('production_id', '=', special.production_id.id)]
|
||||
if special.process_parameters_id:
|
||||
@@ -67,23 +67,21 @@ class ProductionTechnologyWizard(models.TransientModel):
|
||||
else:
|
||||
domain += [('technology_design_id', '=', special.id), ('state', '!=', 'cancel')]
|
||||
workorder = self.env['mrp.workorder'].search(domain)
|
||||
previous_workorder = self.env['mrp.workorder'].search(
|
||||
[('sequence', '=', workorder.sequence - 1), ('routing_type', '=', '表面工艺'),
|
||||
('production_id', '=', workorder.production_id.id)])
|
||||
if previous_workorder:
|
||||
if previous_workorder.supplier_id != workorder.supplier_id:
|
||||
is_cancel = True
|
||||
else:
|
||||
is_cancel = True
|
||||
if workorder.state != 'cancel' and is_cancel is True:
|
||||
workorder.write({'state': 'cancel'})
|
||||
workorder.picking_ids.write({'state': 'cancel'})
|
||||
workorder.picking_ids.move_ids.write({'state': 'cancel'})
|
||||
purchase_order = self.env['purchase.order'].search(
|
||||
[('origin', '=', workorder.production_id.name), ('purchase_type', '=', 'consignment')])
|
||||
for line in purchase_order.order_line:
|
||||
if line.product_id.server_product_process_parameters_id == workorder.surface_technics_parameters_id:
|
||||
purchase_order.write({'state': 'cancel'})
|
||||
# previous_workorder = self.env['mrp.workorder'].search(
|
||||
# [('sequence', '=', workorder.sequence - 1), ('routing_type', '=', '表面工艺'),
|
||||
# ('production_id', '=', workorder.production_id.id)])
|
||||
# if previous_workorder:
|
||||
# if previous_workorder.supplier_id != workorder.supplier_id:
|
||||
# is_cancel = True
|
||||
# if workorder.state != 'cancel' and is_cancel is True:
|
||||
workorder.write({'state': 'cancel'})
|
||||
workorder.picking_ids.write({'state': 'cancel'})
|
||||
workorder.picking_ids.move_ids.write({'state': 'cancel'})
|
||||
purchase_order = self.env['purchase.order'].search(
|
||||
[('origin', '=', workorder.production_id.name), ('purchase_type', '=', 'consignment')])
|
||||
for line in purchase_order.order_line:
|
||||
if line.product_id.server_product_process_parameters_id == workorder.surface_technics_parameters_id:
|
||||
purchase_order.write({'state': 'cancel'})
|
||||
else:
|
||||
if special.production_id.workorder_ids:
|
||||
workorder = self.env['mrp.workorder'].search(
|
||||
|
||||
Reference in New Issue
Block a user