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 b695344b63
commit 054fd6898d
5 files changed
+23 -1

No files matched your search

+5
View File
@@ -5,6 +5,7 @@ from trytond.pool import Pool
from . import ir
from . import company
from . import product
from . import account
from . import stock
__all__ = ['register']
@@ -26,6 +27,10 @@ def register():
stock.Move,
stock.ShipmentInternal,
module='product_cost_warehouse', type_='model')
Pool.register(
account.InvoiceLine,
module='product_cost_warehouse', type_='model',
depends=['account_invoice_stock'])
Pool.register(
product.ProductCostHistory,
module='product_cost_warehouse', type_='model',
+15
View File
@@ -0,0 +1,15 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.pool import PoolMeta
from trytond.pyson import Eval
class InvoiceLine(metaclass=PoolMeta):
__name__ = 'account.invoice.line'
@classmethod
def __setup__(cls):
super().__setup__()
cls.product.context['warehouse'] = Eval('warehouse', -1)
if 'warehouse' not in cls.product.depends:
cls.product.depends.append('warehouse')
+1
View File
@@ -68,6 +68,7 @@ requires.append(get_require_version('trytond'))
tests_require = [
get_require_version('proteus'),
get_require_version('trytond_account_invoice_stock'),
get_require_version('trytond_product_cost_fifo'),
get_require_version('trytond_product_cost_history'),
get_require_version('trytond_account_stock_continental'),
+1 -1
View File
@@ -16,7 +16,7 @@ from trytond.modules.company.tests import CompanyTestMixin
class ProductCostWarehouseTestCase(CompanyTestMixin, ModuleTestCase):
'Test Product Cost Warehouse module'
module = 'product_cost_warehouse'
extras = ['product_cost_history']
extras = ['account_invoice_stock', 'product_cost_history']
def suite():
+1
View File
@@ -6,6 +6,7 @@ depends:
product
stock
extras_depend:
account_invoice_stock
account_stock_continental
product_cost_fifo
product_cost_history