[FIX] stock: add system parameter to ignore date_deadline in merge
'date_deadline' is always present in a 'stock.move' and in some specific cases, can prevent the merge of moves in the same transfer. In the example bellow, new moves are added to the same transfer every day (for each scheduler run), but the moves are not merged together. There is 2 thing we could d oto fix this situation: - Create a new transfer for each date_deadline - Merge the move with distinct date_deadline Usually, it makes sense to not merge moves with distinct date_deadline, but it also makes sense to not create a new resupply transfer every day. So for now, we treat this situation as a limitation, but we still provide a workaround: By adding a system parameter, we give the possibility to the user to ignore the date_deadline when merging moves. ## HOW TO REPRODUCE: - Create new Warehouse 'Warehouse 2' WH2 - Create Custom Route to resupply 'WH/Stock' from 'Transit' From 'WH2/stock' (see screenshot) - Create product P1 (storable, with custom route selected) - Create reordering rule on default warehouse, with min=1, max=1, route=custom route - Create Sale Order for 10 units of P1, confirm => New Receipt from 'Transit' -> 'WH/Stock' generated - Wait 1 day (alternative is to increment the Lead Time on the Stock Rules). - Create Sale Order for 10 units of P1, confirm => Same Receipt used, 2 lines are present. OPW-3633551 closes odoo/odoo#154276 X-original-commit: 8bed8f89cf2faf635f3148a747429241cbdfe460 Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com> Signed-off-by: David Fesquet (dafr) <dafr@odoo.com>
This commit is contained in:
@@ -957,13 +957,15 @@ Please change the quantity done or the rounding precision of your unit of measur
|
||||
fields = [
|
||||
'product_id', 'price_unit', 'procure_method', 'location_id', 'location_dest_id',
|
||||
'product_uom', 'restrict_partner_id', 'scrapped', 'origin_returned_move_id',
|
||||
'package_level_id', 'propagate_cancel', 'description_picking', 'date_deadline',
|
||||
'package_level_id', 'propagate_cancel', 'description_picking',
|
||||
'product_packaging_id',
|
||||
]
|
||||
if self.env['ir.config_parameter'].sudo().get_param('stock.merge_only_same_date'):
|
||||
fields.append('date')
|
||||
if self.env.context.get('merge_extra'):
|
||||
fields.pop(fields.index('procure_method'))
|
||||
if not self.env['ir.config_parameter'].sudo().get_param('stock.merge_ignore_date_deadline'):
|
||||
fields.append('date_deadline')
|
||||
return fields
|
||||
|
||||
@api.model
|
||||
|
||||
Reference in New Issue
Block a user