Accept Merge Request #1563: (feature/修复报废调拨 -> develop)
Merge Request: 修复制造订单生成采购 Created By: @杨金灵 Reviewed By: @胡尧 Approved By: @胡尧 Accepted By: @杨金灵 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1563
This commit is contained in:
@@ -241,9 +241,9 @@ class ResMrpWorkOrder(models.Model):
|
||||
('production_id', '=', workorder.production_id.id)])
|
||||
if previous_workorder:
|
||||
if previous_workorder.supplier_id != workorder.supplier_id:
|
||||
process_product = self.env['product.template']._get_process_parameters_product(
|
||||
previous_workorder.surface_technics_parameters_id)
|
||||
domain += [('partner_id', '=', process_product.partner_id.id)]
|
||||
# process_product = self.env['product.template']._get_process_parameters_product(
|
||||
# previous_workorder.surface_technics_parameters_id)
|
||||
domain += [('surface_technics_parameters_id', '=', workorder.surface_technics_parameters_id.id)]
|
||||
else:
|
||||
domain += [('surface_technics_parameters_id', '=', workorder.surface_technics_parameters_id.id)]
|
||||
picking_ids = self.env['stock.picking'].search(domain, order='id asc')
|
||||
@@ -270,55 +270,57 @@ class ResMrpWorkOrder(models.Model):
|
||||
def _compute_surface_technics_purchase_ids(self):
|
||||
for order in self:
|
||||
if order.routing_type == '表面工艺':
|
||||
if order.production_id.production_type == '自动化产线加工':
|
||||
domain = [('programming_no', '=', order.production_id.programming_no)]
|
||||
else:
|
||||
domain = [('origin', '=', order.production_id.origin)]
|
||||
production_programming = self.env['mrp.production'].search(domain, order='name asc')
|
||||
production_list = [production.name for production in production_programming]
|
||||
production_no_remanufacture = production_programming.filtered(lambda a: a.is_remanufacture is False)
|
||||
# if order.production_id.production_type == '自动化产线加工':
|
||||
# domain = [('programming_no', '=', order.production_id.programming_no)]
|
||||
# else:
|
||||
# domain = [('origin', '=', order.production_id.origin)]
|
||||
# production_programming = self.env['mrp.production'].search(domain, order='name asc')
|
||||
# production_list = [production.name for production in production_programming]
|
||||
# production_no_remanufacture = production_programming.filtered(lambda a: a.is_remanufacture is False)
|
||||
# technology_design = self.env['sf.technology.design'].search(
|
||||
# [('process_parameters_id', '=', order.surface_technics_parameters_id.id),
|
||||
# ('production_id', '=', order.production_id.id)])
|
||||
# if technology_design.is_auto is False:
|
||||
# domain = [('origin', '=', order.production_id.name)]
|
||||
# else:
|
||||
domain = [('purchase_type', '=', 'consignment'), ('origin', '=', ','.join(production_list))]
|
||||
domain = [('purchase_type', '=', 'consignment'), ('origin', '=', order.production_id.name)]
|
||||
purchase = self.env['purchase.order'].search(domain)
|
||||
purchase_num = 0
|
||||
if not purchase:
|
||||
order.surface_technics_purchase_count = 0
|
||||
for line in purchase.order_line:
|
||||
if line.product_id.server_product_process_parameters_id == order.surface_technics_parameters_id:
|
||||
if line.product_qty == len(production_no_remanufacture):
|
||||
purchase_num += 1
|
||||
order.surface_technics_purchase_count = purchase_num
|
||||
for po in purchase:
|
||||
for line in po.order_line:
|
||||
if line.product_id.server_product_process_parameters_id == order.surface_technics_parameters_id:
|
||||
if line.product_qty == 1:
|
||||
purchase_num += 1
|
||||
order.surface_technics_purchase_count = purchase_num
|
||||
else:
|
||||
order.surface_technics_purchase_count = 0
|
||||
|
||||
def action_view_surface_technics_purchase(self):
|
||||
self.ensure_one()
|
||||
if self.routing_type == '表面工艺':
|
||||
if self.production_id.production_type == '自动化产线加工':
|
||||
domain = [('programming_no', '=', self.production_id.programming_no)]
|
||||
else:
|
||||
domain = [('origin', '=', self.production_id.origin)]
|
||||
production_programming = self.env['mrp.production'].search(domain, order='name asc')
|
||||
production_list = [production.name for production in production_programming]
|
||||
production_no_remanufacture = production_programming.filtered(lambda a: a.is_remanufacture is False)
|
||||
# if self.routing_type == '表面工艺':
|
||||
# if self.production_id.production_type == '自动化产线加工':
|
||||
# domain = [('programming_no', '=', self.production_id.programming_no)]
|
||||
# else:
|
||||
# domain = [('origin', '=', self.production_id.origin)]
|
||||
# production_programming = self.env['mrp.production'].search(domain, order='name asc')
|
||||
# production_list = [production.name for production in production_programming]
|
||||
# production_no_remanufacture = production_programming.filtered(lambda a: a.is_remanufacture is False)
|
||||
# technology_design = self.env['sf.technology.design'].search(
|
||||
# [('process_parameters_id', '=', self.surface_technics_parameters_id.id),
|
||||
# ('production_id', '=', self.production_id.id)])
|
||||
# if technology_design.is_auto is False:
|
||||
# domain = [('origin', '=', self.production_id.name)]
|
||||
# else:
|
||||
domain = [('origin', '=', ','.join(production_list)), ('purchase_type', '=', 'consignment')]
|
||||
domain = [('origin', '=', self.production_id.name), ('purchase_type', '=', 'consignment')]
|
||||
purchase_orders = self.env['purchase.order'].search(domain)
|
||||
purchase_orders_id = None
|
||||
for line in purchase_orders.order_line:
|
||||
if line.product_id.server_product_process_parameters_id == self.surface_technics_parameters_id:
|
||||
if line.product_qty == len(production_no_remanufacture):
|
||||
purchase_orders_id = line.order_id.id
|
||||
for po in purchase_orders:
|
||||
for line in po.order_line:
|
||||
if line.product_id.server_product_process_parameters_id == self.surface_technics_parameters_id:
|
||||
if line.product_qty == 1:
|
||||
purchase_orders_id = line.order_id.id
|
||||
result = {
|
||||
"type": "ir.actions.act_window",
|
||||
"res_model": "purchase.order",
|
||||
|
||||
Reference in New Issue
Block a user