Wednesday, September 9, 2020
1 change · master
Resolved issues and error corrections
Inventory records for the same product and location can now be merged even when their arrival dates differ. This prevents duplicate stock quantity records from lingering and helps keep inventory data cleaner and easier to reconcile.
Original PR description
**Description of the issue/feature this PR addresses:** When there are no sql conflict the same quant is used, even of `in_date` is different. `_update_available_quantity`…
**Description of the issue/feature this PR addresses:** When there are no sql conflict the same quant is used, even of `in_date` is different. `_update_available_quantity` https://github.com/odoo/odoo/blob/12.0/addons/stock/models/stock_quant.py#L209, Odoo use an existing quants without worring `in_date` (and use `min()` during python merge). Indeed `_gather` `in_date` is not used to find quant (only used to use in `ORDER BY`) https://github.com/odoo/odoo/blob/12.0/addons/stock/models/stock_quant.py#L111. It should be logical to don't group by `in_date` during merge quants. **Current behavior before PR:** Create two quants with same `product_id`, `location_id`, `company_id`, `lot_id`, `package_id`, `owner_id` but with different `in_date`. (it is possible if https://github.com/odoo/odoo/blob/12.0/addons/stock/models/stock_quant.py#L223) Try to merge quants --> issue quants is not merge Desired behavior after PR is merged: quants merge Note : can be merged in master. @amoyaux @nim-odoo -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr