修复制造订单相关问题
This commit is contained in:
@@ -1306,6 +1306,7 @@ class MrpProduction(models.Model):
|
|||||||
raise_user_error=not self.env.context.get('from_orderpoint'))
|
raise_user_error=not self.env.context.get('from_orderpoint'))
|
||||||
productions = self.env['mrp.production'].sudo().search(
|
productions = self.env['mrp.production'].sudo().search(
|
||||||
[('origin', '=', self.origin)], order='id desc', limit=1)
|
[('origin', '=', self.origin)], order='id desc', limit=1)
|
||||||
|
productions.write({'programming_no': self.programming_no, 'is_remanufacture': True})
|
||||||
move = self.env['stock.move'].search([('origin', '=', productions.name)], order='id desc')
|
move = self.env['stock.move'].search([('origin', '=', productions.name)], order='id desc')
|
||||||
for mo in move:
|
for mo in move:
|
||||||
domain = []
|
domain = []
|
||||||
@@ -1332,7 +1333,6 @@ class MrpProduction(models.Model):
|
|||||||
mo_move.write({'reference': sfp_move.reference, 'partner_id': sfp_move.partner_id.id,
|
mo_move.write({'reference': sfp_move.reference, 'partner_id': sfp_move.partner_id.id,
|
||||||
'picking_id': sfp_move.picking_id.id, 'picking_type_id': sfp_move.picking_type_id.id,
|
'picking_id': sfp_move.picking_id.id, 'picking_type_id': sfp_move.picking_type_id.id,
|
||||||
'production_id': False})
|
'production_id': False})
|
||||||
productions.write({'programming_no': self.programming_no, 'is_remanufacture': True})
|
|
||||||
# productions.procurement_group_id.mrp_production_ids.move_dest_ids.write(
|
# productions.procurement_group_id.mrp_production_ids.move_dest_ids.write(
|
||||||
# {'group_id': self.env['procurement.group'].search([('name', '=', sale_order.name)])})
|
# {'group_id': self.env['procurement.group'].search([('name', '=', sale_order.name)])})
|
||||||
stock_picking_remanufacture = self.env['stock.picking'].search([('origin', '=', productions.name)])
|
stock_picking_remanufacture = self.env['stock.picking'].search([('origin', '=', productions.name)])
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ from odoo.exceptions import ValidationError, UserError
|
|||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
|
|
||||||
|
|
||||||
from OCC.Extend.DataExchange import read_step_file
|
# from OCC.Extend.DataExchange import read_step_file
|
||||||
from OCC.Extend.DataExchange import write_stl_file
|
# from OCC.Extend.DataExchange import write_stl_file
|
||||||
|
|
||||||
|
|
||||||
class ResProductMo(models.Model):
|
class ResProductMo(models.Model):
|
||||||
|
|||||||
@@ -970,12 +970,19 @@ class ReStockMove(models.Model):
|
|||||||
创建调拨单时,在此新增或修改调拨单的数据
|
创建调拨单时,在此新增或修改调拨单的数据
|
||||||
"""
|
"""
|
||||||
res = super(ReStockMove, self)._get_new_picking_values()
|
res = super(ReStockMove, self)._get_new_picking_values()
|
||||||
if self[0].origin and self.picking_type_id.name in ['生产发料', '内部调拨']:
|
## 制造订单报废生成的新制造订单不走合并
|
||||||
production = self.env['mrp.production'].search([('name', '=', self[0].origin)], limit=1, order='id asc')
|
production_remanufacture = None
|
||||||
productions = self.env['mrp.production'].search(
|
if 'origin' in res:
|
||||||
[('origin', '=', production.origin), ('product_id', '=', production.product_id.id)])
|
if self.picking_type_id.name in ['生产发料', '内部调拨']:
|
||||||
res['origin'] = ','.join(productions.mapped('name'))
|
production_remanufacture = self.env['mrp.production'].search(
|
||||||
res['retrospect_ref'] = production.product_id.name
|
[('name', '=', res['origin']), ('is_remanufacture', '=', True)])
|
||||||
|
if not production_remanufacture:
|
||||||
|
if self[0].origin and self.picking_type_id.name in ['生产发料', '内部调拨']:
|
||||||
|
production = self.env['mrp.production'].search([('name', '=', self[0].origin)], limit=1, order='id asc')
|
||||||
|
productions = self.env['mrp.production'].search(
|
||||||
|
[('origin', '=', production.origin), ('product_id', '=', production.product_id.id)])
|
||||||
|
res['origin'] = ','.join(productions.mapped('name'))
|
||||||
|
res['retrospect_ref'] = production.product_id.name
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _single_manufactuing_mo_generate_origin(self, res):
|
def _single_manufactuing_mo_generate_origin(self, res):
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ from datetime import datetime
|
|||||||
import requests
|
import requests
|
||||||
from odoo import http
|
from odoo import http
|
||||||
from odoo.http import request
|
from odoo.http import request
|
||||||
from OCC.Extend.DataExchange import read_step_file
|
# from OCC.Extend.DataExchange import read_step_file
|
||||||
from OCC.Extend.DataExchange import write_stl_file
|
# from OCC.Extend.DataExchange import write_stl_file
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
from odoo.exceptions import ValidationError, UserError
|
from odoo.exceptions import ValidationError, UserError
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import requests
|
|||||||
import os
|
import os
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
# from OCC.Core.GProp import GProp_GProps
|
# from OCC.Core.GProp import GProp_GProps
|
||||||
from OCC.Extend.DataExchange import read_step_file
|
# from OCC.Extend.DataExchange import read_step_file
|
||||||
from OCC.Extend.DataExchange import write_stl_file
|
# from OCC.Extend.DataExchange import write_stl_file
|
||||||
from odoo.addons.sf_base.commons.common import Common
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
|
|||||||
Reference in New Issue
Block a user