[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:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user