This commit is contained in:
2026-02-08 22:26:24 +01:00
parent bc5aa57319
commit 0c83fcf35e
2 changed files with 14 additions and 14 deletions

View File

@@ -91,7 +91,7 @@ class MtmStrategy(ModelSQL, ModelView):
def default_active(cls):
return True
def get_mtm(self,qty):
def get_mtm(self,line,qty):
pool = Pool()
Currency = pool.get('currency.currency')
total = Decimal(0)
@@ -106,14 +106,14 @@ class MtmStrategy(ModelSQL, ModelView):
value = Decimal(
comp.price_index.get_price(
dt,
self.purchase_line.unit,
line.unit,
self.currency,
last=scenario.use_last_price
)
)
elif comp.price_source_type == 'matrix' and comp.price_matrix:
value = self._get_matrix_price(comp, dt)
value = self._get_matrix_price(comp, line, dt)
if comp.ratio:
value *= Decimal(comp.ratio)
@@ -122,18 +122,18 @@ class MtmStrategy(ModelSQL, ModelView):
return total
def _get_matrix_price(self, comp, dt):
def _get_matrix_price(self, comp, line, dt):
MatrixLine = Pool().get('price.matrix.line')
domain = [
('matrix', '=', comp.price_matrix.id),
]
# if self.purchase_line:
# domain += [
# ('origin', '=', self.purchase_line.from_location),
# ('destination', '=', self.purchase_line.to_location),
# ]
if line:
domain += [
('origin', '=', line.purchase.from_location),
('destination', '=', line.purchase.to_location),
]
lines = MatrixLine.search(domain)
if lines: