Fix resource usage in webdav

Reference fields values are instance instead of strings

issue2810
This commit is contained in:
Cédric Krier committed 2012-10-06 15:03:35 +02:00
1 parent f842eaa34e
commit eb710faa4e
1 file changed
+5 -3
+5 -3
View File
@@ -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)