Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into develop
This commit is contained in:
@@ -324,12 +324,15 @@ class StockRule(models.Model):
|
|||||||
for k in (production_item.product_id.model_processing_panel.split(',')):
|
for k in (production_item.product_id.model_processing_panel.split(',')):
|
||||||
if production_item.production_type == '自动化产线加工':
|
if production_item.production_type == '自动化产线加工':
|
||||||
product_routing_workcenter = self.env['sf.product.model.type.routing.sort'].search(
|
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'
|
order='sequence asc'
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
product_routing_workcenter = self.env['sf.manual.product.model.type.routing.sort'].search(
|
product_routing_workcenter = self.env[
|
||||||
[('manual_product_model_type_id', '=', production_item.product_id.product_model_type_id.id)],
|
'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'
|
order='sequence asc'
|
||||||
)
|
)
|
||||||
for route in product_routing_workcenter:
|
for route in product_routing_workcenter:
|
||||||
@@ -592,18 +595,18 @@ class StockPicking(models.Model):
|
|||||||
for move_id in item.move_ids:
|
for move_id in item.move_ids:
|
||||||
move_ids.append(move_id.product_id.id)
|
move_ids.append(move_id.product_id.id)
|
||||||
boms = self.env['mrp.bom'].sudo().search([('bom_line_ids.product_id', 'in', move_ids)])
|
boms = self.env['mrp.bom'].sudo().search([('bom_line_ids.product_id', 'in', move_ids)])
|
||||||
default_codes = ''
|
|
||||||
if boms:
|
if boms:
|
||||||
|
codes_list = []
|
||||||
for bom in boms:
|
for bom in boms:
|
||||||
if bom.product_tmpl_id.default_code:
|
if bom.product_tmpl_id.default_code:
|
||||||
code = bom.product_tmpl_id.default_code.split('-')[-1]
|
code_list = bom.product_tmpl_id.default_code.split('-')
|
||||||
default_code = bom.product_tmpl_id.default_code.split(f'-{code}')[0]
|
if len(code_list) >= 4:
|
||||||
if default_code not in default_codes:
|
code = '-'.join(code_list[:4])
|
||||||
if default_codes == '':
|
if code not in codes_list:
|
||||||
default_codes = default_code
|
codes_list.append(code)
|
||||||
else:
|
else:
|
||||||
default_codes = default_codes + ',' + default_code
|
raise ValidationError('坯料成品的内部参考值格式错误')
|
||||||
item.retrospect_ref = default_codes
|
item.retrospect_ref = ','.join(codes_list)
|
||||||
elif item.picking_type_id.sequence_code in ['INT', 'PC']:
|
elif item.picking_type_id.sequence_code in ['INT', 'PC']:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -954,7 +957,8 @@ class ReStockMove(models.Model):
|
|||||||
res = super(ReStockMove, self)._merge_moves_fields()
|
res = super(ReStockMove, self)._merge_moves_fields()
|
||||||
if self[0].origin and self.picking_type_id.name in ['生产发料', '内部调拨']:
|
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 = 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'))
|
res['origin'] = ','.join(productions.mapped('name'))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@@ -965,7 +969,8 @@ 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 ['生产发料', '内部调拨']:
|
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 = 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'))
|
res['origin'] = ','.join(productions.mapped('name'))
|
||||||
res['retrospect_ref'] = production.product_id.name
|
res['retrospect_ref'] = production.product_id.name
|
||||||
return res
|
return res
|
||||||
@@ -976,7 +981,6 @@ class ReStockMove(models.Model):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ReStockQuant(models.Model):
|
class ReStockQuant(models.Model):
|
||||||
_inherit = 'stock.quant'
|
_inherit = 'stock.quant'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user