[FIX] stock: qty_available at date company owned

should take into account inventory/production location with companies

used in avco/standard at date

followup of rev 67ea26460f

opw-2027859
This commit is contained in:
Simon Lejeune
2019-07-16 11:48:12 +00:00
parent a2c60263fc
commit 0f57f0705a
+17 -3
View File
@@ -160,9 +160,23 @@ class Product(models.Model):
company_id = self.env.user.company_id.id
return (
[('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),
])
['&',
('location_dest_id.company_id', '=', company_id),
'|',
('location_id.company_id', '=', False),
'&',
('location_id.usage', 'in', ['inventory', 'production']),
('location_id.company_id', '=', company_id),
],
['&',
('location_id.company_id', '=', company_id),
'|',
('location_dest_id.company_id', '=', False),
'&',
('location_dest_id.usage', 'in', ['inventory', 'production']),
('location_dest_id.company_id', '=', company_id),
]
)
location_ids = []
if self.env.context.get('location', False):
if isinstance(self.env.context['location'], pycompat.integer_types):