-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code Review: Unnecessary call of get_event_datetime for all types of fields #45
Comments
@iscale-odoo , you are still passing fields other than date and datetime to this function, that shouldn't be the case, it should be called up only for date and datetime fields |
We use this function for fields other than date and datetime because we could not find a way to get only a single instance of a recurring event using the icalendar object. To illustrate this, do following scenario:
3.a The image above indicates the content of the icalendar_component where you can only get 1 value for DTSTART which is the start of first instance of the recurring event. We want to get the details of the other 2 instances of the recurring event 3.b The image above shows the content of a VCALENDAR string which contains all of the information we need for each recurring instances. We passed this string to a function that makes use of a jicson library to break it down into multiple event dictionary 3.c The image above shows the break down of the events. Event 0 will always be the recurring event template which contains the RRULE that is passed to Odoo to create all of the recurring events. Event 1 and 2 are the instances of recurring events where changes are made to the date prior to the sync. Event 1 and 2 shows the RECURRENCE-ID which is the original DTSTART value of these 2 instance of recurring events. Only instances of recurring events that were modified will be shown in the VCALENDAR data, so even if we have 4 or more recurring instances, if we only modified 2 recurring instance before the sync, we get 2 events here plus event 0 which is the template. If we don't modify any recurring instance, we will only get one event which is the template.
If you can find a way to get individual instances of a recurring event as an icalendar object do let us know so we can modify this part. |
@iscale-odoo , I had mentioned this in the past as well, reiterating it here that get_event_datetime function should be called only for date/datetime fields.
Right now, its getting called for all types of fields and then as you have added in the exception handling , its logging for every field and it shows up in the logs as follows:
2023-05-02 06:29:59,998 68 WARNING nwb odoo.addons.nextcloud_odoo_sync.models.nextcloud_caldav: 'last-modified'
2023-05-02 06:29:59,998 68 WARNING nwb odoo.addons.nextcloud_odoo_sync.models.nextcloud_caldav: Unknown string format: 3a60dfb0150d877a9b32f7d33519ecc97b109e74
2023-05-02 06:29:59,999 68 WARNING nwb odoo.addons.nextcloud_odoo_sync.models.nextcloud_caldav: Unknown string format: bsp problemen verbouwing JM
2023-05-02 06:29:59,999 68 WARNING nwb odoo.addons.nextcloud_odoo_sync.models.nextcloud_caldav: Unknown string format: Vredenburchsingel
2023-05-02 06:30:00,000 68 WARNING nwb odoo.addons.nextcloud_odoo_sync.models.nextcloud_caldav: 'dtstart'
2023-05-02 06:30:00,000 68 WARNING nwb odoo.addons.nextcloud_odoo_sync.models.nextcloud_caldav: 'dtend'
2023-05-02 06:30:00,001 68 WARNING nwb odoo.addons.nextcloud_odoo_sync.models.nextcloud_caldav: Parser must be a string or character stream, not list
2023-05-02 06:30:00,450 68 WARNING nwb odoo.addons.nextcloud_odoo_sync.models.nc_sync_log: Error creating Odoo event time data '20230314T1' does not match format '%Y-%m-%d'.
Please rectify this as well while you are resolving the issue with date formats
The text was updated successfully, but these errors were encountered: