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 -*-
|
# -*- 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):
|
class sf_technology_design(models.Model):
|
||||||
@@ -29,3 +30,11 @@ class sf_technology_design(models.Model):
|
|||||||
|
|
||||||
def unlink_technology_design(self):
|
def unlink_technology_design(self):
|
||||||
self.active = False
|
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:
|
for special in special_design:
|
||||||
workorders_values = []
|
workorders_values = []
|
||||||
if special.active is False:
|
if special.active is False:
|
||||||
is_cancel = False
|
# is_cancel = False
|
||||||
# 工单采购单外协出入库单皆需取消
|
# 工单采购单外协出入库单皆需取消
|
||||||
domain = [('production_id', '=', special.production_id.id)]
|
domain = [('production_id', '=', special.production_id.id)]
|
||||||
if special.process_parameters_id:
|
if special.process_parameters_id:
|
||||||
@@ -67,23 +67,21 @@ class ProductionTechnologyWizard(models.TransientModel):
|
|||||||
else:
|
else:
|
||||||
domain += [('technology_design_id', '=', special.id), ('state', '!=', 'cancel')]
|
domain += [('technology_design_id', '=', special.id), ('state', '!=', 'cancel')]
|
||||||
workorder = self.env['mrp.workorder'].search(domain)
|
workorder = self.env['mrp.workorder'].search(domain)
|
||||||
previous_workorder = self.env['mrp.workorder'].search(
|
# previous_workorder = self.env['mrp.workorder'].search(
|
||||||
[('sequence', '=', workorder.sequence - 1), ('routing_type', '=', '表面工艺'),
|
# [('sequence', '=', workorder.sequence - 1), ('routing_type', '=', '表面工艺'),
|
||||||
('production_id', '=', workorder.production_id.id)])
|
# ('production_id', '=', workorder.production_id.id)])
|
||||||
if previous_workorder:
|
# if previous_workorder:
|
||||||
if previous_workorder.supplier_id != workorder.supplier_id:
|
# if previous_workorder.supplier_id != workorder.supplier_id:
|
||||||
is_cancel = True
|
# is_cancel = True
|
||||||
else:
|
# if workorder.state != 'cancel' and is_cancel is True:
|
||||||
is_cancel = True
|
workorder.write({'state': 'cancel'})
|
||||||
if workorder.state != 'cancel' and is_cancel is True:
|
workorder.picking_ids.write({'state': 'cancel'})
|
||||||
workorder.write({'state': 'cancel'})
|
workorder.picking_ids.move_ids.write({'state': 'cancel'})
|
||||||
workorder.picking_ids.write({'state': 'cancel'})
|
purchase_order = self.env['purchase.order'].search(
|
||||||
workorder.picking_ids.move_ids.write({'state': 'cancel'})
|
[('origin', '=', workorder.production_id.name), ('purchase_type', '=', 'consignment')])
|
||||||
purchase_order = self.env['purchase.order'].search(
|
for line in purchase_order.order_line:
|
||||||
[('origin', '=', workorder.production_id.name), ('purchase_type', '=', 'consignment')])
|
if line.product_id.server_product_process_parameters_id == workorder.surface_technics_parameters_id:
|
||||||
for line in purchase_order.order_line:
|
purchase_order.write({'state': 'cancel'})
|
||||||
if line.product_id.server_product_process_parameters_id == workorder.surface_technics_parameters_id:
|
|
||||||
purchase_order.write({'state': 'cancel'})
|
|
||||||
else:
|
else:
|
||||||
if special.production_id.workorder_ids:
|
if special.production_id.workorder_ids:
|
||||||
workorder = self.env['mrp.workorder'].search(
|
workorder = self.env['mrp.workorder'].search(
|
||||||
|
|||||||
Reference in New Issue
Block a user