From eb710faa4e501b56c035d12f21c119d13167185b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 6 Oct 2012 15:03:35 +0200 Subject: [PATCH] Fix resource usage in webdav Reference fields values are instance instead of strings issue2810 --- trytond/webdav/webdav.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/trytond/webdav/webdav.py b/trytond/webdav/webdav.py index 19ab312d7c..f02b7531b8 100644 --- a/trytond/webdav/webdav.py +++ b/trytond/webdav/webdav.py @@ -712,7 +712,8 @@ class Attachment(ModelSQL, ModelView): Collection = pool.get('webdav.collection') for attachment in attachments: if attachment.resource: - model_name, record_id = attachment.resource.split(',') + model_name = attachment.resource.__name__ + record_id = attachment.resource.id if model_name == 'webdav.collection': collection = Collection(int(record_id)) for child in collection.childs: @@ -731,8 +732,9 @@ class Attachment(ModelSQL, ModelView): for attachment in attachments: if not attachment.resource: paths[attachment.id] = None - model_name, record_id = attachment.resource.split(',') - record_id = int(record_id) + continue + model_name = attachment.resource.__name__ + record_id = attachment.resource.id resources.setdefault(model_name, set()).add(record_id) resource2attachments.setdefault((model_name, record_id), []).append(attachment)