implement Uber delivery fee integration with automated checkout validation and container configuration updates
This commit is contained in:
parent
04ca9cda6a
commit
d349eaf642
@ -23,8 +23,8 @@
|
|||||||
|
|
||||||
<!-- Custom Checkout Page Logic -->
|
<!-- Custom Checkout Page Logic -->
|
||||||
<template id="chennora_checkout_custom" inherit_id="website_sale.checkout" name="Chennora Checkout Custom" priority="99">
|
<template id="chennora_checkout_custom" inherit_id="website_sale.checkout" name="Chennora Checkout Custom" priority="99">
|
||||||
<!-- Add error banner before the navigation buttons -->
|
<!-- Add error banner after the Address header -->
|
||||||
<xpath expr="//t[@t-call='website_sale.navigation_buttons']" position="before">
|
<xpath expr="//h3" position="after">
|
||||||
<div id="uber_error" class="alert alert-danger d-none my-3" role="alert"></div>
|
<div id="uber_error" class="alert alert-danger d-none my-3" role="alert"></div>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
|
|||||||
@ -41,6 +41,15 @@ class SaleOrder(models.Model):
|
|||||||
'product_uom_qty': 1,
|
'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
|
# Recalculate taxes and totals
|
||||||
self._amount_all()
|
self._amount_all()
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user