Backport OVH modules from 10.0

This commit is contained in:
jcoux
2018-10-29 13:45:20 +01:00
parent c6a0e7c1f5
commit 7fc296d73e
12 changed files with 116 additions and 21 deletions
@@ -5,7 +5,7 @@
{'name': 'Base Attachment Object Store',
'summary': 'Base module for the implementation of external object store.',
'version': '10.0.1.2.0',
'version': '9.0.1.2.0',
'author': 'Camptocamp,Odoo Community Association (OCA)',
'license': 'AGPL-3',
'category': 'Knowledge Management',
@@ -9,7 +9,8 @@ import psycopg2
import odoo
from contextlib import closing, contextmanager
from odoo import api, exceptions, models, _
from openerp import api, exceptions, models, _
from openerp import SUPERUSER_ID
_logger = logging.getLogger(__name__)
@@ -40,10 +41,14 @@ class IrAttachment(models.Model):
_local_fields = ('image_small', 'image_medium', 'web_icon_data')
@api.cr
def _register_hook(self):
super(IrAttachment, self)._register_hook()
def _register_hook(self, cr):
super(IrAttachment, self)._register_hook(cr)
# ignore if we are not using an object storage
if self._storage() not in self._get_stores():
# Use directly SUPERUSER_ID
# because the uid parameter is required
# in function _storage and
# the SUPERUSER_ID is used directly instead of use the uid parameter.
if self._storage(cr, SUPERUSER_ID) not in self._get_stores():
return
curframe = inspect.currentframe()
calframe = inspect.getouterframes(curframe, 2)