forked from alaguraj/odoo-testing-addons
Add restaurant table reservation model with CRUD, validation, state management, WhatsApp integration, and UI views.
This commit is contained in:
parent
8fa76896d8
commit
6c78c14c2a
Binary file not shown.
@ -29,6 +29,16 @@ class RestaurantReservation(models.Model):
|
|||||||
rec.whatsapp_url = f"https://wa.me/{rec.phone}?text={msg.replace(' ', '%20')}"
|
rec.whatsapp_url = f"https://wa.me/{rec.phone}?text={msg.replace(' ', '%20')}"
|
||||||
else:
|
else:
|
||||||
rec.whatsapp_url = False
|
rec.whatsapp_url = False
|
||||||
|
|
||||||
|
def action_whatsapp(self):
|
||||||
|
self.ensure_one()
|
||||||
|
if self.whatsapp_url:
|
||||||
|
return {
|
||||||
|
'type': 'ir.actions.act_url',
|
||||||
|
'url': self.whatsapp_url,
|
||||||
|
'target': 'new',
|
||||||
|
}
|
||||||
|
return False
|
||||||
|
|
||||||
state = fields.Selection([
|
state = fields.Selection([
|
||||||
('draft', 'Draft'),
|
('draft', 'Draft'),
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
<sheet>
|
<sheet>
|
||||||
<div class="oe_button_box" name="button_box">
|
<div class="oe_button_box" name="button_box">
|
||||||
<field name="whatsapp_url" invisible="1"/>
|
<field name="whatsapp_url" invisible="1"/>
|
||||||
<button name="whatsapp_url" type="url" class="oe_stat_button" icon="fa-whatsapp" string="WhatsApp" invisible="not whatsapp_url"/>
|
<button name="action_whatsapp" type="object" class="oe_stat_button" icon="fa-whatsapp" string="WhatsApp" invisible="not whatsapp_url"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="oe_title">
|
<div class="oe_title">
|
||||||
<h1>
|
<h1>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user