Merge branch 'develop' into feature/6694
This commit is contained in:
@@ -6,7 +6,7 @@ from odoo.addons.sf_base.decorators.api_log import api_log
|
|||||||
|
|
||||||
class MainController(http.Controller):
|
class MainController(http.Controller):
|
||||||
|
|
||||||
@http.route('/api/manual_download_program', type='json', methods=['POST'], auth='public', cors='*')
|
@http.route('/api/manual_download_program', type='json', methods=['POST'], auth='wechat_token', cors='*')
|
||||||
@api_log('人工线下加工编程文件传输', requester='报工系统')
|
@api_log('人工线下加工编程文件传输', requester='报工系统')
|
||||||
def manual_download_program(self):
|
def manual_download_program(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -513,11 +513,10 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def _get_surface_technics_purchase_ids(self):
|
def _get_surface_technics_purchase_ids(self):
|
||||||
domain = [('origin', 'like', '%' + self.production_id.name + '%'), ('purchase_type', '=', 'consignment')]
|
domain = [('origin', 'like', '%' + self.production_id.name + '%'), ('purchase_type', '=', 'consignment'), ('state', '!=', 'cancel')]
|
||||||
# domain = [('origin', 'like', '%' + self.production_id.name + '%'), ('purchase_type', '=', 'consignment')]
|
# domain = [('origin', 'like', '%' + self.production_id.name + '%'), ('purchase_type', '=', 'consignment')]
|
||||||
# domain = [('group_id', '=', self.production_id.procurement_group_id.id), ('purchase_type', '=', 'consignment')]
|
# domain = [('group_id', '=', self.production_id.procurement_group_id.id), ('purchase_type', '=', 'consignment')]
|
||||||
purchase_orders = self.env['purchase.order'].search(domain, order='id desc', # 按创建时间降序(最新的在前)
|
purchase_orders = self.env['purchase.order'].search(domain, order='id desc')
|
||||||
limit=1)
|
|
||||||
purchase_orders_id = self.env['purchase.order']
|
purchase_orders_id = self.env['purchase.order']
|
||||||
for po in purchase_orders:
|
for po in purchase_orders:
|
||||||
for line in po.order_line:
|
for line in po.order_line:
|
||||||
|
|||||||
@@ -213,11 +213,11 @@ class ReworkWizard(models.TransientModel):
|
|||||||
self.production_id.get_new_program(panel_name)
|
self.production_id.get_new_program(panel_name)
|
||||||
if self.reprogramming_num >= 0 and self.programming_state == '已下发':
|
if self.reprogramming_num >= 0 and self.programming_state == '已下发':
|
||||||
# ============= 处理CNC加工加工工单的 CNC程序和cmm程序 信息=============
|
# ============= 处理CNC加工加工工单的 CNC程序和cmm程序 信息=============
|
||||||
for cnc_work in new_work_ids.filtered(lambda wk: wk.name == 'CNC加工'):
|
for cnc_work in new_work_ids.filtered(lambda wk: wk.name == 'CNC加工' or wk.name == '人工线下加工'):
|
||||||
ret = {'programming_list': []}
|
ret = {'programming_list': []}
|
||||||
old_cnc_rework = max(self.production_id.workorder_ids.filtered(
|
old_cnc_rework = max(self.production_id.workorder_ids.filtered(
|
||||||
lambda crw: crw.processing_panel == cnc_work.processing_panel
|
lambda crw: crw.processing_panel == cnc_work.processing_panel
|
||||||
and crw.state == 'rework' and crw.routing_type == 'CNC加工'),
|
and crw.state == 'rework' and (crw.routing_type == 'CNC加工' or crw.routing_type == '人工线下加工')),
|
||||||
key=lambda w: w.create_date
|
key=lambda w: w.create_date
|
||||||
)
|
)
|
||||||
# 获取当前工单的CNC程序和cmm程序
|
# 获取当前工单的CNC程序和cmm程序
|
||||||
@@ -259,7 +259,7 @@ class ReworkWizard(models.TransientModel):
|
|||||||
new_cnc_workorder = self.production_id.workorder_ids.filtered(
|
new_cnc_workorder = self.production_id.workorder_ids.filtered(
|
||||||
lambda ap1: ap1.processing_panel == cnc_work.processing_panel
|
lambda ap1: ap1.processing_panel == cnc_work.processing_panel
|
||||||
and ap1.state not in (
|
and ap1.state not in (
|
||||||
'rework', 'done') and ap1.routing_type == 'CNC加工'
|
'rework', 'done') and (ap1.routing_type == 'CNC加工' or ap1.routing_type == '人工线下加工')
|
||||||
)
|
)
|
||||||
if not new_cnc_workorder.cnc_ids:
|
if not new_cnc_workorder.cnc_ids:
|
||||||
new_cnc_workorder.write({
|
new_cnc_workorder.write({
|
||||||
@@ -303,18 +303,22 @@ class ReworkWizard(models.TransientModel):
|
|||||||
@api.onchange('production_id')
|
@api.onchange('production_id')
|
||||||
def onchange_processing_panel_id(self):
|
def onchange_processing_panel_id(self):
|
||||||
for item in self:
|
for item in self:
|
||||||
|
panel_ids = []
|
||||||
domain = [('id', '=', False)]
|
domain = [('id', '=', False)]
|
||||||
production_id = item.production_id
|
production_id = item.production_id
|
||||||
if production_id:
|
if production_id:
|
||||||
if self.env.user.has_group('sf_base.group_sf_order_user'):
|
if self.env.user.has_group('sf_base.group_sf_order_user'):
|
||||||
panel_ids = []
|
|
||||||
panel_arr = production_id.product_id.model_processing_panel
|
panel_arr = production_id.product_id.model_processing_panel
|
||||||
if panel_arr is False:
|
if panel_arr is False:
|
||||||
break
|
break
|
||||||
for p in production_id.detection_result_ids.filtered(
|
for p in production_id.detection_result_ids.filtered(
|
||||||
lambda ap1: ap1.handle_result == '待处理'):
|
lambda ap1: ap1.handle_result == '待处理'):
|
||||||
if p.processing_panel is not False and p.processing_panel not in panel_arr:
|
if p.processing_panel is not False and p.processing_panel not in panel_arr:
|
||||||
|
if len(panel_arr)>0:
|
||||||
panel_arr += ','.join(p.processing_panel)
|
panel_arr += ','.join(p.processing_panel)
|
||||||
|
else:
|
||||||
|
panel_arr = p.processing_panel
|
||||||
for item in panel_arr.split(','):
|
for item in panel_arr.split(','):
|
||||||
panel = self.env['sf.processing.panel'].search(
|
panel = self.env['sf.processing.panel'].search(
|
||||||
[('name', 'ilike', item)])
|
[('name', 'ilike', item)])
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ class sf_production_plan(models.Model):
|
|||||||
"""
|
"""
|
||||||
排程方法
|
排程方法
|
||||||
"""
|
"""
|
||||||
self.deal_processing_schedule(self.date_planned_start)
|
self.deal_processing_schedule(self[0].date_planned_start)
|
||||||
for record in self:
|
for record in self:
|
||||||
if not record.production_line_id:
|
if not record.production_line_id:
|
||||||
raise ValidationError("未选择生产线")
|
raise ValidationError("未选择生产线")
|
||||||
|
|||||||
@@ -343,10 +343,13 @@ class RePurchaseOrder(models.Model):
|
|||||||
if order_line.product_id.id in product_list:
|
if order_line.product_id.id in product_list:
|
||||||
purchase.purchase_type = 'outsourcing'
|
purchase.purchase_type = 'outsourcing'
|
||||||
break
|
break
|
||||||
request_lines = self.order_line.mapped('purchase_request_lines')
|
if purchase.order_line[0].product_id.categ_id.name == '坯料':
|
||||||
# 检查是否存在 is_subcontract 为 True 的行
|
if purchase.order_line[0].product_id.materials_type_id.gain_way == '外协':
|
||||||
if any(line.is_subcontract for line in request_lines):
|
purchase.purchase_type = 'outsourcing'
|
||||||
purchase.purchase_type = 'consignment'
|
# request_lines = self.order_line.mapped('purchase_request_lines')
|
||||||
|
# # 检查是否存在 is_subcontract 为 True 的行
|
||||||
|
# if any(line.is_subcontract for line in request_lines):
|
||||||
|
# purchase.purchase_type = 'consignment'
|
||||||
|
|
||||||
|
|
||||||
delivery_warning = fields.Selection([('normal', '正常'), ('warning', '预警'), ('overdue', '已逾期')],
|
delivery_warning = fields.Selection([('normal', '正常'), ('warning', '预警'), ('overdue', '已逾期')],
|
||||||
|
|||||||
Reference in New Issue
Block a user