summaryrefslogtreecommitdiff
path: root/addons/document/models
diff options
context:
space:
mode:
authorRavi Patel <rap@odoo.com>2016-05-26 18:47:58 +0530
committerYannick Tivisse <yti@odoo.com>2016-07-11 18:06:23 +0200
commit65b3c683b19907e6334b8ee56d41b9d244c36fc1 (patch)
tree382ac1f29982740f2115896471109b0352ef25a7 /addons/document/models
parent2332b4c55c48939079c1e54258c56df3f8db821f (diff)
[MIG] document: Migrated to new API.
Diffstat (limited to 'addons/document/models')
-rw-r--r--addons/document/models/ir_attachment.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/addons/document/models/ir_attachment.py b/addons/document/models/ir_attachment.py
index efa244f0dfa..7480a657ff6 100644
--- a/addons/document/models/ir_attachment.py
+++ b/addons/document/models/ir_attachment.py
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
-import zipfile
+import pyPdf
import xml.dom.minidom
-from StringIO import StringIO
+import zipfile
-import pyPdf
+from StringIO import StringIO
-from openerp.osv import osv
+from odoo import api, models
_logger = logging.getLogger(__name__)
FTYPES = ['docx', 'pptx', 'xlsx', 'opendoc', 'pdf']
@@ -35,7 +35,7 @@ def textToString(element):
return buff
-class IrAttachment(osv.osv):
+class IrAttachment(models.Model):
_inherit = 'ir.attachment'
def _index_docx(self, bin_data):
@@ -117,10 +117,11 @@ class IrAttachment(osv.osv):
pass
return buf
- def _index(self, cr, uid, bin_data, datas_fname, mimetype):
+ @api.model
+ def _index(self, bin_data, datas_fname, mimetype):
for ftype in FTYPES:
buf = getattr(self, '_index_%s' % ftype)(bin_data)
if buf:
return buf
- return super(IrAttachment, self)._index(cr, uid, bin_data, datas_fname, mimetype)
+ return super(IrAttachment, self)._index(bin_data, datas_fname, mimetype)