[FIX] delivery: revert method signature change
36e6728b2cac87c7cd922001be0222688ad52abb fixed an issue where the volume and weight were incorrectly computed for carriers based on rules. But it was done by changing the method api, which seems to break some custom modules using/extending the modified methods. This commit reverts the API change, conveying the needed information through the context for now (the api change will be done in master only). opw-3826165 closes odoo/odoo#159220 X-original-commit: d6e004b23822e98e8d1052b75b66a7d4f6d2c38c Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
@@ -357,23 +357,23 @@ class DeliveryCarrier(models.Model):
|
||||
# 2- saved weight to use on sale order
|
||||
# 3- total order line weight as fallback
|
||||
weight = self.env.context.get('order_weight') or order.shipping_weight or weight
|
||||
return self._get_price_from_picking(total, weight, volume, quantity, wv=wv)
|
||||
return self.with_context(wv=wv)._get_price_from_picking(total, weight, volume, quantity)
|
||||
|
||||
def _get_price_dict(self, total, weight, volume, quantity, wv=0.):
|
||||
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': wv or volume * weight,
|
||||
'wv': self.env.context.get('wv') or volume * weight,
|
||||
'quantity': quantity
|
||||
}
|
||||
|
||||
def _get_price_from_picking(self, total, weight, volume, quantity, wv=0.):
|
||||
def _get_price_from_picking(self, total, weight, volume, quantity):
|
||||
price = 0.0
|
||||
criteria_found = False
|
||||
price_dict = self._get_price_dict(total, weight, volume, quantity, wv=wv)
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user