[MERGE] openerp.modules.migration: do not shadow AttributeError that may occure when executing the migrate() function
bzr revid: odo@openerp.com-20130508102347-5cnvli102hgrzxml bzr revid: chs@openerp.com-20130508120951-0r17kb14yxr4r2l2
This commit is contained in:
@@ -1709,8 +1709,15 @@ openerp.mail = function (session) {
|
||||
* contains the menu widget and the sub menu related of this wall
|
||||
*/
|
||||
do_reload_menu_emails: function () {
|
||||
var ActionManager = this.__parentedParent.ActionManager || this.__parentedParent.__parentedParent.ViewManager.ActionManager;
|
||||
ActionManager.__parentedParent.menu.do_reload_needaction();
|
||||
var menu = session.webclient.menu;
|
||||
if (!menu) {
|
||||
return $.when();
|
||||
}
|
||||
return menu.rpc("/web/menu/load_needaction", {'menu_ids': [menu.current_menu]}).done(function(r) {
|
||||
menu.on_needaction_loaded(r);
|
||||
}).then(function () {
|
||||
menu.trigger("need_action_reloaded");
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -110,7 +110,7 @@ class plugin_handler(osv.osv_memory):
|
||||
model_obj.message_post(cr, uid, [res_id],
|
||||
body=msg.get('body'),
|
||||
subject=msg.get('subject'),
|
||||
type='email',
|
||||
type='comment' if model == 'res.partner' else 'email',
|
||||
parent_id=msg.get('parent_id'),
|
||||
attachments=msg.get('attachments'))
|
||||
notify = _("Mail successfully pushed")
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
# Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
|
||||
# Copyright (C) 2010-2013 OpenERP s.a. (<http://openerp.com>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
@@ -22,31 +22,15 @@
|
||||
|
||||
""" Modules migration handling. """
|
||||
|
||||
import os, sys, imp
|
||||
import imp
|
||||
import logging
|
||||
import os
|
||||
from os.path import join as opj
|
||||
import itertools
|
||||
import zipimport
|
||||
|
||||
import openerp
|
||||
|
||||
import openerp.osv as osv
|
||||
import openerp.tools as tools
|
||||
import openerp.tools.osutil as osutil
|
||||
from openerp.tools.safe_eval import safe_eval as eval
|
||||
from openerp.tools.translate import _
|
||||
|
||||
import zipfile
|
||||
import openerp.release as release
|
||||
import openerp.tools as tools
|
||||
|
||||
import re
|
||||
import base64
|
||||
from zipfile import PyZipFile, ZIP_DEFLATED
|
||||
from cStringIO import StringIO
|
||||
|
||||
import logging
|
||||
|
||||
import openerp.modules.db
|
||||
import openerp.modules.graph
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -100,9 +84,10 @@ class MigrationManager(object):
|
||||
|
||||
def migrate_module(self, pkg, stage):
|
||||
assert stage in ('pre', 'post')
|
||||
stageformat = {'pre': '[>%s]',
|
||||
'post': '[%s>]',
|
||||
}
|
||||
stageformat = {
|
||||
'pre': '[>%s]',
|
||||
'post': '[%s>]',
|
||||
}
|
||||
|
||||
if not (hasattr(pkg, 'update') or pkg.state == 'to upgrade'):
|
||||
return
|
||||
@@ -129,9 +114,10 @@ class MigrationManager(object):
|
||||
m = self.migrations[pkg.name]
|
||||
lst = []
|
||||
|
||||
mapping = {'module': opj(pkg.name, 'migrations'),
|
||||
'maintenance': opj('base', 'maintenance', 'migrations', pkg.name),
|
||||
}
|
||||
mapping = {
|
||||
'module': opj(pkg.name, 'migrations'),
|
||||
'maintenance': opj('base', 'maintenance', 'migrations', pkg.name),
|
||||
}
|
||||
|
||||
for x in mapping.keys():
|
||||
if version in m[x]:
|
||||
@@ -180,14 +166,14 @@ class MigrationManager(object):
|
||||
try:
|
||||
mod = imp.load_source(name, pyfile, fp2)
|
||||
_logger.info('module %(addon)s: Running migration %(version)s %(name)s' % mergedict({'name': mod.__name__}, strfmt))
|
||||
mod.migrate(self.cr, pkg.installed_version)
|
||||
migrate = mod.migrate
|
||||
except ImportError:
|
||||
_logger.error('module %(addon)s: Unable to load %(stage)s-migration file %(file)s' % mergedict({'file': pyfile}, strfmt))
|
||||
_logger.exception('module %(addon)s: Unable to load %(stage)s-migration file %(file)s' % mergedict({'file': pyfile}, strfmt))
|
||||
raise
|
||||
except AttributeError:
|
||||
_logger.error('module %(addon)s: Each %(stage)s-migration file must have a "migrate(cr, installed_version)" function' % strfmt)
|
||||
except:
|
||||
raise
|
||||
else:
|
||||
migrate(self.cr, pkg.installed_version)
|
||||
finally:
|
||||
if fp:
|
||||
fp.close()
|
||||
|
||||
Reference in New Issue
Block a user