diff options
| author | Wolfgang Taferner <wtaferner@users.noreply.github.com> | 2015-01-22 16:36:37 +0100 |
|---|---|---|
| committer | David Monjoie <dmo@odoo.com> | 2015-03-06 10:10:41 +0100 |
| commit | 6b1f475bb5a873953044e4ff7a4e5d49638dd738 (patch) | |
| tree | e392f38a4277a3aef2e65ff8f9e806e7676c93f2 /addons/document | |
| parent | 872a80c41917b4f6b93df93df3b349a8dd26954e (diff) | |
[FIX] Missing possibility to define a file_type on creation/write of a
document which leads to an error message in case the indexer could not
retrieve the content type automatically.
Diffstat (limited to 'addons/document')
| -rw-r--r-- | addons/document/document.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/addons/document/document.py b/addons/document/document.py index 96868d3d66b..29b8aa1e8b3 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -125,18 +125,18 @@ class document_file(osv.osv): if vals.get('res_id', False) and vals.get('res_model', False) and not vals.get('partner_id', False): vals['partner_id'] = self.__get_partner_id(cr, uid, vals['res_model'], vals['res_id'], context) if vals.get('datas', False): - vals['file_type'], vals['index_content'] = self._index(cr, uid, vals['datas'].decode('base64'), vals.get('datas_fname', False), None) + vals['file_type'], vals['index_content'] = self._index(cr, uid, vals['datas'].decode('base64'), vals.get('datas_fname', False), vals.get('file_type', None)) return super(document_file, self).create(cr, uid, vals, context) def write(self, cr, uid, ids, vals, context=None): if context is None: context = {} if vals.get('datas', False): - vals['file_type'], vals['index_content'] = self._index(cr, uid, vals['datas'].decode('base64'), vals.get('datas_fname', False), None) + vals['file_type'], vals['index_content'] = self._index(cr, uid, vals['datas'].decode('base64'), vals.get('datas_fname', False), vals.get('file_type', None)) return super(document_file, self).write(cr, uid, ids, vals, context) def _index(self, cr, uid, data, datas_fname, file_type): - mime, icont = cntIndex.doIndex(data, datas_fname, file_type or None, None) + mime, icont = cntIndex.doIndex(data, datas_fname, file_type or None, None) icont_u = ustr(icont) return mime, icont_u |
