from odoo import models, fields, api,_
from odoo.exceptions import UserError, ValidationError,Warning
from psycopg2 import sql, DatabaseError           
                    
    

class booking_questionnaire(models.Model):
    _name = 'booking.questionnaire'
    _description = 'questionnaire pour inscription'

    name=fields.Char(string='Name')
    description=fields.Text(string='Description')
    question_ids = fields.One2many(
        'booking.question',
        'questionnaire_id',
        string='Questions'
        
    )

class booking_question(models.Model):
    _name = 'booking.question'
    _description = 'question'
    
    question=fields.Text(string='question')
    sequence = fields.Integer(string="sequence", default=10)
    questionnaire_id = fields.Many2one(
        'booking.questionnaire',
		String='Questionnaire',
        index=True,
        readonly=True,
        track_visibility='onchange',
        ondelete='cascade'
    )
