From 984e71359ab020727e7b04d7e720d9a1bf0ffcbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Miguel=20Pardo=20Salar?= Date: Mon, 4 Jul 2022 13:07:41 +0200 Subject: [PATCH] Added cost price to lots by locations. --- __init__.py | 1 + stock.py | 7 +++++++ 2 files changed, 8 insertions(+) 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')