1、优化客供料入库单的追溯参考字段自动计算方法
This commit is contained in:
@@ -324,12 +324,15 @@ class StockRule(models.Model):
|
||||
for k in (production_item.product_id.model_processing_panel.split(',')):
|
||||
if production_item.production_type == '自动化产线加工':
|
||||
product_routing_workcenter = self.env['sf.product.model.type.routing.sort'].search(
|
||||
[('product_model_type_id', '=', production_item.product_id.product_model_type_id.id)],
|
||||
[('product_model_type_id', '=',
|
||||
production_item.product_id.product_model_type_id.id)],
|
||||
order='sequence asc'
|
||||
)
|
||||
else:
|
||||
product_routing_workcenter = self.env['sf.manual.product.model.type.routing.sort'].search(
|
||||
[('manual_product_model_type_id', '=', production_item.product_id.product_model_type_id.id)],
|
||||
product_routing_workcenter = self.env[
|
||||
'sf.manual.product.model.type.routing.sort'].search(
|
||||
[('manual_product_model_type_id', '=',
|
||||
production_item.product_id.product_model_type_id.id)],
|
||||
order='sequence asc'
|
||||
)
|
||||
for route in product_routing_workcenter:
|
||||
@@ -592,18 +595,18 @@ class StockPicking(models.Model):
|
||||
for move_id in item.move_ids:
|
||||
move_ids.append(move_id.product_id.id)
|
||||
boms = self.env['mrp.bom'].sudo().search([('bom_line_ids.product_id', 'in', move_ids)])
|
||||
default_codes = ''
|
||||
if boms:
|
||||
codes_list = []
|
||||
for bom in boms:
|
||||
if bom.product_tmpl_id.default_code:
|
||||
code = bom.product_tmpl_id.default_code.split('-')[-1]
|
||||
default_code = bom.product_tmpl_id.default_code.split(f'-{code}')[0]
|
||||
if default_code not in default_codes:
|
||||
if default_codes == '':
|
||||
default_codes = default_code
|
||||
code_list = bom.product_tmpl_id.default_code.split('-')
|
||||
if len(code_list) >= 4:
|
||||
code = '-'.join(code_list[:4])
|
||||
if code not in codes_list:
|
||||
codes_list.append(code)
|
||||
else:
|
||||
default_codes = default_codes + ',' + default_code
|
||||
item.retrospect_ref = default_codes
|
||||
raise ValidationError('坯料成品的内部参考值格式错误')
|
||||
item.retrospect_ref = ','.join(codes_list)
|
||||
elif item.picking_type_id.sequence_code in ['INT', 'PC']:
|
||||
pass
|
||||
|
||||
@@ -966,7 +969,8 @@ class ReStockMove(models.Model):
|
||||
"""
|
||||
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)])
|
||||
productions = self.env['mrp.production'].search(
|
||||
[('origin', '=', production.origin), ('product_id', '=', production.product_id.id)])
|
||||
res['origin'] = ','.join(productions.mapped('name'))
|
||||
return res
|
||||
|
||||
|
||||
Reference in New Issue
Block a user