mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-23 02:32:04 +02:00
Initial commit: Core packages
This commit is contained in:
commit
12c29a983b
9512 changed files with 8379910 additions and 0 deletions
16
odoo-bringout-oca-ocb-mail/mail/models/bus_presence.py
Normal file
16
odoo-bringout-oca-ocb-mail/mail/models/bus_presence.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class BusPresence(models.Model):
|
||||
_inherit = ['bus.presence']
|
||||
|
||||
guest_id = fields.Many2one('mail.guest', 'Guest', ondelete='cascade')
|
||||
|
||||
def init(self):
|
||||
self.env.cr.execute("CREATE UNIQUE INDEX IF NOT EXISTS bus_presence_guest_unique ON %s (guest_id) WHERE guest_id IS NOT NULL" % self._table)
|
||||
|
||||
_sql_constraints = [
|
||||
("partner_or_guest_exists", "CHECK((user_id IS NOT NULL AND guest_id IS NULL) OR (user_id IS NULL AND guest_id IS NOT NULL))", "A bus presence must have a user or a guest."),
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue