Accept Merge Request #2108: (feature/tool_standard_library_process -> 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/2108
This commit is contained in:
@@ -29,14 +29,6 @@ class MrpProduction(models.Model):
|
|||||||
采购请求
|
采购请求
|
||||||
"""
|
"""
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
# pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', self.name),('is_subcontract', '!=', True)])
|
|
||||||
# if self.product_id.product_tmpl_id.single_manufacturing == True and not self.is_remanufacture:
|
|
||||||
# first_order = self.env['mrp.production'].search(
|
|
||||||
# [('origin', '=', self.origin), ('product_id', '=', self.product_id.id)], limit=1, order='id asc')
|
|
||||||
# pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', first_order.name)])
|
|
||||||
# else:
|
|
||||||
# pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', self.name)])
|
|
||||||
# 由于采购申请合并了所有销售订单行的采购,所以不区分产品
|
|
||||||
first_mp = self.env['mrp.production'].search(
|
first_mp = self.env['mrp.production'].search(
|
||||||
[('origin', '=', self.origin)], limit=1, order='id asc')
|
[('origin', '=', self.origin)], limit=1, order='id asc')
|
||||||
pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', first_mp.name)])
|
pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', first_mp.name)])
|
||||||
@@ -54,7 +46,7 @@ class MrpProduction(models.Model):
|
|||||||
else:
|
else:
|
||||||
action.update({
|
action.update({
|
||||||
'name': _("从 %s生成采购请求单", self.name),
|
'name': _("从 %s生成采购请求单", self.name),
|
||||||
'domain': [('id', 'in', pr_ids)],
|
'domain': [('id', 'in', pr_ids.ids)],
|
||||||
'view_mode': 'tree,form',
|
'view_mode': 'tree,form',
|
||||||
})
|
})
|
||||||
return action
|
return action
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ class SfProductionProcessParameter(models.Model):
|
|||||||
obj = super(SfProductionProcessParameter, self).create(vals)
|
obj = super(SfProductionProcessParameter, self).create(vals)
|
||||||
return obj
|
return obj
|
||||||
def create_service_product(self):
|
def create_service_product(self):
|
||||||
|
if not self.active:
|
||||||
|
return
|
||||||
service_categ = self.env.ref(
|
service_categ = self.env.ref(
|
||||||
'sf_dlm.product_category_surface_technics_sf').sudo()
|
'sf_dlm.product_category_surface_technics_sf').sudo()
|
||||||
|
|
||||||
|
|||||||
@@ -928,6 +928,8 @@ class MrpProduction(models.Model):
|
|||||||
'sf_stock.stock_route_process_outsourcing').id)]
|
'sf_stock.stock_route_process_outsourcing').id)]
|
||||||
for product_id, request_line_list in grouped_purchase_request_line_sorted_list.items():
|
for product_id, request_line_list in grouped_purchase_request_line_sorted_list.items():
|
||||||
cur_request_line = request_line_list[0]
|
cur_request_line = request_line_list[0]
|
||||||
|
if cur_request_line['product_qty'] == 1:
|
||||||
|
cur_request_line['product_qty'] = len(request_line_list)
|
||||||
# cur_request_line['product_qty'] = cur_request_line['product_qty']
|
# cur_request_line['product_qty'] = cur_request_line['product_qty']
|
||||||
cur_request_line['request_id'] = pr.id
|
cur_request_line['request_id'] = pr.id
|
||||||
cur_request_line['origin'] = ", ".join({item['production_name'] for item in request_line_list if item.get('production_name')})
|
cur_request_line['origin'] = ", ".join({item['production_name'] for item in request_line_list if item.get('production_name')})
|
||||||
|
|||||||
@@ -1312,6 +1312,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
else:
|
else:
|
||||||
workorder.state = 'ready'
|
workorder.state = 'ready'
|
||||||
continue
|
continue
|
||||||
|
continue
|
||||||
# ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]==========================
|
# ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]==========================
|
||||||
if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework'
|
if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework'
|
||||||
or workorder.production_id.schedule_state != '已排'
|
or workorder.production_id.schedule_state != '已排'
|
||||||
@@ -1327,9 +1328,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
if workorder.is_subcontract is False:
|
if workorder.is_subcontract is False:
|
||||||
workorder.state = 'ready'
|
workorder.state = 'ready'
|
||||||
else:
|
else:
|
||||||
if len(workorder.production_id.picking_ids.filtered(
|
if workorder.production_id.programming_state == '已编程':
|
||||||
lambda w: w.state not in ['done',
|
|
||||||
'cancel'])) == 0 and workorder.production_id.programming_state == '已编程':
|
|
||||||
purchase_orders_id = self._get_surface_technics_purchase_ids()
|
purchase_orders_id = self._get_surface_technics_purchase_ids()
|
||||||
if purchase_orders_id:
|
if purchase_orders_id:
|
||||||
if purchase_orders_id.state == 'purchase':
|
if purchase_orders_id.state == 'purchase':
|
||||||
|
|||||||
@@ -152,6 +152,8 @@ class PurchaseOrder(models.Model):
|
|||||||
|
|
||||||
for line in self.order_line:
|
for line in self.order_line:
|
||||||
# 将产品不追踪序列号的行项目设置qty_done
|
# 将产品不追踪序列号的行项目设置qty_done
|
||||||
|
if not line.move_ids:
|
||||||
|
continue
|
||||||
if line.move_ids and line.move_ids[0].product_id.tracking == 'none':
|
if line.move_ids and line.move_ids[0].product_id.tracking == 'none':
|
||||||
line.move_ids[0].quantity_done = line.move_ids[0].product_qty
|
line.move_ids[0].quantity_done = line.move_ids[0].product_qty
|
||||||
return res
|
return res
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import base64
|
import base64
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
|
||||||
from odoo import http, fields, models
|
from odoo import http, fields, models
|
||||||
from odoo.http import request
|
from odoo.http import request
|
||||||
from odoo.addons.sf_base.controllers.controllers import MultiInheritController
|
from odoo.addons.sf_base.controllers.controllers import MultiInheritController
|
||||||
@@ -273,7 +276,8 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
res = {'status': -1, 'message': '系统解析失败'}
|
res = {'status': -1, 'message': '系统解析失败'}
|
||||||
request.cr.rollback()
|
request.cr.rollback()
|
||||||
logging.info('get_cnc_processing_create error:%s' % e)
|
traceback_error = traceback.format_exc()
|
||||||
|
logging.error("get_cnc_processing_create error:%s" % traceback_error)
|
||||||
return json.JSONEncoder().encode(res)
|
return json.JSONEncoder().encode(res)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user