Skip to content

Commit

Permalink
[FIX] stock: quant domain in valorisation
Browse files Browse the repository at this point in the history
- 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#27145
  • Loading branch information
nim-odoo committed Sep 21, 2018
1 parent 461871e commit ee96c84
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addons/stock/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def _get_domain_locations(self):
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),
])
Expand Down
2 changes: 1 addition & 1 deletion addons/stock_account/tests/test_stockvaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3111,7 +3111,7 @@ def test_fifo_sublocation_valuation_1(self):
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)

Expand Down

0 comments on commit ee96c84

Please sign in to comment.