修复制造订单-采购单
This commit is contained in:
@@ -269,10 +269,10 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
@api.depends('state', 'production_id.name')
|
@api.depends('state', 'production_id.name')
|
||||||
def _compute_surface_technics_purchase_ids(self):
|
def _compute_surface_technics_purchase_ids(self):
|
||||||
for order in self:
|
for order in self:
|
||||||
if order.routing_type == '表面工艺':
|
if order.routing_type == '表面工艺' and order.state not in ['cancel']:
|
||||||
# if order.production_id.production_type == '自动化产线加工':
|
# if order.production_id.production_type == '自动化产线加工':
|
||||||
# domain = [('programming_no', '=', order.production_id.programming_no)]
|
# domain = [('programming_no', '=', order.production_id.programming_no)]
|
||||||
# else:
|
# else:buzhdiao
|
||||||
# domain = [('origin', '=', order.production_id.origin)]
|
# domain = [('origin', '=', order.production_id.origin)]
|
||||||
# production_programming = self.env['mrp.production'].search(domain, order='name asc')
|
# production_programming = self.env['mrp.production'].search(domain, order='name asc')
|
||||||
# production_list = [production.name for production in production_programming]
|
# production_list = [production.name for production in production_programming]
|
||||||
|
|||||||
@@ -139,7 +139,7 @@
|
|||||||
<button type="object" name="action_view_surface_technics_purchase" class="oe_stat_button"
|
<button type="object" name="action_view_surface_technics_purchase" class="oe_stat_button"
|
||||||
icon="fa-credit-card"
|
icon="fa-credit-card"
|
||||||
groups="base.group_user,sf_base.group_sf_order_user"
|
groups="base.group_user,sf_base.group_sf_order_user"
|
||||||
attrs="{'invisible': [('surface_technics_purchase_count', '=', 0),('routing_type', '!=', '表面工艺')]}">
|
attrs="{'invisible': [('surface_technics_purchase_count', '=', 0)]}">
|
||||||
<div class="o_field_widget o_stat_info">
|
<div class="o_field_widget o_stat_info">
|
||||||
<span class="o_stat_value">
|
<span class="o_stat_value">
|
||||||
<field name="surface_technics_purchase_count"/>
|
<field name="surface_technics_purchase_count"/>
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ class ProductionTechnologyReAdjustWizard(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
|
||||||
# 工单采购单外协出入库单皆需取消
|
# 工单采购单外协出入库单皆需取消
|
||||||
domain = [('production_id', '=', special.production_id.id)]
|
domain = [('production_id', '=', special.production_id.id)]
|
||||||
if special.process_parameters_id:
|
if special.process_parameters_id:
|
||||||
@@ -69,7 +70,15 @@ class ProductionTechnologyReAdjustWizard(models.TransientModel):
|
|||||||
else:
|
else:
|
||||||
domain += [('technology_design_id', '=', special.id)]
|
domain += [('technology_design_id', '=', special.id)]
|
||||||
workorder = self.env['mrp.workorder'].search(domain)
|
workorder = self.env['mrp.workorder'].search(domain)
|
||||||
if workorder.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
|
||||||
|
else:
|
||||||
|
is_cancel = True
|
||||||
|
if workorder.state != 'cancel' and is_cancel is True:
|
||||||
workorder.write({'state': 'cancel'})
|
workorder.write({'state': 'cancel'})
|
||||||
workorder.picking_ids.write({'state': 'cancel'})
|
workorder.picking_ids.write({'state': 'cancel'})
|
||||||
workorder.picking_ids.move_ids.write({'state': 'cancel'})
|
workorder.picking_ids.move_ids.write({'state': 'cancel'})
|
||||||
|
|||||||
@@ -53,9 +53,61 @@ class ProductionTechnologyWizard(models.TransientModel):
|
|||||||
td_upd = self.env['sf.technology.design'].sudo().search(domain)
|
td_upd = self.env['sf.technology.design'].sudo().search(domain)
|
||||||
if td_upd:
|
if td_upd:
|
||||||
ro.write({'sequence': td_upd.sequence, 'active': td_upd.active})
|
ro.write({'sequence': td_upd.sequence, 'active': td_upd.active})
|
||||||
# special = production.technology_design_ids.filtered(
|
special_design = self.env['sf.technology.design'].sudo().search(
|
||||||
# lambda td: td.is_auto is False and td.process_parameters_id is not False)
|
[('routing_tag', '=', 'special'), ('production_id', '=', production.id),
|
||||||
# # if special:
|
('is_auto', '=', False), ('active', 'in', [True, False])])
|
||||||
|
for special in special_design:
|
||||||
|
workorders_values = []
|
||||||
|
if special.active is False:
|
||||||
|
is_cancel = False
|
||||||
|
# 工单采购单外协出入库单皆需取消
|
||||||
|
domain = [('production_id', '=', special.production_id.id)]
|
||||||
|
if special.process_parameters_id:
|
||||||
|
domain += [('surface_technics_parameters_id', '=', special.process_parameters_id.id)]
|
||||||
|
else:
|
||||||
|
domain += [('technology_design_id', '=', special.id)]
|
||||||
|
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.origin)])
|
||||||
|
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(
|
||||||
|
[('technology_design_id', '=', special.id), ('production_id', '=', special.production_id.id)])
|
||||||
|
if not workorder:
|
||||||
|
if special.route_id.routing_type == '表面工艺':
|
||||||
|
product_production_process = self.env['product.template'].search(
|
||||||
|
[('server_product_process_parameters_id', '=', special.process_parameters_id.id)])
|
||||||
|
workorders_values.append(
|
||||||
|
self.env[
|
||||||
|
'mrp.workorder']._json_workorder_surface_process_str(special.production_id, special,
|
||||||
|
product_production_process.seller_ids[
|
||||||
|
0].partner_id.id))
|
||||||
|
else:
|
||||||
|
workorders_values.append(
|
||||||
|
self.env['mrp.workorder'].json_workorder_str(special.production_id, special))
|
||||||
|
special.production_id.write({'workorder_ids': workorders_values})
|
||||||
|
else:
|
||||||
|
if len(workorder.blocked_by_workorder_ids) > 1:
|
||||||
|
if workorder.sequence == 1:
|
||||||
|
workorder.blocked_by_workorder_ids = None
|
||||||
|
else:
|
||||||
|
if workorder.blocked_by_workorder_ids:
|
||||||
|
workorder.blocked_by_workorder_ids = blocked_by_workorder_ids[0]
|
||||||
productions._create_workorder(False)
|
productions._create_workorder(False)
|
||||||
if self.production_id.product_id.categ_id.type == '成品':
|
if self.production_id.product_id.categ_id.type == '成品':
|
||||||
productions.get_subcontract_pick_purchase()
|
productions.get_subcontract_pick_purchase()
|
||||||
|
|||||||
Reference in New Issue
Block a user