openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #08145
[Merge] lp:~hbrunn/ocb-addons/6.1-knowledge_attachment_create_fix_duplicate_check into lp:ocb-addons/6.1
Holger Brunn (Therp) has proposed merging lp:~hbrunn/ocb-addons/6.1-knowledge_attachment_create_fix_duplicate_check into lp:ocb-addons/6.1.
Requested reviews:
OpenERP Community Backports (ocb)
For more details, see:
https://code.launchpad.net/~hbrunn/ocb-addons/6.1-knowledge_attachment_create_fix_duplicate_check/+merge/285359
--
Your team OpenERP Community Backports is requested to review the proposed merge of lp:~hbrunn/ocb-addons/6.1-knowledge_attachment_create_fix_duplicate_check into lp:ocb-addons/6.1.
=== modified file 'document/document.py'
--- document/document.py 2013-09-10 15:12:35 +0000
+++ document/document.py 2016-02-08 15:16:42 +0000
@@ -301,12 +301,12 @@
('datas_fname', '=', vals['datas_fname']),
]
attach_ids = self.search(cr, uid, domain, context=context)
- super(document_file, self).write(cr, uid, attach_ids,
- {'datas' : vals['datas']},
- context=context)
- result = attach_ids[0]
- else:
- #raise osv.except_osv(_('ValidateError'), _('File name must be unique!'))
+ if attach_ids:
+ super(document_file, self).write(cr, uid, attach_ids,
+ {'datas' : vals['datas']},
+ context=context)
+ result = attach_ids[0]
+ if not result:
result = super(document_file, self).create(cr, uid, vals, context)
return result
Follow ups