diff --git a/__init__.py b/__init__.py index ae51759..7e022e5 100644 --- a/__init__.py +++ b/__init__.py @@ -7,4 +7,5 @@ from . import stock def register(): Pool.register( stock.Lot, + stock.LotsByLocations, module='stock_lot_cost_price', type_='model') diff --git a/stock.py b/stock.py index bccb4c2..3ea97de 100644 --- a/stock.py +++ b/stock.py @@ -26,3 +26,10 @@ class Lot(metaclass=PoolMeta): ], order=[('effective_date', 'DESC')]) if moves: return moves[0].origin.unit_price + + +class LotsByLocations(metaclass=PoolMeta): + __name__ = 'stock.lots_by_locations' + + cost_price = fields.Function(fields.Numeric( + 'Cost price', digits=price_digits), 'get_lot')