Skip to Content
Menu
This question has been flagged
1 Reply
2822 Views

Is there anyway to stop double booking in Odoo11 Calendar for same resource at same time.

I had used calendar_resource (compatible for odoo10) but that is not compatible for odoo11 due to few functions like get_working_intervals_of_day (odoo 10 function) are not supported in odoo11 CE.

Guide me please


Avatar
Discard
Best Answer

some functions were changed in odoo 11.

Addons: resource/models/resource.py

Odoo 10: get_working_intervals_of_day

Odoo 11: i think:

@api.multi
def _get_day_work_intervals(self, day_date, start_time=None, end_time=None, compute_leaves=False, resource_id=None):

https://github.com/OCA/crm/blob/10.0/calendar_resource/models/calendar_event.py#L226

datetime_start = datetime.combine(day, time(00, 00, 00))
datetime_end = datetime.combine(day, time(23, 59, 59))

intervals = \
    resource.calendar_id.get_working_intervals_of_day(
    start_dt=datetime_start,
    end_dt=datetime_end,
    resource_id=resource.id,
)

change to

datetime_start = datetime.combine(day, time(00, 00, 00))
datetime_end = datetime.combine(day, time(23, 59, 59))

st = time(00, 00, 00)
et = time(23, 59, 59)

intervals = \
    resource.calendar_id.get_working_intervals_of_day(
    day_date = date,
    start_dt= st,
    end_dt= et,
    resource_id=resource.id,
)

In odoo 10 Working Time is not defaultbut odoo 11 sets default.

https://github.com/odoo/odoo/blob/11.0/addons/resource/models/resource.py#L655-L715

Line 664, 682, 700, 715



Avatar
Discard
Related Posts Replies Views Activity
0
Jan 19
1690
1
Jul 18
2822
0
Feb 24
664
3
Aug 24
1202
0
Dec 23
549