[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
This commit is contained in:
Arnold Moyaux
2022-02-02 16:40:48 +00:00
committed by Tiffany Chang (tic)
parent 476394c580
commit ea16215bb6
+4 -1
View File
@@ -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):