36 lines
1.4 KiB
Python

from odoo import models, fields, api
class UberConfig(models.Model):
_name = 'uber.config'
_description = 'Uber Integration Configuration'
name = fields.Char(string='Config Name', required=True, default='Uber Eats / Direct')
client_id = fields.Char(string='Client ID', required=True)
client_secret = fields.Char(string='Client Secret', required=True)
customer_id = fields.Char(string='Customer ID (Uber Direct)')
environment = fields.Selection([
('sandbox', 'Sandbox / Testing'),
('production', 'Production / Live')
], string='Environment', default='sandbox', required=True)
timeout_minutes = fields.Integer(string='Driver Assignment Alert Timeout (min)', default=15)
delivery_product_id = fields.Many2one('product.product', string='Uber Delivery Fee Product',
help="Service product used to add Uber charges to the bill.")
access_token = fields.Char(string='Current Access Token')
token_expiry = fields.Datetime(string='Token Expiry')
active = fields.Boolean(default=True)
def action_test_connection(self):
# Placeholder for connection logic
return {
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'title': 'Connection Test',
'message': 'Uber API Connection successful (Simulation)',
'sticky': False,
}
}