Add restaurant table reservation model with CRUD, validation, state management, WhatsApp integration, and UI views.

This commit is contained in:
Alaguraj0361 2026-02-05 20:13:40 +05:30
parent 8fa76896d8
commit 6c78c14c2a
3 changed files with 11 additions and 1 deletions

View File

@ -29,6 +29,16 @@ class RestaurantReservation(models.Model):
rec.whatsapp_url = f"https://wa.me/{rec.phone}?text={msg.replace(' ', '%20')}"
else:
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([
('draft', 'Draft'),

View File

@ -34,7 +34,7 @@
<sheet>
<div class="oe_button_box" name="button_box">
<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 class="oe_title">
<h1>