forked from alaguraj/odoo-testing-addons
implement online order management, Uber delivery integration, and update Docker container configurations
This commit is contained in:
parent
85873ae560
commit
c6738e71d7
@ -59,6 +59,27 @@ class SaleOrderOnline(models.Model):
|
||||
('cancelled', 'Cancelled'),
|
||||
], string='Reservation Status', default='draft', tracking=True)
|
||||
|
||||
def _is_shippable_order(self):
|
||||
"""
|
||||
Treat all online orders as non-shippable for Odoo's standard validation.
|
||||
This enables 'Billing-only' checkout even for delivery orders,
|
||||
as we handle shipping manually via Uber fee lines.
|
||||
"""
|
||||
self.ensure_one()
|
||||
if self.fulfilment_type in ['pickup', 'delivery', 'dine_in', 'walk_in']:
|
||||
return False
|
||||
return super()._is_shippable_order()
|
||||
|
||||
def _check_carrier_quotation(self, force_carrier_id=None, **kwargs):
|
||||
"""Allow proceeding to payment if we already have a carrier (Uber) or don't need one"""
|
||||
self.ensure_one()
|
||||
if self.fulfilment_type in ['pickup', 'delivery', 'dine_in', 'walk_in']:
|
||||
return True
|
||||
# If we have a carrier set by our Uber integration, trust it and skip standard re-validation
|
||||
if self.carrier_id and 'Uber' in (self.carrier_id.name or ''):
|
||||
return True
|
||||
return super()._check_carrier_quotation(force_carrier_id=force_carrier_id, **kwargs)
|
||||
|
||||
def _create_pos_order_for_kds(self, sale_order):
|
||||
"""
|
||||
Override from dine360_kds to also mark the POS order as an online order.
|
||||
|
||||
@ -6,6 +6,14 @@ _logger = logging.getLogger(__name__)
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = 'sale.order'
|
||||
|
||||
def _get_available_carriers(self, **kwargs):
|
||||
"""Force Include the Uber carrier in the available list to bypass Odoo's address/website filters"""
|
||||
carriers = super()._get_available_carriers(**kwargs)
|
||||
if self.carrier_id and 'Uber' in (self.carrier_id.name or ''):
|
||||
if self.carrier_id not in carriers:
|
||||
carriers |= self.carrier_id
|
||||
return carriers
|
||||
|
||||
def _add_uber_delivery_fee(self, amount):
|
||||
"""Add the delivery fee using Odoo's standard delivery system to satisfy checkout validation"""
|
||||
_logger.info("Uber: Syncing delivery fee %s to order %s", amount, self.name)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user