From ea16215bb689486d7d8d9993b202daddf255417f Mon Sep 17 00:00:00 2001 From: Arnold Moyaux Date: Wed, 19 Jan 2022 08:37:05 +0000 Subject: [PATCH] [FIX] stock: avoid to merge all moves Some projects start to have real planning and in multiple steps the `stock.move` that are not linked to a RFQ or a MO are always merge together with the minimal date are result. It's not flexible since you don't know the correct quantity for a specific day. And once this quantity is received, you don't know the next date. We just add a system parameter for now and it will be modify in master to be able to do this configuration for everyone. X-original-commit: b9fffac7a8b6ccef2d957b5564ce615b2e1b0b36 Part-of: odoo/odoo#83430 --- addons/stock/models/stock_move.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py index a439872d01b..bccfed15783 100644 --- a/addons/stock/models/stock_move.py +++ b/addons/stock/models/stock_move.py @@ -808,12 +808,15 @@ class StockMove(models.Model): @api.model def _prepare_merge_moves_distinct_fields(self): - return [ + 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', 'product_packaging_id', ] + if self.env['ir.config_parameter'].sudo().get_param('stock.merge_only_same_date'): + fields.append('date') + return fields @api.model def _prepare_merge_negative_moves_excluded_distinct_fields(self):