[IMP] delivery: Hook allowing to retrieve dict to be used in _get_price_from_picking() function.

Hook to be overridden when we need to add some field to product and use it in variable factor from price rules.

closes odoo/odoo#74561

X-original-commit: 6ec768d084da6bd7344c45750a2a5037ec366143
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
This commit is contained in:
Víctor Martínez
2021-08-02 12:09:43 +00:00
parent 8610a4bf38
commit 045ed49d15
+12 -1
View File
@@ -93,10 +93,21 @@ class ProviderGrid(models.Model):
return self._get_price_from_picking(total, weight, volume, quantity)
def _get_price_dict(self, total, weight, volume, quantity):
'''Hook allowing to retrieve dict to be used in _get_price_from_picking() function.
Hook to be overridden when we need to add some field to product and use it in variable factor from price rules. '''
return {
'price': total,
'volume': volume,
'weight': weight,
'wv': volume * weight,
'quantity': quantity
}
def _get_price_from_picking(self, total, weight, volume, quantity):
price = 0.0
criteria_found = False
price_dict = {'price': total, 'volume': volume, 'weight': weight, 'wv': volume * weight, 'quantity': quantity}
price_dict = self._get_price_dict(total, weight, volume, quantity)
if self.free_over and total >= self.amount:
return 0
for line in self.price_rule_ids: