Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged

i have alterate de appointment.type and calendar.event pyhton code to have for every  slot_ids in appointment.type an affected resource 

import logging

from odoo import models, fields, api, exceptions, _

from odoo.exceptions import ValidationError


_logger = logging.getLogger(__name__)


class AppointmentSlot(models.Model):

    _inherit = "appointment.slot"


    resource_id = fields.Many2one(

        "resource.resource",

        string="Ressource assignée",

        domain="[('id', 'in', resource_ids.ids)]",

        help="Sélectionnez la ressource spécifique pour ce créneau."

    )


class CalendarEvent(models.Model):

    _inherit = "calendar.event"


    resource_id = fields.Many2one("resource.resource", string="Ressource assignée")


    @api.onchange('start')

    def _onchange_start(self):

        """Met à jour la ressource en fonction du créneau sélectionné"""

        if self.start:

            slot = self.env['appointment.slot'].search([

                ('start_datetime', '<=', self.start),

                ('end_datetime', '>=', self.start)

            ], limit=1)

            self.resource_id = slot.resource_id if slot else False


Now i want to alterate the website view how should i proceed 


Thanks you 


Avatar
Opusti



Thank you for your mail.

 

I am out of the office and back on 04.03.2025

 

Mails will be read and answered with delay.

 

Best Regards ... Thomas Klein

 

Related Posts Odgovori Prikazi Aktivnost
1
feb. 25
1495
5
avg. 24
47023
0
maj 24
1667
2
apr. 24
2767
3
jun. 23
6174