[FIX] stock: quant domain in valorisation

- Create a Customer location (CL) and set a Company on it
- Configure Product A in FIFO / Perpetual
- Receive 2 Unit(s) of A in Stock
- Create an Internal Transfer
  1 Unit(s) of Product A
  Source location: Stock
  Destination Location: CL
- Validate

The Inventory Valuation report incorrectly retrieves a quantity of 2 in
stock instead of 1.

The error is first due to a misconfiguration: the CL should not have a
Company set. However, we should not take into account any quantity in a
customer location, even if there is a Company set.

opw-1884675
opw-1884835

closes odoo/odoo#27145
This commit is contained in:
Nicolas Martinelli
2018-09-21 11:50:55 +00:00
parent 461871e7f8
commit ee96c84a60
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -159,7 +159,7 @@ class Product(models.Model):
if self.env.context.get('company_owned', False):
company_id = self.env.user.company_id.id
return (
[('location_id.company_id', '=', company_id)],
[('location_id.company_id', '=', company_id), ('location_id.usage', 'in', ['internal', 'transit'])],
[('location_id.company_id', '=', False), ('location_dest_id.company_id', '=', company_id)],
[('location_id.company_id', '=', company_id), ('location_dest_id.company_id', '=', False),
])
@@ -3111,7 +3111,7 @@ class TestStockValuation(TransactionCase):
self.assertEqual(move1.remaining_value, 10)
self.assertEqual(move1.remaining_qty, 1)
self.assertAlmostEqual(self.product1.qty_available, 0.0)
self.assertAlmostEqual(self.product1.qty_at_date, 2.0)
self.assertAlmostEqual(self.product1.qty_at_date, 1.0)
self.assertEqual(self.product1.stock_value, 10)
self.assertTrue(len(move1.account_move_ids), 1)