diff options
| author | Nicolas Lempereur <nle@odoo.com> | 2019-04-05 13:04:46 +0000 |
|---|---|---|
| committer | Nicolas Lempereur <nle@odoo.com> | 2019-04-05 13:38:16 +0000 |
| commit | 7a5f1068fa60a93c59273040db17811617a039d7 (patch) | |
| tree | defacc56cc4f9fc6943d693b1dcb5800c254c46c | |
| parent | 6fa292cec861da0ccfd3afe443062080171d2fc4 (diff) | |
[FIX] stock: return's return ok package location
If we create a package X transfering from location A to location B:
- we create a stock.quant for package X in location B
=> The package is on location "B" (OK)
If then we do a transfer of that package from location B to location A:
- we set the location B / package X quant to 0 size
- we create a stock.quant for package X in location A
=> The package is on location "A" (OK)
If then we do a transfer of that package from location A to location B:
- we set the location A / package X quant to 0 size
- we set the location B / package X quant to package size
=> The package still is on location "A" (wrong)
This is because:
- since c0d7a05730 stock.quant.package field `quant_ids` is a view over
related stock.quant but filtered on domain:
['|', ('quantity', '!=', 0), ('reserved_quantity', '!=', 0)]
- stock.quant.package fields `location_id`, `company_id`, `owner_id` are
updated when a related stock.quant has fields `package_id`,
`location_id`, `company_id`, `owner_id` modified
Thus when the `quant_ids` change by changing quantities, `location_id`
are not updated even if it should be.
opw-1963509
closes #32466
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
| -rw-r--r-- | addons/stock/models/stock_quant.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/stock/models/stock_quant.py b/addons/stock/models/stock_quant.py index de024209466..438b555a8cd 100644 --- a/addons/stock/models/stock_quant.py +++ b/addons/stock/models/stock_quant.py @@ -360,7 +360,7 @@ class QuantPackage(models.Model): 'res.partner', 'Owner', compute='_compute_package_info', search='_search_owner', index=True, readonly=True) - @api.depends('quant_ids.package_id', 'quant_ids.location_id', 'quant_ids.company_id', 'quant_ids.owner_id') + @api.depends('quant_ids.package_id', 'quant_ids.location_id', 'quant_ids.company_id', 'quant_ids.owner_id', 'quant_ids.quantity', 'quant_ids.reserved_quantity') def _compute_package_info(self): for package in self: values = {'location_id': False, 'company_id': self.env.user.company_id.id, 'owner_id': False} |
