[CLN] sale_loyalty_delivery: cleanup
Unless necessary, super should be called first, delegeting ensure_one() and base logic to the base method. closes odoo/odoo#129572 Related: odoo/upgrade#4987 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
@@ -11,18 +11,19 @@ class SaleOrder(models.Model):
|
||||
# delivery overrides
|
||||
|
||||
def _compute_amount_total_without_delivery(self):
|
||||
self.ensure_one()
|
||||
lines = self.order_line.filtered(lambda l: l.coupon_id and l.coupon_id.program_type in ['ewallet', 'gift_card'])
|
||||
return super()._compute_amount_total_without_delivery() - sum(lines.mapped('price_unit'))
|
||||
res = super()._compute_amount_total_without_delivery()
|
||||
return res - sum(
|
||||
self.order_line.filtered(
|
||||
lambda l: l.coupon_id and l.coupon_id.program_type in ['ewallet', 'gift_card']
|
||||
).mapped('price_unit')
|
||||
)
|
||||
|
||||
# sale_loyalty overrides
|
||||
|
||||
def _get_no_effect_on_threshold_lines(self):
|
||||
self.ensure_one()
|
||||
lines = self.order_line.filtered(lambda line:\
|
||||
line.is_delivery or\
|
||||
line.reward_id.reward_type == 'shipping')
|
||||
return lines + super()._get_no_effect_on_threshold_lines()
|
||||
res = super()._get_no_effect_on_threshold_lines()
|
||||
return res + self.order_line.filtered(
|
||||
lambda line: line.is_delivery or line.reward_id.reward_type == 'shipping')
|
||||
|
||||
def _get_reward_values_free_shipping(self, reward, coupon, **kwargs):
|
||||
delivery_line = self.order_line.filtered(lambda l: l.is_delivery)
|
||||
|
||||
Reference in New Issue
Block a user