diff options
| author | Ravi Patel <rap@odoo.com> | 2016-05-26 18:47:58 +0530 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2016-07-11 18:06:23 +0200 |
| commit | 65b3c683b19907e6334b8ee56d41b9d244c36fc1 (patch) | |
| tree | 382ac1f29982740f2115896471109b0352ef25a7 /addons/document | |
| parent | 2332b4c55c48939079c1e54258c56df3f8db821f (diff) | |
[MIG] document: Migrated to new API.
Diffstat (limited to 'addons/document')
| -rw-r--r-- | addons/document/__openerp__.py | 1 | ||||
| -rw-r--r-- | addons/document/models/ir_attachment.py | 15 | ||||
| -rw-r--r-- | addons/document/views/document_templates.xml | 6 |
3 files changed, 10 insertions, 12 deletions
diff --git a/addons/document/__openerp__.py b/addons/document/__openerp__.py index add1d60f177..337e6557b72 100644 --- a/addons/document/__openerp__.py +++ b/addons/document/__openerp__.py @@ -15,5 +15,4 @@ Attachments list and document indexation 'views/document_templates.xml', ], 'installable': True, - 'auto_install': False, } 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) diff --git a/addons/document/views/document_templates.xml b/addons/document/views/document_templates.xml index 813ed7b7bd7..abb2d13f2fc 100644 --- a/addons/document/views/document_templates.xml +++ b/addons/document/views/document_templates.xml @@ -1,10 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> - <data> +<odoo> <template id="assets_backend" name="document assets" inherit_id="web.assets_backend"> <xpath expr="." position="inside"> <script type="text/javascript" src="/document/static/src/js/document.js"></script> </xpath> </template> - </data> -</openerp> +</odoo> |
