diff --git a/addons/dine360_uber/models/sale_order.py b/addons/dine360_uber/models/sale_order.py index 362d09c..322e21f 100644 --- a/addons/dine360_uber/models/sale_order.py +++ b/addons/dine360_uber/models/sale_order.py @@ -68,6 +68,10 @@ class SaleOrder(models.Model): # Lock the price on the carrier record itself temporarily (SUDO) to satisfy Odoo's check_carrier carrier.sudo().write({'fixed_price': amount}) + # Remove any existing delivery lines first to prevent accumulation + # We do this manually because our protection in online_orders blocks the automatic removal + self.order_line.filtered(lambda l: l.is_delivery).sudo().unlink() + # Apply to order self.sudo().set_delivery_line(carrier, amount) self.sudo().write({'carrier_id': carrier.id})