Comments (6)
We can't replicate this issue. During our test the sync worked properly. Can you provide a video on how this issue occur?
from addons-project-nextcloud.
I don't have the nextcloud instance access for now.But, the way you are handling date fields is incorrect.You can refer this link for more info-https://github.com/python-caldav/caldav/blob/master/examples/basic_usage_examples.py. Lines 143-156 specifically
from addons-project-nextcloud.
We are currently using the function "get_event_datetime" in nextcloud_caldav.py. This function takes care of the following:
- Both sync direction Odoo (datetime) and Nextcloud (string)
- Check the timezone if supplied together with the Nextcloud date string then convert to UTC
The function you've referenced only handles date coming from Nextcloud -> Odoo and is not timezone aware in case Nextcloud date is supplied with timezone values.
In order for us to fix the issue, we need to replicate the scenario that eventually lead to the error
from addons-project-nextcloud.
Yes, I know that you are using "get_event_datetime" in nextcloud_caldav.py, but it's not working in every case.
The function you've referenced only handles date coming from Nextcloud -> Odoo and is not timezone aware in case Nextcloud date is supplied with timezone values.- it also allows to fetch timezone info from the object.
We can get on a call to discuss further on this.
from addons-project-nextcloud.
@dennis, as discussed on call.Here is the code for your reference:
nc_sync_user.py
def get_event_data(self, event):
"""
This method returns the following data of an event:
UID, hash, dictionary of event values
:param event: Calendar event object
:return dictionary of event values
"""
event_vals = jicson.fromText(event.data).get("VCALENDAR")[0].get("VEVENT")
data = []
nc_uid = False
# Remove the DTSTAMP values as it always changes
# when event get queried from Nextcloud
dtstart_dt = dtend_dt = tz = False
for d in event_vals:
nc_uid = d["UID"]
d.pop("DTSTAMP")
d.pop("SEQUENCE", False)
exdate_key = [k for k, v in d.items() if "EXDATE" in k]
vevent = event.vobject_instance.vevent
if isinstance(vevent.dtstart.value, datetime):
date_format = "%Y%m%dT%H%M%S"
else:
date_format = "%Y%m%d"
if exdate_key:
tz = False
if "TZID" in exdate_key[0]:
tz = exdate_key[0].split("=")[1]
d.pop(exdate_key[0])
d["exdates"] = [
x.value[0].strftime(date_format) for x in vevent.exdate_list
]
d["exdate_tz"] = tz
dtstart = event.icalendar_component.get("dtstart")
dtstart_dt = dtstart and dtstart.dt
tz = dtstart.params and dtstart.params.get("TZID") or False
dtend = event.icalendar_component.get("dtend")
dtend_dt = dtend and dtend.dt
data.append(d)
vals = {"data": data}
vals["uid"] = nc_uid
json_data = str(json.dumps(vals["data"], sort_keys=True)).encode("utf-8")
vals["hash"] = hashlib.sha1(json_data).hexdigest()
vals['data'][0]["dtstart"] = dtstart_dt
vals['data'][0]["dtend"] = dtend_dt
vals['data'][0]["tz"] = tz
return vals
You can then use this tz info elsewhere
from addons-project-nextcloud.
Working fine now
from addons-project-nextcloud.
Related Issues (20)
- Issue sync with another attendee HOT 2
- Issue:Nextcloud Calendar field shows up as Mandatory and empty HOT 2
- Issue recurring HOT 3
- Issue recurring (2) with version 15.0.1.5 HOT 2
- Sync Activity generating high data volume - log rotation is missing HOT 4
- Change Req: Abilty to sync multiple nextcloud instances
- Access rights issue:Users with sync user access are able to see,edit and add user setup for other users
- Issue with incorrect url in configuration HOT 1
- Code Review: Unnecessary call of get_event_datetime for all types of fields HOT 2
- Code review: Removal of unused functions and fields HOT 1
- Make use of jicson as external dependency
- Make configuration multicompany compliant
- Make use of VCR.py for offline tests
- Simplify "Nextcloud Event Status"
- Do not override get_user_connection() + proposal for modules merge
- Naming files, models, fields, context parameters, etc...
- Refactor nextcloud_caldav.py
- Naming nextcloud module HOT 1
- recurrance unlink random behavior HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from addons-project-nextcloud.