Accept Merge Request #1711: (feature/part_number -> develop)
Merge Request: sf-制造订单-工单添加外协工序,制造订单状态变成已完成,销售订单的收货中没有该产品的调拨 Created By: @廖丹龙 Reviewed By: @秦圣 Approved By: @秦圣 Accepted By: @秦圣 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1711
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
'version': '0.1',
|
'version': '0.1',
|
||||||
|
|
||||||
# any module necessary for this one to work correctly
|
# any module necessary for this one to work correctly
|
||||||
'depends': ['purchase', 'base_tier_validation', 'documents', 'purchase_request', 'account', 'purchase_order_approved'],
|
'depends': ['purchase', 'purchase_tier_validation', 'documents', 'purchase_request', 'account', 'purchase_order_approved'],
|
||||||
|
|
||||||
# always loaded
|
# always loaded
|
||||||
'data': [
|
'data': [
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
from . import upload_file_wizard
|
from . import upload_file_wizard
|
||||||
|
from . import comment_wizard
|
||||||
15
jikimo_purchase_tier_validation/wizards/comment_wizard.py
Normal file
15
jikimo_purchase_tier_validation/wizards/comment_wizard.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
from odoo import models, fields
|
||||||
|
|
||||||
|
|
||||||
|
class CommentWizard(models.TransientModel):
|
||||||
|
_inherit = "comment.wizard"
|
||||||
|
|
||||||
|
def add_comment(self):
|
||||||
|
|
||||||
|
rec = self.env[self.res_model].browse(self.res_id)
|
||||||
|
|
||||||
|
self.review_ids = rec.review_ids
|
||||||
|
|
||||||
|
result = super(CommentWizard, self).add_comment()
|
||||||
|
|
||||||
|
return result
|
||||||
@@ -330,7 +330,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def _get_surface_technics_purchase_ids(self):
|
def _get_surface_technics_purchase_ids(self):
|
||||||
domain = [('origin', '=', self.production_id.name), ('purchase_type', '=', 'consignment')]
|
domain = [('origin', 'like', '%' + self.production_id.name + '%'), ('purchase_type', '=', 'consignment')]
|
||||||
purchase_orders = self.env['purchase.order'].search(domain)
|
purchase_orders = self.env['purchase.order'].search(domain)
|
||||||
purchase_orders_id = self.env['purchase.order']
|
purchase_orders_id = self.env['purchase.order']
|
||||||
for po in purchase_orders:
|
for po in purchase_orders:
|
||||||
@@ -1076,7 +1076,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
if workorder.state != 'waiting':
|
if workorder.state != 'waiting':
|
||||||
workorder.state = 'waiting'
|
workorder.state = 'waiting'
|
||||||
continue
|
continue
|
||||||
if workorder.production_id.programming_state == '已编程' and workorder.technology_design_id.routing_tag != 'special':
|
if workorder.production_id.programming_state == '已编程':
|
||||||
workorder.state = 'ready'
|
workorder.state = 'ready'
|
||||||
elif workorder.state != 'waiting':
|
elif workorder.state != 'waiting':
|
||||||
workorder.state = 'waiting'
|
workorder.state = 'waiting'
|
||||||
@@ -1097,7 +1097,6 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
else:
|
else:
|
||||||
workorder.state = 'waiting'
|
workorder.state = 'waiting'
|
||||||
|
|
||||||
|
|
||||||
# 重写工单开始按钮方法
|
# 重写工单开始按钮方法
|
||||||
def button_start(self):
|
def button_start(self):
|
||||||
# 判断工单状态是否为等待组件
|
# 判断工单状态是否为等待组件
|
||||||
@@ -1280,7 +1279,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
raise UserError('请先完成该工单的工艺外协再进行操作')
|
raise UserError('请先完成该工单的工艺外协再进行操作')
|
||||||
# 表面工艺外协,最后一张工单
|
# 表面工艺外协,最后一张工单
|
||||||
workorders = self.production_id.workorder_ids
|
workorders = self.production_id.workorder_ids
|
||||||
subcontract_workorders = workorders.filtered(lambda wo: wo.is_subcontract == True).sorted('sequence')
|
subcontract_workorders = workorders.filtered(lambda wo: wo.is_subcontract == True and wo.state != 'cancel').sorted('sequence')
|
||||||
if self == subcontract_workorders[-1]:
|
if self == subcontract_workorders[-1]:
|
||||||
# 给下一个库存移动就绪
|
# 给下一个库存移动就绪
|
||||||
self.move_subcontract_workorder_ids[0].move_dest_ids._action_done()
|
self.move_subcontract_workorder_ids[0].move_dest_ids._action_done()
|
||||||
@@ -1304,8 +1303,8 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
is_production_id = False
|
is_production_id = False
|
||||||
rework_workorder = record.production_id.workorder_ids.filtered(lambda p: p.state == 'rework')
|
rework_workorder = record.production_id.workorder_ids.filtered(lambda p: p.state == 'rework')
|
||||||
done_workorder = record.production_id.workorder_ids.filtered(lambda p1: p1.state in ['done'])
|
done_workorder = record.production_id.workorder_ids.filtered(lambda p1: p1.state in ['done'])
|
||||||
if (len(rework_workorder) + len(done_workorder) == len(record.production_id.workorder_ids)) or (
|
if (len(rework_workorder) + len(done_workorder) == len(record.production_id.workorder_ids.filtered(lambda wo: wo.state != 'cancel'))) or (
|
||||||
len(done_workorder) == len(record.production_id.workorder_ids)):
|
len(done_workorder) == len(record.production_id.workorder_ids.filtered(lambda wo: wo.state != 'cancel'))):
|
||||||
is_production_id = True
|
is_production_id = True
|
||||||
if record.routing_type in ['解除装夹'] or (
|
if record.routing_type in ['解除装夹'] or (
|
||||||
record.is_rework is True and record.routing_type in ['装夹预调']):
|
record.is_rework is True and record.routing_type in ['装夹预调']):
|
||||||
|
|||||||
@@ -637,7 +637,7 @@ class StockPicking(models.Model):
|
|||||||
if move_in:
|
if move_in:
|
||||||
workorder = move_in.subcontract_workorder_id
|
workorder = move_in.subcontract_workorder_id
|
||||||
workorders = workorder.production_id.workorder_ids
|
workorders = workorder.production_id.workorder_ids
|
||||||
subcontract_workorders = workorders.filtered(lambda wo: wo.is_subcontract == True).sorted('sequence')
|
subcontract_workorders = workorders.filtered(lambda wo: wo.is_subcontract == True and wo.state!='cancel').sorted('sequence')
|
||||||
if workorder == subcontract_workorders[-1]:
|
if workorder == subcontract_workorders[-1]:
|
||||||
self.env['stock.quant']._update_reserved_quantity(
|
self.env['stock.quant']._update_reserved_quantity(
|
||||||
move_in.product_id, move_in.location_dest_id, move_in.product_uom_qty,
|
move_in.product_id, move_in.location_dest_id, move_in.product_uom_qty,
|
||||||
|
|||||||
@@ -207,8 +207,9 @@ class WorkpieceDeliveryWizard(models.TransientModel):
|
|||||||
workorder.production_line_id.id != self.production_ids[0].production_line_id.id):
|
workorder.production_line_id.id != self.production_ids[0].production_line_id.id):
|
||||||
raise UserError(f'该rfid对应的制造订单号为{workorder.production_id.name}的目的生产线不一致')
|
raise UserError(f'该rfid对应的制造订单号为{workorder.production_id.name}的目的生产线不一致')
|
||||||
|
|
||||||
# 调用打印成品条码方法
|
if workorder.routing_type == '解除装夹':
|
||||||
workorder.print_method()
|
# 调用打印成品条码方法
|
||||||
|
workorder.print_method()
|
||||||
|
|
||||||
# 将对象添加到对应的同模型且是多对多类型里
|
# 将对象添加到对应的同模型且是多对多类型里
|
||||||
self.production_ids |= workorder.production_id
|
self.production_ids |= workorder.production_id
|
||||||
|
|||||||
@@ -2023,6 +2023,11 @@ msgstr "<span class=\"o_stat_text\">损失</span>"
|
|||||||
msgid "<span class=\"o_stat_text\">Maintenance</span>"
|
msgid "<span class=\"o_stat_text\">Maintenance</span>"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: sf_manufacturing
|
||||||
|
#: model:ir.model.fields.selection,name:sf_manufacturing.selection__mrp_production__state__confirmed
|
||||||
|
msgid "待排程"
|
||||||
|
msgstr "待排程"
|
||||||
|
|
||||||
#. module: mrp
|
#. module: mrp
|
||||||
#: model_terms:ir.ui.view,arch_db:mrp.product_product_form_view_bom_button
|
#: model_terms:ir.ui.view,arch_db:mrp.product_product_form_view_bom_button
|
||||||
#: model_terms:ir.ui.view,arch_db:mrp.product_template_form_view_bom_button
|
#: model_terms:ir.ui.view,arch_db:mrp.product_template_form_view_bom_button
|
||||||
|
|||||||
@@ -396,23 +396,6 @@ class RePurchaseOrder(models.Model):
|
|||||||
production = self.env['mrp.production'].search([('name', '=', production_name)])
|
production = self.env['mrp.production'].search([('name', '=', production_name)])
|
||||||
for workorder in production.workorder_ids.filtered(
|
for workorder in production.workorder_ids.filtered(
|
||||||
lambda wd: wd.routing_type == '表面工艺' and wd.state == 'waiting' and line.product_id.server_product_process_parameters_id == wd.surface_technics_parameters_id):
|
lambda wd: wd.routing_type == '表面工艺' and wd.state == 'waiting' and line.product_id.server_product_process_parameters_id == wd.surface_technics_parameters_id):
|
||||||
work_ids = workorder.production_id.workorder_ids.filtered(
|
|
||||||
lambda wk: wk.state not in ['done', 'rework', 'cancel'])
|
|
||||||
min_sequence_wk = min(work_ids, key=lambda wk: wk.sequence)
|
|
||||||
artificial_offline = (
|
|
||||||
workorder.production_id.production_type == '人工线下加工' and workorder.production_id.schedule_state != '已排')
|
|
||||||
auto_production = (
|
|
||||||
workorder.production_id.production_type == '自动化产线加工' and workorder.production_id.programming_state != '已编程')
|
|
||||||
if workorder.sequence == min_sequence_wk.sequence:
|
|
||||||
if artificial_offline or auto_production:
|
|
||||||
raise UserError('等待组件')
|
|
||||||
else:
|
|
||||||
sorted_work_ids = work_ids.sorted(key=lambda w: w.sequence)
|
|
||||||
previous_workorder = self.env['mrp.workorder'].search([('sequence', '<', workorder.sequence),
|
|
||||||
('production_id', '=', workorder.production_id.id),
|
|
||||||
('state', '=', 'done')], order='sequence desc', limit=1)
|
|
||||||
if not previous_workorder:
|
|
||||||
raise UserError('等待组件')
|
|
||||||
workorder.state = 'ready'
|
workorder.state = 'ready'
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
Reference in New Issue
Block a user