Add warehouse to invoice line

This ensures that the cost price used for COGS lines come from the right
warehouse when it is computed per warehouse.

issue10568
review362161002
This commit is contained in:
Cédric Krier committed 2021-07-29 09:06:38 +02:00
1 parent b8d0bfebe9
commit 2f9399b555
1 file changed
+10
+10
View File
@@ -118,6 +118,16 @@ class InvoiceLine(metaclass=PoolMeta):
category = self.origin.unit.category.id
return category
def get_warehouse(self, name):
pool = Pool()
PurchaseLine = pool.get('purchase.line')
warehouse = super().get_warehouse(name)
if (not warehouse
and isinstance(self.origin, PurchaseLine)
and self.origin.purchase.warehouse):
warehouse = self.origin.purchase.warehouse.id
return warehouse
@property
def origin_name(self):
pool = Pool()