[IMP] website_sale_*: simplify _cart_update overrides definition
Part-of: odoo/odoo#82374
This commit is contained in:
@@ -85,8 +85,8 @@ class SaleOrder(models.Model):
|
||||
request.session.pop('error_promo_code')
|
||||
return error
|
||||
|
||||
def _cart_update(self, product_id=None, line_id=None, add_qty=0, set_qty=0, **kwargs):
|
||||
res = super(SaleOrder, self)._cart_update(product_id=product_id, line_id=line_id, add_qty=add_qty, set_qty=set_qty, **kwargs)
|
||||
def _cart_update(self, *args, **kwargs):
|
||||
res = super()._cart_update(*args, **kwargs)
|
||||
self.recompute_coupon_lines()
|
||||
return res
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ class SaleOrder(models.Model):
|
||||
# searching on website_published will also search for available website (_search method on computed field)
|
||||
return self.env['delivery.carrier'].sudo().search([('website_published', '=', True)]).available_carriers(address)
|
||||
|
||||
def _cart_update(self, product_id=None, line_id=None, add_qty=0, set_qty=0, **kwargs):
|
||||
def _cart_update(self, *args, **kwargs):
|
||||
""" Override to update carrier quotation if quantity changed """
|
||||
|
||||
self._remove_delivery_line()
|
||||
@@ -88,6 +88,4 @@ class SaleOrder(models.Model):
|
||||
# then update your cart (the cart becomes uneditable)
|
||||
self.write({'carrier_id': False})
|
||||
|
||||
values = super(SaleOrder, self)._cart_update(product_id, line_id, add_qty, set_qty, **kwargs)
|
||||
|
||||
return values
|
||||
return super(SaleOrder, self)._cart_update(*args, **kwargs)
|
||||
|
||||
@@ -18,8 +18,8 @@ class SaleOrder(models.Model):
|
||||
gift_card_payment_lines = order.website_order_line.filtered('gift_card_id')
|
||||
order.cart_quantity -= int(sum(gift_card_payment_lines.mapped('product_uom_qty')))
|
||||
|
||||
def _cart_update(self, product_id=None, line_id=None, add_qty=0, set_qty=0, **kwargs):
|
||||
res = super()._cart_update(product_id=product_id, line_id=line_id, add_qty=add_qty, set_qty=set_qty, **kwargs)
|
||||
def _cart_update(self, *args, **kwargs):
|
||||
res = super()._cart_update(*args, **kwargs)
|
||||
self._recompute_gift_card_lines()
|
||||
return res
|
||||
|
||||
|
||||
Reference in New Issue
Block a user