08.02.26
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user