Skip to content

Commit

Permalink
Fix product _compute_quantities context dependencies
Browse files Browse the repository at this point in the history
Description of the issue/feature this PR addresses:
_compute_quantities calls _compute_quantities_dict which calls _get_domain_locations, this last function depends also on 'location' and 'warehouse' from context, so also this variables should be put in the depends_context decorator

Current behavior before PR:
product.qty_available and product.with_context(location=x).qty_available return the same value also if the product in stored in more than one location
Desired behavior after PR is merged:
product.with_context(location=x).qty_available should return the quantity available only in location x

This has been already fixed in 14.0.
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

closes #69874

Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
  • Loading branch information
alessandro-fiorino committed Apr 26, 2021
1 parent 413357e commit 4625f3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/stock/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Product(models.Model):
@api.depends('stock_move_ids.product_qty', 'stock_move_ids.state')
@api.depends_context(
'lot_id', 'owner_id', 'package_id', 'from_date', 'to_date',
'company_owned', 'force_company',
'company_owned', 'force_company', 'location', 'warehouse'
)
def _compute_quantities(self):
products = self.filtered(lambda p: p.type != 'service')
Expand Down

0 comments on commit 4625f3d

Please sign in to comment.