37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/ics_import_holidays/models/import_holidays_settings.py:
--------------------------------------------------------------------------------
1 | from ast import Store
2 | import logging
3 | from multiprocessing.sharedctypes import Value
4 | from odoo import fields, models, api, _
5 | import time
6 | import requests
7 |
8 | _logger = logging.getLogger(__name__)
9 | IMPORT = '__import__'
10 |
11 | class ResCalendarSettings(models.TransientModel):
12 | _inherit = 'res.config.settings'
13 |
14 | ics_url = fields.Char(string='Enter the URL of the ICS file', config_parameter='holiday.url.ics')
15 |
16 | @api.model
17 | def create(self, vals_list):
18 | res = super().create(vals_list)
19 |
20 | if (ics_url := vals_list.get("ics_url")):
21 | ics_xmlid = f"{IMPORT}.ics_{time.strftime('%Y-%m-%d_%H:%M:%S')}_{ics_url.replace('.','_')}"
22 | try:
23 | ref_try = self.env.ref(ics_xmlid)
24 | except ValueError:
25 | external_uid = self.env['ir.model.data'].create({'module': IMPORT,
26 | 'name': ics_xmlid.split('.')[-1],
27 | 'model': 'ir.cron'})
28 |
29 | cron_name = 'Update holidays URL: ' + ics_url
30 | calendar_event_cron_model = self.env['ir.model'].search([('model', '=', 'calendar.event')]).id
31 |
32 | if not self.env['ir.cron'].search([('name', '=', cron_name)]):
33 | self.env['ir.cron'].create([{'name': cron_name,
34 | 'model_id': calendar_event_cron_model, 'user_id': 2, 'interval_number': 1,
35 | 'interval_type': 'months', 'code': 'model._holiday_cron()',
36 | 'numbercall': -1}])
37 |
38 | if not self.env['res.users'].search([('login', '=', "holidays")]):
39 | self.env['res.users'].sudo().create({'name': "Holidays", 'login': "holidays"})
40 | return res
41 |
42 |
--------------------------------------------------------------------------------
/calendar_ics/__manifest__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # OpenERP, Open Source Management Solution, third party addon
5 | # Copyright (C) 2004-2016 Vertel AB ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 |
22 | {
23 | 'name': 'Calendar: ICS',
24 | 'version': '1.0',
25 | 'category': 'Calendar',
26 | 'summary': 'Subscription on calendar.ics-urls',
27 | 'images': ['static/description/banner.png'], # 560x280 px.
28 | 'license': 'AGPL-3',
29 | 'description': """
30 | Adds and updates calendar objects according to an ics-url.
31 | """,
32 | 'author': 'Vertel AB',
33 | 'website': 'https://vertel.se/apps/odoo-calendar/calendar_ics',
34 | 'depends': ['calendar', ],
35 | 'external_dependencies': {
36 | 'python': ['icalendar'],
37 | },
38 | 'data': [
39 | 'views/res_partner_view.xml',
40 | # 'views/calendar_view.xml',
41 | #'security/ir.model.access.csv',
42 | 'data/res_partner_data.xml'
43 | ],
44 | 'application': False,
45 | 'installable': True,
46 | 'demo': ['demo/calendar_ics_demo.xml', ],
47 | }
48 | # vim:expandtab:smartindent:tabstop=4s:softtabstop=4:shiftwidth=4:
49 |
--------------------------------------------------------------------------------
/calendar_resource_booking/__manifest__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Odoo SA, Open Source Management Solution, third party addon
5 | # Copyright (C) 2022- Vertel AB ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 |
22 | {
23 | 'name': 'Calendar Resource Booking',
24 | 'version': '1.0.1',
25 | # Version ledger: 14.0 = Odoo version. 1 = Major. Non regressionable code. 2 = Minor. New features that are regressionable. 3 = Bug fixes
26 | 'summary': 'Adds material resource to book at an appointment',
27 | 'category': 'Calendar',
28 | 'description': """
29 | Adds resource tags to a calendar event
30 | """,
31 | 'author': 'Vertel AB',
32 | 'website': 'https://vertel.se/apps/odoo-calendar/calendar_resource_booking',
33 | 'images': [], # 560x280 px.
34 | 'license': 'AGPL-3',
35 | 'contributor': '',
36 | 'maintainer': 'Vertel AB',
37 | 'repository': 'https://github.com/vertelab/odoo-calendar',
38 | 'depends': ['calendar','resource'],
39 | 'data': [
40 | 'views/calendar_view.xml',
41 | ],
42 | 'demo': [
43 | ],
44 | 'installable': True,
45 | 'application': True,
46 | 'auto_install': False,
47 | }
48 |
--------------------------------------------------------------------------------
/calendar_sync/__manifest__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Odoo SA, Open Source Management Solution, third party addon
5 | # Copyright (C) 2022- Vertel AB ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 |
22 | {
23 | 'name': 'Calendar: Sync',
24 | 'version': '1.0',
25 | # Version ledger: 14.0 = Odoo version. 1 = Major. Non regressionable code. 2 = Minor. New features that are regressionable. 3 = Bug fixes
26 | 'summary': 'Syncs the Odoo calendar with other apps.',
27 | 'category': 'Calendar',
28 | 'description': """
29 | Sets up a REST API that enables Odoo to sync calendar events with other apps.
30 | """,
31 | #'sequence': '1',
32 | 'author': 'Vertel AB',
33 | 'website': 'https://vertel.se/apps/odoo-calendar/calendar_sync',
34 | 'images': ['static/description/banner.png'], # 560x280 px.
35 | 'license': 'AGPL-3',
36 | 'contributor': '',
37 | 'maintainer': 'Vertel AB',
38 | 'repository': 'https://github.com/vertelab/odoo-calendar',
39 | 'depends': ['calendar'],
40 | 'data': [],
41 | 'application': True,
42 | 'installable': True,
43 | }
44 |
45 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
46 |
--------------------------------------------------------------------------------
/website_calendar_product_resource/models/product.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Part of Odoo. See LICENSE file for full copyright and licensing details.
3 |
4 | from odoo import fields, models
5 |
6 |
7 | class ProductTemplate(models.Model):
8 | _inherit = 'product.template'
9 |
10 | def _get_bookings(self):
11 | for rec in self:
12 | event_ids = self.env['calendar.event'].search([('product_id.id', '=', rec.product_variant_id.id)])
13 | if event_ids:
14 | rec.calendar_event_id = event_ids.ids
15 | else:
16 | rec.calendar_event_id = False
17 |
18 | calendar_event_id = fields.Many2many(
19 | 'calendar.event', 'calendar_event_product_rel', readonly=True, compute=_get_bookings)
20 |
21 |
22 | class ProductProduct(models.Model):
23 | _inherit = 'product.product'
24 |
25 | def _get_bookings(self):
26 | for rec in self:
27 | event_ids = self.env['calendar.event'].search([('product_id.id', '=', rec.id)])
28 | if event_ids:
29 | rec.calendar_event_id = event_ids.ids
30 | else:
31 | rec.calendar_event_id = False
32 |
33 | calendar_event_id = fields.Many2many(
34 | 'calendar.event', 'calendar_event_product_rel', readonly=True, compute=_get_bookings)
35 |
36 | def calendar_verify_product_availability(self, partner, date_start, date_end):
37 | """ verify availability of the partner(s) between 2 datetime on their calendar
38 | """
39 | if bool(self.env['calendar.event'].search_count([
40 | ('partner_ids', 'in', partner.ids),
41 | ('product_id', 'in', self.ids),
42 | '|', '&', ('start', '<', fields.Datetime.to_string(date_end)),
43 | ('stop', '>', fields.Datetime.to_string(date_start)),
44 | '&', ('allday', '=', True),
45 | '|', ('start_date', '=', fields.Date.to_string(date_end)),
46 | ('start_date', '=', fields.Date.to_string(date_start))])):
47 | return False
48 | return True
49 |
--------------------------------------------------------------------------------
/calendar_attendee_planning/__manifest__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Odoo SA, Open Source Management Solution, third party addon
5 | # Copyright (C) 2022- Vertel AB ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 |
22 | {
23 | 'name': 'Calendar: Attendee Planning',
24 | 'version': '1.0.1',
25 | # Version ledger: 14.0 = Odoo version. 1 = Major. Non regressionable code. 2 = Minor. New features that are regressionable. 3 = Bug fixes
26 | 'summary': 'Adds attendee views to the calendar',
27 | 'category': 'Calendar',
28 | 'description': """
29 | Adds attendee views to the calendar
30 | """,
31 | 'author': 'Vertel AB',
32 | 'website': 'https://vertel.se/apps/odoo-calendar/calendar_attendee_planning',
33 | 'images': ['static/description/banner.png'], # 560x280 px.
34 | 'license': 'AGPL-3',
35 | 'contributor': '',
36 | 'maintainer': 'Vertel AB',
37 | 'repository': 'https://github.com/vertelab/odoo-calendar',
38 | 'depends': ['calendar','web_timeline', 'hr', 'hr_holidays'],
39 | 'data': [
40 | 'views/calendar_view.xml',
41 | ],
42 | 'demo': [
43 | ],
44 | 'installable': True,
45 | 'application': True,
46 | 'auto_install': False,
47 | }
48 |
--------------------------------------------------------------------------------
/calander_full_form/__manifest__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Odoo, Open Source Management Solution, third party addon
5 | # Copyright (C) 2021- Vertel AB ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 |
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #
21 | ##############################################################################
22 |
23 | {
24 | 'name': 'Calendar: Calender Full Form',
25 | 'version': '1.0',
26 | # Version ledger: 14.0 = Odoo version. 1 = Major. Non regressionable code. 2 = Minor. New features that are regressionable. 3 = Bug fixes
27 | 'summary': 'To be able to open calendar form view instead of a popup.',
28 | 'category': 'Calendar',
29 | 'description': """
30 | To be able to open calendar form view instead of a popup
31 | """,
32 | 'author': 'Vertel AB',
33 | 'website': 'https://vertel.se/apps/odoo-calendar/calender_full_form',
34 | 'images': ['static/description/banner.png'], # 560x280 px.
35 | 'license': 'AGPL-3',
36 | 'maintainer': 'Vertel AB',
37 | 'repository': 'https://github.com/vertelab/odoo-calendar',
38 | #'sequence': '1',
39 | 'depends': ['calendar'],
40 | 'data': [
41 | 'views/calendar_view.xml'
42 | ],
43 | 'application': True,
44 | 'installable': True,
45 | }
46 | # vim:expandtab:smartindent:tabstop=4s:softtabstop=4:shiftwidth=4:
47 |
--------------------------------------------------------------------------------
/website_calendar_ce/controllers/calendar.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # This program is free software; you can redistribute it and/or modify
3 | # it under the terms of the GNU General Public License as published by
4 | # the Free Software Foundation; either version 2 of the License, or
5 | # (at your option) any later version.
6 | #
7 | # This program is distributed in the hope that it will be useful,
8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 | # GNU General Public License for more details.
11 | #
12 | # You should have received a copy of the GNU General Public License
13 | # along with this program; if not, write to the Free Software
14 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
15 | # MA 02110-1301, USA.
16 | #
17 |
18 |
19 | from werkzeug.utils import redirect
20 |
21 | from odoo import http, SUPERUSER_ID
22 | from odoo import registry as registry_get
23 | from odoo.api import Environment
24 | from odoo.http import request
25 |
26 | from odoo.addons.calendar.controllers.main import CalendarController
27 |
28 |
29 | class WebsiteCalendarController(CalendarController):
30 |
31 | def view(self, db, token, action, id, view='calendar', **kwargs):
32 | """ Redirect the user to the website page of the calendar.event, only if it is an booking """
33 | super(WebsiteCalendarController, self).view(db, token, action, id, view='calendar', **kwargs)
34 | registry = registry_get(db)
35 | with registry.cursor() as cr:
36 | env = Environment(cr, SUPERUSER_ID, {})
37 | attendee = env['calendar.attendee'].search([('access_token', '=', token), ('event_id', '=', int(id))])
38 | if attendee:
39 | request.session['timezone'] = attendee.partner_id.tz
40 | if not attendee.event_id.access_token:
41 | attendee.event_id._generate_access_token()
42 | return redirect('/website/calendar/view/' + str(attendee.event_id.access_token))
43 | else:
44 | return request.render("website_calendar_ce.booking_invalid", {})
45 |
--------------------------------------------------------------------------------
/calendar_public_holiday_nager/__manifest__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Odoo SA, Open Source Management Solution, third party addon
5 | # Copyright (C) 2022- Vertel AB ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 |
22 | {
23 | 'name': 'Calendar: Public Holiday Nager Date',
24 | 'version': '1.0',
25 | # Version ledger: 14.0 = Odoo version. 1 = Major. Non regressionable code. 2 = Minor. New features that are regressionable. 3 = Bug fixes
26 | 'summary': 'Get Public Holidays from Nager.Date .',
27 | 'category': 'Calendar',
28 | 'description': """
29 | Sets up a REST API that enables Odoo to sync calendar events from Nager.Date
30 |
31 | https://date.nager.at/api/v3/PublicHolidays/{ar}/{country code}
32 | """,
33 | #'sequence': '1',
34 | 'author': 'Vertel AB',
35 | 'website': 'https://vertel.se/apps/odoo-calendar/calendar_public_holoday_nager',
36 | 'images': ['static/description/banner.png'], # 560x280 px.
37 | 'license': 'AGPL-3',
38 | 'contributor': '',
39 | 'maintainer': 'Vertel AB',
40 | 'depends': ['calendar_public_holiday'],
41 | 'data': ['views/calendar_public_holiday_view.xml'],
42 | 'application': False,
43 | 'installable': True,
44 | }
45 |
46 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
47 |
--------------------------------------------------------------------------------
/website_sale_rental_booking/__manifest__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Odoo SA, Open Source Management Solution, third party addon
5 | # Copyright (C) 2022- Vertel AB ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 |
22 | {
23 | 'name': 'Calendar: Webiste Sale Rental Booking',
24 | 'version': '1.0',
25 | # Version ledger: 14.0 = Odoo version. 1 = Major. Non regressionable code. 2 = Minor. New features that are regressionable. 3 = Bug fixes
26 | 'summary': 'Webiste Sale Rental Booking',
27 | 'category': 'Calendar',
28 | 'description': """
29 | Allow clients to book rentals
30 | -------------------------------------------------------
31 | """,
32 | #'sequence': '1',
33 | 'sequence': '131',
34 | 'author': 'Vertel AB',
35 | 'website': 'https://vertel.se/apps/odoo-calendar/one_page_website_calendar',
36 | 'images': ['static/description/banner.png'], # 560x280 px.
37 | 'license': 'AGPL-3',
38 | 'contributor': '',
39 | 'maintainer': 'Vertel AB',
40 | 'repository': 'https://github.com/vertelab/odoo-calendar',
41 | 'depends': ['base', 'calendar', 'sttl_sale_rental'],
42 | 'data': [
43 | 'views/product_template_views.xml'
44 |
45 | ],
46 | 'installable': True,
47 | 'application': True,
48 | 'auto_install': False,
49 | }
50 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
51 |
--------------------------------------------------------------------------------
/website_calendar_event/__manifest__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Odoo SA, Open Source Management Solution, third party addon
5 | # Copyright (C) 2022- Vertel AB ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 |
22 | {
23 | 'name': 'Calendar: Website Calendar Event',
24 | 'version': '1.0',
25 | # Version ledger: 14.0 = Odoo version. 1 = Major. Non regressionable code. 2 = Minor. New features that are regressionable. 3 = Bug fixes
26 | 'summary': 'Schedule bookings with clients',
27 | 'category': 'Calendar',
28 | 'description': """
29 |
30 | TODO:
31 | """,
32 | #'sequence': '1',
33 | 'sequence': '131',
34 | 'author': 'Vertel AB',
35 | 'website': 'https://vertel.se/apps/odoo-calendar/website_calendar_event',
36 | 'images': ['static/description/banner.png'], # 560x280 px.
37 | 'license': 'AGPL-3',
38 | 'contributor': '',
39 | 'maintainer': 'Vertel AB',
40 | 'repository': 'https://github.com/vertelab/odoo-calendar',
41 | 'depends': ['website_calendar_ce', 'project'],
42 |
43 | 'data': [
44 | 'views/calendar_booking_views.xml',
45 | 'views/project.xml',
46 | 'views/project_portal_templates.xml',
47 | ],
48 | 'demo': [
49 | ],
50 | 'installable': True,
51 | 'application': True,
52 | 'auto_install': False,
53 | }
54 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
55 |
--------------------------------------------------------------------------------
/website_calendar_slot_range/__manifest__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Odoo SA, Open Source Management Solution, third party addon
5 | # Copyright (C) 2022- Vertel AB ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 |
22 | {
23 | 'name': 'Calendar: Website Calendar Slot Range',
24 | 'version': '1.0',
25 | 'summary': 'Booking a range of time slot',
26 | 'category': 'Calendar',
27 | 'description': """
28 | Allow clients to Booking a range of time slot
29 | -------------------------------------------------------
30 | """,
31 | 'sequence': '131',
32 | 'author': 'Vertel AB',
33 | 'website': 'https://vertel.se/apps/odoo-calendar/website_calendar_slot_range',
34 | 'images': ['static/description/banner.png'], # 560x280 px.
35 | 'license': 'AGPL-3',
36 | 'contributor': '',
37 | 'maintainer': 'Vertel AB',
38 | 'repository': 'https://github.com/vertelab/odoo-calendar',
39 | 'depends': ['website_calendar_ce'],
40 | 'data': [
41 | 'views/website_calendar_templates.xml'
42 |
43 | ],
44 | 'assets': {
45 | 'web.assets_frontend': [
46 | 'website_calendar_slot_range/static/src/js/website_calendar_ce.js'
47 | ],
48 | },
49 | 'installable': True,
50 | 'application': True,
51 | 'auto_install': False,
52 | }
53 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
54 |
--------------------------------------------------------------------------------
/one_page_website_calendar/static/src/js/booking_time_slot.js:
--------------------------------------------------------------------------------
1 | odoo.define('one_page_website_calendar.one_page_booking_slot', function (require) {
2 | 'use strict';
3 |
4 | var core = require('web.core');
5 | var QWeb = core.qweb;
6 | var publicWidget = require('web.public.widget');
7 |
8 | var ajax = require('web.ajax');
9 | ajax.loadXML('/one_page_website_calendar/static/src/xml/booking.xml', QWeb);
10 |
11 |
12 | publicWidget.registry.OnePageWebsiteCalendarWidget = publicWidget.Widget.extend({
13 | selector: '#one_page_start_booking',
14 | events: {
15 | 'click #view_bookings_calendar': '_onCheckAvailability',
16 | },
17 |
18 | init: function (parent, options) {
19 | this._super.apply(this, arguments);
20 | },
21 |
22 | start: function () {
23 | var defs = [];
24 | defs.push(this._super.apply(this, arguments));
25 | return Promise.all(defs);
26 |
27 | },
28 |
29 | _onCheckAvailability: function (e) {
30 | // params to query the booking slots for the booking type and employee
31 | var employee_id = $(".o_website_appointment_form select[name='employee_id']").val()
32 | var booking_type_id = $(".o_website_appointment_form select[name='booking_type_id']").val()
33 | this._getBookingSlots(booking_type_id, employee_id)
34 |
35 | // toggle to next tab
36 | $('#start_booking').hide()
37 | $('#time_slot').show()
38 |
39 | },
40 |
41 | _getBookingSlots: function (booking_type_id, employee_id) {
42 | var self = this
43 | this._rpc({
44 | route: "/website/calendar/booking/slots",
45 | params: {
46 | booking_type: booking_type_id,
47 | employee_id: employee_id,
48 | },
49 | }).then(res => {
50 | const data = Object.assign({}, res)
51 | $('#one_page_view_booking_availability').replaceWith(QWeb.render('BookingCalendarAvailability', data));
52 | $('#booking_header').html('Booking Time')
53 | })
54 | },
55 | })
56 |
57 | return publicWidget.registry.OnePageWebsiteCalendarWidget
58 | })
59 |
--------------------------------------------------------------------------------
/website_booking_checkout/models/product.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Part of Odoo. See LICENSE file for full copyright and licensing details.
3 |
4 | from odoo import fields, models, api
5 |
6 |
7 | class ProductTemplate(models.Model):
8 | _inherit = 'product.template'
9 |
10 | is_booking = fields.Boolean(string="Can be Booked")
11 |
12 | allow_booking_range = fields.Boolean(string="Allow Booking Range")
13 |
14 | def _get_bookings(self):
15 | for rec in self:
16 | event_ids = self.env['calendar.event'].search([('product_id.id', '=', rec.product_variant_id.id)])
17 | if event_ids:
18 | rec.calendar_event_id = event_ids.ids
19 | else:
20 | rec.calendar_event_id = False
21 |
22 | calendar_event_id = fields.Many2many(
23 | 'calendar.event', 'calendar_event_product_rel', readonly=True, compute=_get_bookings)
24 |
25 | booking_type_id = fields.Many2one('calendar.booking.type', string="Booking Type")
26 |
27 |
28 | class ProductProduct(models.Model):
29 | _inherit = 'product.product'
30 |
31 | def _get_bookings(self):
32 | for rec in self:
33 | event_ids = self.env['calendar.event'].sudo().search([('product_id.id', '=', rec.id)])
34 | if event_ids:
35 | rec.calendar_event_id = event_ids.ids
36 | else:
37 | rec.calendar_event_id = False
38 |
39 | calendar_event_id = fields.Many2many(
40 | 'calendar.event', 'calendar_event_product_rel', readonly=True, compute=_get_bookings)
41 |
42 | def calendar_verify_product_availability(self, partner, date_start, date_end):
43 | """ verify availability of the partner(s) between 2 datetime on their calendar
44 | """
45 | if bool(self.env['calendar.event'].search_count([
46 | ('partner_ids', 'in', partner.ids),
47 | ('product_id', 'in', self.ids),
48 | '|', '&', ('start', '<', fields.Datetime.to_string(date_end)),
49 | ('stop', '>', fields.Datetime.to_string(date_start)),
50 | '&', ('allday', '=', True),
51 | '|', ('start_date', '=', fields.Date.to_string(date_end)),
52 | ('start_date', '=', fields.Date.to_string(date_start))])):
53 | return False
54 | return True
55 |
56 |
--------------------------------------------------------------------------------
/calendar_skills_allergies_glue/views/calendar_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 |
16 | contract_add_skills_allergies_view
17 | contract.contract
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | add_contract_skill_and_allergies
29 | calendar.attendee
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/website_calendar_waitlist/__manifest__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Odoo SA, Open Source Management Solution, third party addon
5 | # Copyright (C) 2022- Vertel AB ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 |
22 | {
23 | 'name': 'Calendar: Website Calendar Waitlist',
24 | 'version': '1.0',
25 | # Version ledger: 14.0 = Odoo version. 1 = Major. Non regressionable code. 2 = Minor. New features that are regressionable. 3 = Bug fixes
26 | 'summary': 'Schedule bookings with clients',
27 | 'category': 'Calendar',
28 | 'description': """
29 | TODO:
30 | """,
31 | #'sequence': '1',
32 | 'sequence': '131',
33 | 'author': 'Vertel AB',
34 | 'website': 'https://vertel.se/apps/odoo-calendar/website_calendar_waitlist',
35 | 'images': ['static/description/banner.png'], # 560x280 px.
36 | 'license': 'AGPL-3',
37 | 'contributor': '',
38 | 'maintainer': 'Vertel AB',
39 | 'repository': 'https://github.com/vertelab/odoo-calendar',
40 | 'depends': ['website_calendar_ce', 'website_calendar_event', 'hr', 'base'],
41 | 'data': [
42 | 'views/calendar_booking_views.xml',
43 | 'views/website_waitlist_templates.xml',
44 | 'views/project_portal_templates.xml',
45 | 'security/ir.model.access.csv',
46 | ],
47 | 'demo': [
48 | ],
49 | 'installable': True,
50 | 'application': True,
51 | 'auto_install': False,
52 | }
53 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
54 |
--------------------------------------------------------------------------------
/one_page_website_calendar/__manifest__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Odoo SA, Open Source Management Solution, third party addon
5 | # Copyright (C) 2022- Vertel AB ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 |
22 | {
23 | 'name': 'Calendar: One Page Website Calendar',
24 | 'version': '1.0',
25 | # Version ledger: 14.0 = Odoo version. 1 = Major. Non regressionable code. 2 = Minor. New features that are regressionable. 3 = Bug fixes
26 | 'summary': 'Schedule bookings with clients',
27 | 'category': 'Calendar',
28 | 'description': """
29 | Allow clients to Schedule Bookings through your Website
30 | -------------------------------------------------------
31 | """,
32 | #'sequence': '1',
33 | 'sequence': '131',
34 | 'author': 'Vertel AB',
35 | 'website': 'https://vertel.se/apps/odoo-calendar/one_page_website_calendar',
36 | 'images': ['static/description/banner.png'], # 560x280 px.
37 | 'license': 'AGPL-3',
38 | 'contributor': '',
39 | 'maintainer': 'Vertel AB',
40 | 'repository': 'https://github.com/vertelab/odoo-calendar',
41 | 'depends': ['calendar_sms', 'hr', 'website', 'website_calendar_ce'],
42 | 'data': [
43 | 'views/assets.xml',
44 | 'views/snippet.xml',
45 | ],
46 | 'qweb': [
47 | 'static/src/xml/booking.xml',
48 | ],
49 | 'installable': True,
50 | 'application': True,
51 | 'auto_install': False,
52 | }
53 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
54 |
--------------------------------------------------------------------------------
/website_calendar_product_resource/__manifest__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Odoo SA, Open Source Management Solution, third party addon
5 | # Copyright (C) 2022- Vertel AB ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 |
22 | {
23 | 'name': 'Calendar: Product Resource',
24 | 'version': '1.0',
25 | 'summary': 'Calendar Product Resource',
26 | 'category': 'Calendar',
27 | 'description': """
28 | Allow clients to Schedule Bookings through your Website
29 | -------------------------------------------------------
30 | """,
31 | 'sequence': '131',
32 | 'author': 'Vertel AB',
33 | 'website': 'https://vertel.se/apps/odoo-calendar/website_calendar_product_resource',
34 | 'images': ['static/description/banner.png'], # 560x280 px.
35 | 'license': 'AGPL-3',
36 | 'maintainer': 'Vertel AB',
37 | 'repository': 'https://github.com/vertelab/odoo-calendar',
38 | 'depends': ['product', 'resource', 'website_calendar_ce'],
39 | 'data': [
40 | "data/website_calendar_data.xml",
41 | "views/product_view.xml",
42 | # "views/resource_view.xml",
43 | "views/calendar_booking_view.xml",
44 | "views/website_calendar_templates.xml",
45 | ],
46 | 'assets': {
47 | 'web.assets_frontend': [
48 | 'website_calendar_product_resource/static/src/js/website_calendar_ce.js'
49 | ],
50 | },
51 | 'installable': True,
52 | 'application': True,
53 | 'auto_install': False,
54 | }
55 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
56 |
--------------------------------------------------------------------------------
/calendar_skills_allergies_glue/__manifest__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Odoo SA, Open Source Management Solution, third party addon
5 | # Copyright (C) 2023- Vertel AB ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 |
22 | {
23 | 'name': 'Calendar: Skills and allergies glue module',
24 | 'version': '1.0',
25 | # Version ledger: 14.0 = Odoo version. 1 = Major. Non regressionable code. 2 = Minor. New features that are regressionable. 3 = Bug fixes
26 | 'summary': 'Compare contract and partner skills & allergies.',
27 | # Categories can be used to filter modules in modules listing
28 | # Check https://github.com/odoo/odoo/blob/14.0/odoo/addons/base/data/ir_module_category_data.xml
29 | # for the full list
30 | 'category': 'Calendar',
31 | 'description': """
32 | Adds a check if sklls and allergies match for a calendar.attendee.
33 | """,
34 | #'sequence': '1',
35 | 'author': 'Vertel AB',
36 | 'website': 'https://vertel.se/apps/odoo-calendar/calendar_skills_allergies_glue',
37 | 'images': ['static/description/banner.png'], # 560x280 px.
38 | 'license': 'AGPL-3',
39 | 'contributor': '',
40 | 'maintainer': 'Vertel AB',
41 | 'repository': 'https://github.com/vertelab/odoo-calendar',
42 | # Any module necessary for this one to work correctly
43 |
44 | 'depends': ['calendar_attendee_planning', 'contract_attendee', 'contract_allergic', 'contract_cleaner', 'contract'],
45 | 'data': [
46 | 'views/calendar_view.xml',
47 | ],
48 | 'auto_install': True,
49 | }
50 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
51 |
--------------------------------------------------------------------------------
/ics_import_holidays/__manifest__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Odoo SA, Open Source Management Solution, third party addon
5 | # Copyright (C) 2022- Vertel AB ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 |
22 | {
23 | 'name': 'Calendar: Import holidays',
24 | 'version': '1.0',
25 | # Version ledger: 14.0 = Odoo version. 1 = Major. Non regressionable code. 2 = Minor. New features that are regressionable. 3 = Bug fixes
26 | 'summary': 'Import holidays will update monthly basis so you are always on the right ',
27 | 'category': 'Calendar',
28 | 'description': """
29 | This is a module you can use to import holidays into the calendar and the resource calendar.
30 | Currently it only allows for one URL containing an .ics file to be imported.
31 | It updates monthly for new holidays so that you are always up to date.
32 |
33 | Required python library: 'ics', just do "pip install ics" on your machine and you should be able to install the module.
34 | """,
35 | #'sequence': '1',
36 | 'author': 'Vertel AB',
37 | 'website': 'https://vertel.se/apps/odoo-calendar/ics_import_holidays',
38 | 'images': ['static/description/banner.png'], # 560x280 px.
39 | 'license': 'AGPL-3',
40 | 'contributor': '',
41 | 'maintainer': 'Vertel AB',
42 | 'repository': 'https://github.com/vertelab/odoo-calendar',
43 | 'depends': ['calendar', 'hr',],
44 | 'data': [
45 | "views/res_config_settings.xml",
46 | ],
47 | 'external_dependencies': {
48 | 'python': ['ics'],
49 | },
50 | }
51 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
52 |
--------------------------------------------------------------------------------
/extended_calendar_notifications/__manifest__.py:
--------------------------------------------------------------------------------
1 |
2 | # -*- coding: utf-8 -*-
3 | ##############################################################################
4 | #
5 | # Odoo SA, Open Source Management Solution, third party addon
6 | # Copyright (C) 2022- Vertel AB ().
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #
21 | ##############################################################################
22 | #
23 | # https://www.odoo.com/documentation/14.0/reference/module.html
24 | #
25 |
26 | {
27 | 'name': 'Calendar: Extended Notifications',
28 | 'version': '1.0',
29 | # Version ledger: 14.0 = Odoo version. 1 = Major. Non regressionable code. 2 = Minor. New features that are regressionable. 3 = Bug fixes
30 | 'summary': 'Module extends functionality for calandar events.',
31 | 'category': 'Calendar',
32 | 'description': """
33 | Module extends functionality for calandar events to send update emails when the event is deleted or changed.
34 | """,
35 | #'sequence': '1',
36 | 'author': 'Vertel AB',
37 | 'website': 'https://vertel.se/apps/odoo-calendar/extended_calendar_notifications',
38 | 'images': ['static/description/banner.png'], # 560x280 px.
39 | 'license': 'AGPL-3',
40 | 'contributor': '',
41 | 'maintainer': 'Vertel AB',
42 | 'repository': 'https://github.com/vertelab/odoo-calendar',
43 | 'depends': ['mail', 'base', 'calendar'],
44 | #"external_dependencies": {
45 | # "bin": ["openssl",],
46 | # "python": ["acme_tiny", "IPy",],
47 | #},
48 | 'data': [
49 | 'data/mail_template.xml'
50 | ],
51 | 'demo': [],
52 | 'application': False,
53 | 'installable': True,
54 | 'auto_install': False,
55 | #"post_init_hook": "post_init_hook",
56 | }
57 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
58 |
--------------------------------------------------------------------------------
/calendar_attendee_planning/models/hr_leave.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from odoo import models, fields, api
3 | import logging
4 | import datetime
5 | from datetime import date, datetime
6 |
7 | _logger = logging.getLogger(__name__)
8 |
9 | class HRLeaveWriteModify(models.Model):
10 | _inherit = "hr.leave"
11 |
12 | @api.model
13 | def create(self, vals_list):
14 | res = super().create(vals_list)
15 |
16 | partner_id = res.employee_id.user_partner_id.id
17 | my_overlap = self.check_overlapping()
18 | for overlap in my_overlap:
19 | for attendee in overlap.attendee_ids:
20 | attendee.set_state()
21 |
22 | return res
23 |
24 | def check_overlapping(self):
25 | overlapping_events = self.env['calendar.event'].search([
26 | '&',
27 | '|',
28 | '&',
29 | ('start','<',self.date_from),
30 | ('stop','>',self.date_from),
31 | '|',
32 | '&',
33 | ('start','<',self.date_to),
34 | ('stop','>',self.date_to),
35 | '|',
36 | '&',
37 | ('start','<=',self.date_from),
38 | ('stop','>=',self.date_to),
39 | '&',
40 | ('start','>=',self.date_from),
41 | ('stop','<=',self.date_to),
42 | #('partner_id', 'in', attendee_partners),
43 | ('partner_id', '=', self.employee_id.user_partner_id.id),
44 | ])
45 | return overlapping_events
46 |
47 | def write(self, vals):
48 | #partner_id = self.employee_id.user_partner_id.id
49 | pre_move_overlap = self.check_overlapping()
50 |
51 | res = super().write(vals)
52 |
53 | post_move_overlap = self.check_overlapping()
54 |
55 | for overlap in pre_move_overlap:
56 | for attendee in overlap.attendee_ids:
57 | attendee.set_state()
58 |
59 | for overlap in post_move_overlap:
60 | for attendee in overlap.attendee_ids:
61 | attendee.set_state()
62 |
63 | return res
64 |
65 | def unlink(self):
66 | #partner_id = self.employee_id.user_partner_id.id
67 | pre_move_overlap = self.check_overlapping()
68 |
69 | res = super().unlink()
70 |
71 | for overlap in pre_move_overlap:
72 | for attendee in overlap.attendee_ids:
73 | attendee.set_state()
74 |
75 | return res
76 |
--------------------------------------------------------------------------------
/website_calendar_ce/static/src/xml/booking.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/calendar_public_holiday_nager/models/calendar_public_holiday.py:
--------------------------------------------------------------------------------
1 | # Copyright 2025 Vertel AB
2 | # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3 |
4 | from odoo import api, fields, models
5 | from odoo.exceptions import ValidationError,UserError
6 | from datetime import datetime
7 | import logging
8 | import requests
9 |
10 | _logger = logging.getLogger(__name__)
11 |
12 | class ResourceCalendarPublicHoliday(models.Model):
13 | _inherit = "calendar.public.holiday"
14 |
15 | def fetch_public_holidays(self):
16 | for cal in self:
17 | url = f"https://date.nager.at/api/v3/PublicHolidays/{cal.year}/{cal.country_id.code}"
18 | response = requests.get(url)
19 | if response.status_code == 200:
20 | cal.line_ids.unlink()
21 | for day in response.json():
22 | _logger.warning(f"{day=}")
23 | holidays = cal.line_ids.filtered(lambda d: d.date == datetime.strptime(day['date'], "%Y-%m-%d").date())
24 | _logger.warning(f"{day=} {holidays=}")
25 | if len(holidays) > 0: # Only one holyday at the same date
26 | holidays[0].name += f", {day['localName']}"
27 | else:
28 | cal.line_ids.create({'name': day['localName'],'date':day['date'],'public_holiday_id':cal.id})
29 | # TODO lägga på name och localName via översättning
30 | # ~ self.env['ir.translation'].create({
31 | # ~ 'name': f"{holiday._name},name",
32 | # ~ 'res_id': holiday.id,
33 | # ~ 'lang': 'sv_SE', # Byt till önskat språk
34 | # ~ 'type': 'model',
35 | # ~ 'value': day['translatedName'],
36 | # ~ 'state': 'translated',
37 | # ~ })
38 |
39 | else:
40 | raise UserError(f"Could not fetch holidays {response.status_code} - {response.reason}{response.text}\n{url}")
41 |
42 | def fetch_public_holidays_next(self):
43 | self.ensure_one()
44 | cal = self.env['calendar.public.holiday'].create({'year':self.year + 1,'country_id':self.country_id.id,})
45 | cal.fetch_public_holidays()
46 | return {
47 | 'type': 'ir.actions.act_window',
48 | 'name': 'Public Holiday',
49 | 'res_model': 'calendar.public.holiday',
50 | 'view_mode': 'form',
51 | 'view_id': self.env.ref('calendar_public_holiday.view_calendar_public_holiday_form').id,
52 | 'res_id': cal.id,
53 | 'target': 'current',
54 | }
55 |
--------------------------------------------------------------------------------
/calendar_ics/static/description/index.html:
--------------------------------------------------------------------------------
1 |
2 |
26 | Glabels uses a template for the label design and are using a special
27 | notation, ${name}, for including fields from the database. When you
28 | design your labels use a dummy csv-file for your model you want
29 | to tie the report to and the format "Text: coma separated Values
30 | (CSV) with keys on line 1". When the template is ready you can
31 | upload it to the report-record (or include it in the xml-record if
32 | you are building a module). There is a test report action that
33 | also lists all fields for the choosen model.
34 |
47 | This module needs Glabel to be installed on the server (for Ubuntu:
48 | sudo apt install glabels)
49 |
50 | You can test your template (and installation) using glabels-batch-command:
51 | glabels-3-batch -o <out-file> -l -C -i <csv-file> <your template.glabels>
52 | This command are alike both on workstation and server.
53 |
54 |
26 | Glabels uses a template for the label design and are using a special
27 | notation, ${name}, for including fields from the database. When you
28 | design your labels use a dummy csv-file for your model you want
29 | to tie the report to and the format "Text: coma separated Values
30 | (CSV) with keys on line 1". When the template is ready you can
31 | upload it to the report-record (or include it in the xml-record if
32 | you are building a module). There is a test report action that
33 | also lists all fields for the choosen model.
34 |
47 | This module needs Glabel to be installed on the server (for Ubuntu:
48 | sudo apt install glabels)
49 |
50 | You can test your template (and installation) using glabels-batch-command:
51 | glabels-3-batch -o <out-file> -l -C -i <csv-file> <your template.glabels>
52 | This command are alike both on workstation and server.
53 |
54 |
26 | Glabels uses a template for the label design and are using a special
27 | notation, ${name}, for including fields from the database. When you
28 | design your labels use a dummy csv-file for your model you want
29 | to tie the report to and the format "Text: coma separated Values
30 | (CSV) with keys on line 1". When the template is ready you can
31 | upload it to the report-record (or include it in the xml-record if
32 | you are building a module). There is a test report action that
33 | also lists all fields for the choosen model.
34 |
47 | This module needs Glabel to be installed on the server (for Ubuntu:
48 | sudo apt install glabels)
49 |
50 | You can test your template (and installation) using glabels-batch-command:
51 | glabels-3-batch -o <out-file> -l -C -i <csv-file> <your template.glabels>
52 | This command are alike both on workstation and server.
53 |
54 |
26 | Glabels uses a template for the label design and are using a special
27 | notation, ${name}, for including fields from the database. When you
28 | design your labels use a dummy csv-file for your model you want
29 | to tie the report to and the format "Text: coma separated Values
30 | (CSV) with keys on line 1". When the template is ready you can
31 | upload it to the report-record (or include it in the xml-record if
32 | you are building a module). There is a test report action that
33 | also lists all fields for the choosen model.
34 |
47 | This module needs Glabel to be installed on the server (for Ubuntu:
48 | sudo apt install glabels)
49 |
50 | You can test your template (and installation) using glabels-batch-command:
51 | glabels-3-batch -o <out-file> -l -C -i <csv-file> <your template.glabels>
52 | This command are alike both on workstation and server.
53 |
54 |
26 | Glabels uses a template for the label design and are using a special
27 | notation, ${name}, for including fields from the database. When you
28 | design your labels use a dummy csv-file for your model you want
29 | to tie the report to and the format "Text: coma separated Values
30 | (CSV) with keys on line 1". When the template is ready you can
31 | upload it to the report-record (or include it in the xml-record if
32 | you are building a module). There is a test report action that
33 | also lists all fields for the choosen model.
34 |
47 | This module needs Glabel to be installed on the server (for Ubuntu:
48 | sudo apt install glabels)
49 |
50 | You can test your template (and installation) using glabels-batch-command:
51 | glabels-3-batch -o <out-file> -l -C -i <csv-file> <your template.glabels>
52 | This command are alike both on workstation and server.
53 |
54 |
26 | Glabels uses a template for the label design and are using a special
27 | notation, ${name}, for including fields from the database. When you
28 | design your labels use a dummy csv-file for your model you want
29 | to tie the report to and the format "Text: coma separated Values
30 | (CSV) with keys on line 1". When the template is ready you can
31 | upload it to the report-record (or include it in the xml-record if
32 | you are building a module). There is a test report action that
33 | also lists all fields for the choosen model.
34 |
47 | This module needs Glabel to be installed on the server (for Ubuntu:
48 | sudo apt install glabels)
49 |
50 | You can test your template (and installation) using glabels-batch-command:
51 | glabels-3-batch -o <out-file> -l -C -i <csv-file> <your template.glabels>
52 | This command are alike both on workstation and server.
53 |
54 |
26 | Glabels uses a template for the label design and are using a special
27 | notation, ${name}, for including fields from the database. When you
28 | design your labels use a dummy csv-file for your model you want
29 | to tie the report to and the format "Text: coma separated Values
30 | (CSV) with keys on line 1". When the template is ready you can
31 | upload it to the report-record (or include it in the xml-record if
32 | you are building a module). There is a test report action that
33 | also lists all fields for the choosen model.
34 |
47 | This module needs Glabel to be installed on the server (for Ubuntu:
48 | sudo apt install glabels)
49 |
50 | You can test your template (and installation) using glabels-batch-command:
51 | glabels-3-batch -o <out-file> -l -C -i <csv-file> <your template.glabels>
52 | This command are alike both on workstation and server.
53 |
54 |
26 | Glabels uses a template for the label design and are using a special
27 | notation, ${name}, for including fields from the database. When you
28 | design your labels use a dummy csv-file for your model you want
29 | to tie the report to and the format "Text: coma separated Values
30 | (CSV) with keys on line 1". When the template is ready you can
31 | upload it to the report-record (or include it in the xml-record if
32 | you are building a module). There is a test report action that
33 | also lists all fields for the choosen model.
34 |
47 | This module needs Glabel to be installed on the server (for Ubuntu:
48 | sudo apt install glabels)
49 |
50 | You can test your template (and installation) using glabels-batch-command:
51 | glabels-3-batch -o <out-file> -l -C -i <csv-file> <your template.glabels>
52 | This command are alike both on workstation and server.
53 |
54 |
26 | Glabels uses a template for the label design and are using a special
27 | notation, ${name}, for including fields from the database. When you
28 | design your labels use a dummy csv-file for your model you want
29 | to tie the report to and the format "Text: coma separated Values
30 | (CSV) with keys on line 1". When the template is ready you can
31 | upload it to the report-record (or include it in the xml-record if
32 | you are building a module). There is a test report action that
33 | also lists all fields for the choosen model.
34 |
47 | This module needs Glabel to be installed on the server (for Ubuntu:
48 | sudo apt install glabels)
49 |
50 | You can test your template (and installation) using glabels-batch-command:
51 | glabels-3-batch -o <out-file> -l -C -i <csv-file> <your template.glabels>
52 | This command are alike both on workstation and server.
53 |
54 |
12 | A diary is a register of an organization, where incoming, outgoing and prepared documents are
13 | registered. The purpose of diaries in the public sector is to create transparency according to the
14 | principle of openness. Record keeping in Sweden is regulated, among other things, by the Public Access
15 | to Information and Secrecy Act (SFS 2009: 400), which entered into force on 30 June 2009.
16 |
29 | Glabels uses a template for the label design and are using a special
30 | notation, ${name}, for including fields from the database. When you
31 | design your labels use a dummy csv-file for your model you want
32 | to tie the report to and the format "Text: coma separated Values
33 | (CSV) with keys on line 1". When the template is ready you can
34 | upload it to the report-record (or include it in the xml-record if
35 | you are building a module). There is a test report action that
36 | also lists all fields for the choosen model.
37 |
50 | This module needs Glabel to be installed on the server (for Ubuntu:
51 | sudo apt install glabels)
52 |
53 | You can test your template (and installation) using glabels-batch-command:
54 | glabels-3-batch -o <out-file> -l -C -i <csv-file> <your template.glabels>
55 | This command are alike both on workstation and server.
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/website_form_calendar/controllers/main.py:
--------------------------------------------------------------------------------
1 | import base64
2 | import json
3 | import pytz
4 |
5 | from datetime import datetime
6 | from psycopg2 import IntegrityError
7 | from werkzeug.exceptions import BadRequest
8 |
9 | from odoo import http, SUPERUSER_ID, _
10 | from odoo.http import request
11 | from odoo.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
12 | from odoo.tools.translate import _
13 | from odoo.exceptions import ValidationError, UserError
14 | from odoo.addons.base.models.ir_qweb_fields import nl2br
15 | from odoo.addons.website_form.controllers.main import WebsiteForm
16 |
17 |
18 | class CalendarWebsiteForm(WebsiteForm):
19 |
20 | def _handle_website_form(self, model_name, **kwargs):
21 | model_record = request.env['ir.model'].sudo().search([
22 | ('model', '=', model_name), ('website_form_access', '=', True)])
23 |
24 | if not model_record:
25 | return json.dumps({
26 | 'error': _("The form's specified model does not exist")
27 | })
28 |
29 | booking_type_id = False
30 |
31 | if model_name == 'calendar.event':
32 | booking_type_id = request.params.pop('booking_type_id')
33 | booking_type_id = request.env['calendar.booking.type'].browse(int(booking_type_id))
34 |
35 | try:
36 | data = self.extract_data(model_record, request.params)
37 | # If we encounter an issue while extracting data
38 | except ValidationError as e:
39 | # I couldn't find a cleaner way to pass data to an exception
40 | return json.dumps({'error_fields': e.args[0]})
41 |
42 | # print(request.params)
43 |
44 | if model_name == 'calendar.event':
45 | # data.update({'name': 'Hello World', 'start': datetime.now(), 'stop': datetime.now()})
46 | data['record'].update({
47 | 'name': _('%s with %s') % (booking_type_id.name, kwargs.get('Your Name')),
48 | 'start': datetime.now(),
49 | 'stop': datetime.now(),
50 | 'booking_type_id': booking_type_id.id
51 | })
52 |
53 | print("data", data)
54 |
55 |
56 | try:
57 | id_record = self.insert_record(request, model_record, data['record'], data['custom'], data.get('meta'))
58 | if id_record:
59 | self.insert_attachment(model_record, id_record, data['attachments'])
60 | # in case of an email, we want to send it immediately instead of waiting
61 | # for the email queue to process
62 | if model_name == 'mail.mail':
63 | request.env[model_name].sudo().browse(id_record).send()
64 |
65 | # Some fields have additional SQL constraints that we can't check generically
66 | # Ex: crm.lead.probability which is a float between 0 and 1
67 | # TODO: How to get the name of the erroneous field ?
68 | except IntegrityError:
69 | return json.dumps(False)
70 |
71 | request.session['form_builder_model_model'] = model_record.model
72 | request.session['form_builder_model'] = model_record.name
73 | request.session['form_builder_id'] = id_record
74 |
75 | return json.dumps({'id': id_record})
76 |
--------------------------------------------------------------------------------
/website_calendar_ce/__manifest__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Odoo SA, Open Source Management Solution, third party addon
5 | # Copyright (C) 2022- Vertel AB ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 |
22 | {
23 | 'name': 'Calendar: Website Calendar CE',
24 | 'version': '1.0',
25 | # Version ledger: 14.0 = Odoo version. 1 = Major. Non regressionable code. 2 = Minor. New features that are regressionable. 3 = Bug fixes
26 | 'summary': 'Schedule bookings with clients',
27 | 'category': 'Calendar',
28 | 'description': """
29 | Allow clients to Schedule Bookings through your Website
30 | -------------------------------------------------------
31 | """,
32 | 'sequence': '131',
33 | 'author': 'Vertel AB',
34 | 'website': 'https://vertel.se/apps/odoo-calendar/website_calendar_ce',
35 | 'images': ['static/description/banner.png'], # 560x280 px.
36 | 'license': 'AGPL-3',
37 | 'contributor': '',
38 | 'maintainer': 'Vertel AB',
39 | 'repository': 'https://github.com/vertelab/odoo-calendar',
40 | 'depends': ['calendar_sms', 'hr', 'website', 'mail'],
41 | 'data': [
42 | 'data/website_calendar_data.xml',
43 | 'data/mail.xml',
44 | 'views/calendar_views.xml',
45 | 'views/calendar_booking_views.xml',
46 | 'views/website_calendar_templates.xml',
47 | 'security/website_calendar_security.xml',
48 | 'security/ir.model.access.csv',
49 |
50 | # 'views/snippets/snippets.xml',
51 |
52 | ],
53 | 'demo': [
54 | 'data/website_calendar_demo.xml'
55 | ],
56 | # 'qweb': [
57 | # 'static/src/xml/booking.xml',
58 | # ],
59 | 'external_dependencies': {
60 | 'python': [
61 | 'pandas' # sudo pip3 install pandas
62 | ]
63 | },
64 | 'assets': {
65 | 'web.assets_frontend': [
66 | 'website_calendar_ce/static/src/scss/website_calendar_ce.scss',
67 | 'website_calendar_ce/static/src/js/website_calendar_ce.js'
68 | ],
69 | 'web.assets_backend': [
70 | 'website_calendar_ce/static/src/scss/booking_employee_url.scss',
71 | # 'website_calendar_ce/static/src/js/booking_employee_url.js'
72 | ],
73 | 'website.assets_wysiwyg': [
74 | 'website_calendar_ce/static/src/js/website_calendar.editor.js'
75 | ]
76 | },
77 | 'installable': True,
78 | 'application': True,
79 | 'auto_install': False,
80 | }
81 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
82 |
--------------------------------------------------------------------------------
/website_calendar_waitlist/controllers/main.py:
--------------------------------------------------------------------------------
1 | import datetime
2 | import logging
3 |
4 | from odoo import http, _, fields
5 | from odoo.http import request
6 |
7 | from odoo.addons.website_calendar_ce.controllers.main import WebsiteCalendar
8 |
9 |
10 | _logger = logging.getLogger(__name__)
11 |
12 |
13 | class ExtendedWebsiteCalendar(WebsiteCalendar):
14 |
15 | def _has_available_slots(self, Slots):
16 | for data in Slots:
17 | for week in data.get("weeks", []):
18 | for day in week:
19 | if day.get("slots", []):
20 | return True
21 | return False
22 |
23 |
24 | @http.route(['/website/calendar//booking'], type='http', auth="public", website=True)
25 | def calendar_booking(self, booking_type=None, employee_id=None, timezone=None, failed=False, **kwargs):
26 | request.session['timezone'] = timezone or booking_type.booking_tz
27 | Employee = request.env['hr.employee'].sudo().browse(int(employee_id)) if employee_id else None
28 | Slots = booking_type.sudo()._get_booking_slots(request.session['timezone'], Employee)
29 |
30 | _logger.warning(f"{booking_type=}")
31 | if request.env.user.partner_id == request.env.ref('base.public_partner'):
32 | # TODO: dont allow public user!
33 |
34 | return request.render("website_calendar_waitlist.booking_error", {
35 | })
36 | elif self._has_available_slots(Slots):
37 | return super().calendar_booking(booking_type, employee_id, timezone, failed, **kwargs)
38 | else:
39 | return request.render("website_calendar_waitlist.booking_form", {
40 | "employee": Employee,
41 | "booking_type": booking_type,
42 | "timezone": request.session["timezone"],
43 | "failed": failed,
44 | "partner_data": request.env.user.partner_id,
45 | })
46 |
47 | @http.route(['/website/calendar//waitlist'], type="http", auth="public", website=True)
48 | def waitlist(self, booking_type=None, employee_id=None, **kwargs):
49 | _logger.warning("got waitlist!")
50 | already_in_queue = False
51 | # Create waitlist
52 | partner_id = request.env.user.partner_id
53 | user_id = request.env['res.users'].sudo().search([('partner_id', '=', partner_id.id)])
54 |
55 | waitlist_data = {
56 | 'related_user_id': user_id.id,
57 | 'related_booking_type_id': booking_type.id,
58 | }
59 | if employee_id:
60 | waitlist_data['employee_id'] = int(employee_id)
61 |
62 | domain = [(key, '=', value) for key, value in waitlist_data.items()]
63 |
64 |
65 | _logger.warning(f"{domain=}")
66 | if queue_position := request.env['calendar.booking.type.waitlist'].sudo().search(domain):
67 | already_in_queue = True
68 | else:
69 | _logger.warning(f"{queue_position=}")
70 | queue_position = request.env['calendar.booking.type.waitlist'].sudo().create(waitlist_data)
71 | data = {
72 | "already_in_queue": already_in_queue,
73 | "queue_position": queue_position,
74 | }
75 | return request.render("website_calendar_waitlist.waitlist_confirmation", data)
76 |
77 |
--------------------------------------------------------------------------------
/website_calendar_ce/static/src/scss/website_calendar_ce.scss:
--------------------------------------------------------------------------------
1 | .o_calendar_days {
2 | font-size: 16px;
3 | height: 40px;
4 | .o_weekend {
5 | background-color: gray('200');
6 | }
7 | .o_day{
8 | background-color: theme-color('primary');
9 | color: o-get-most-contrast(theme-color('primary'), $body-color, #FFF);
10 | cursor: pointer;
11 | &.dropdown{
12 | padding: 0px;
13 | }
14 | .o_slots_dropdown{
15 | padding: 8px;
16 | }
17 | }
18 | .o_mute_day {
19 | opacity: 0.5
20 | }
21 | .o_today{
22 | position: relative;
23 | &::after {
24 | content: "";
25 | position: absolute;
26 | border-bottom: 20px solid #f0ad4e;
27 | border-left: 20px solid transparent;
28 | bottom: 0px;
29 | right: 0px;
30 | }
31 | }
32 | }
33 |
34 | /* Progress Wizard */
35 | .o_website_calendar {
36 | ul.wizard {
37 | padding: 0;
38 | margin-top: 20px;
39 | list-style: none outside none;
40 | -webkit-border-radius: 4px;
41 | -moz-border-radius: 4px;
42 | border-radius: 4px;
43 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.065);
44 | -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.065);
45 | box-shadow: 0 1px 2px rgba(0, 0, 0, 0.065);
46 | }
47 |
48 | ul.wizard li {
49 | border: 1px solid #d4d4d4;
50 | border-right-width: 0;
51 | position: relative;
52 | float: left;
53 | padding: 0 10px 0 20px;
54 | margin: 0;
55 | line-height: 38px;
56 | background: #fbfbfb;
57 | }
58 |
59 | ul.wizard li .chevron {
60 | position: absolute;
61 | top: 0;
62 | right: -10px;
63 | z-index: 1;
64 | display: block;
65 | border: 20px solid transparent;
66 | border-right: 0;
67 | border-left: 10px solid #d4d4d4;
68 | }
69 |
70 | ul.wizard li .chevron:before {
71 | position: absolute;
72 | top: -20px;
73 | right: 1px;
74 | display: block;
75 | border: 20px solid transparent;
76 | border-right: 0;
77 | border-left: 10px solid #fbfbfb;
78 | content: "";
79 | }
80 |
81 | ul.wizard li.text-success {
82 | background: #f3f4f5;
83 | }
84 |
85 | ul.wizard li.text-success .chevron:before {
86 | border-left: 10px solid #f5f5f5;
87 | }
88 |
89 | ul.wizard li.text-primary {
90 | background: #f1f6fc;
91 | }
92 |
93 | ul.wizard li.text-primary .chevron:before {
94 | border-left: 10px solid #f1f6fc;
95 | }
96 |
97 | ul.wizard li:first-child {
98 | padding-left: 15px;
99 | border-radius: 4px 0 0 4px;
100 | }
101 |
102 | ul.wizard li:last-child {
103 | border-radius: 0 4px 4px 0;
104 | border-right-width: 1px;
105 | }
106 | ul.wizard li:last-child .chevron {
107 | display: none;
108 | }
109 | }
110 |
111 | .form-group {
112 | .dropdown-item.active, .dropdown-item:active {
113 | color: #FFFFFF;
114 | text-decoration: none;
115 | background-color: transparent !important;
116 | }
117 |
118 | .dropdown-item:hover, .dropdown-item:focus {
119 | color: #16181b;
120 | text-decoration: none;
121 | background-color: transparent !important;
122 | }
123 | }
--------------------------------------------------------------------------------
/website_calendar_slot_range/views/website_calendar_templates.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |