implement Uber delivery fee integration with automated checkout validation and container configuration updates

This commit is contained in:
Alaguraj0361 2026-04-06 21:00:28 +05:30
parent 04ca9cda6a
commit d349eaf642
2 changed files with 11 additions and 2 deletions

View File

@ -23,8 +23,8 @@
<!-- Custom Checkout Page Logic -->
<template id="chennora_checkout_custom" inherit_id="website_sale.checkout" name="Chennora Checkout Custom" priority="99">
<!-- Add error banner before the navigation buttons -->
<xpath expr="//t[@t-call='website_sale.navigation_buttons']" position="before">
<!-- Add error banner after the Address header -->
<xpath expr="//h3" position="after">
<div id="uber_error" class="alert alert-danger d-none my-3" role="alert"></div>
</xpath>

View File

@ -41,6 +41,15 @@ class SaleOrder(models.Model):
'product_uom_qty': 1,
})]})
# Satisfy Odoo's shipping requirement by setting a carrier if none is set
if not self.carrier_id:
Carrier = self.env['delivery.carrier'].sudo()
# Try to find an 'Uber' carrier first, then fall back to any active one
carrier = Carrier.search([('name', 'ilike', 'uber')], limit=1) or Carrier.search([], limit=1)
if carrier:
_logger.info("Uber: Linking order to carrier %s", carrier.name)
self.write({'carrier_id': carrier.id})
# Recalculate taxes and totals
self._amount_all()
else: