From fe78eb434bb43406756af31d1524c7ee02490e60 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 30 Apr 2012 10:40:48 +0200 Subject: [PATCH 1/4] [FIX] Calendar should show/hide it's sidebar bzr revid: fme@openerp.com-20120430084048-m94mk5hobxtdk3em --- addons/web_calendar/static/src/js/calendar.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/web_calendar/static/src/js/calendar.js b/addons/web_calendar/static/src/js/calendar.js index b4c43fbba98..959768d895e 100644 --- a/addons/web_calendar/static/src/js/calendar.js +++ b/addons/web_calendar/static/src/js/calendar.js @@ -392,9 +392,18 @@ instance.web_calendar.CalendarView = instance.web.View.extend({ var self = this; $.when(this.has_been_loaded).then(function() { self.$element.show(); + if (self.sidebar) { + self.sidebar.$element.show(); + } self.do_push_state({}); }); }, + do_hide: function() { + this._super(); + if (this.sidebar) { + this.sidebar.$element.hide(); + } + }, get_selected_ids: function() { // no way to select a record anyway return []; From e20149bc04cccf8bba205b9254ef609394c94d84 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Mon, 30 Apr 2012 16:33:17 +0200 Subject: [PATCH 2/4] [REM] base_setup dead code bzr revid: al@openerp.com-20120430143317-130o0hhpaqw7kwmp --- addons/base_setup/base_setup.py | 54 +------------------------- addons/base_setup/base_setup_views.xml | 26 +------------ 2 files changed, 2 insertions(+), 78 deletions(-) diff --git a/addons/base_setup/base_setup.py b/addons/base_setup/base_setup.py index a3effd98148..9673fcfbce0 100644 --- a/addons/base_setup/base_setup.py +++ b/addons/base_setup/base_setup.py @@ -28,55 +28,7 @@ from osv import fields, osv from tools.translate import _ from lxml import etree -#Migrate data from another application Conf wiz - -class migrade_application_installer_modules(osv.osv_memory): - _name = 'migrade.application.installer.modules' - _inherit = 'res.config.installer' - _columns = { - 'import_saleforce': fields.boolean('Import Saleforce', - help="For Import Saleforce"), - 'import_sugarcrm': fields.boolean('Import Sugarcrm', - help="For Import Sugarcrm"), - 'sync_google_contact': fields.boolean('Sync Google Contact', - help="For Sync Google Contact"), - 'quickbooks_ippids': fields.boolean('Quickbooks Ippids', - help="For Quickbooks Ippids"), - } - -class product_installer(osv.osv_memory): - _name = 'product.installer' - _inherit = 'res.config' - _columns = { - 'customers': fields.selection([('create','Create'), ('import','Import')], 'Customers', size=32, required=True, help="Import or create customers"), - } - _defaults = { - 'customers': 'create', - } - - def execute(self, cr, uid, ids, context=None): - if context is None: - context = {} - data_obj = self.pool.get('ir.model.data') - val = self.browse(cr, uid, ids, context=context)[0] - if val.customers == 'create': - id2 = data_obj._get_id(cr, uid, 'base', 'view_partner_form') - if id2: - id2 = data_obj.browse(cr, uid, id2, context=context).res_id - return { - 'view_type': 'form', - 'view_mode': 'form', - 'res_model': 'res.partner', - 'views': [(id2, 'form')], - 'type': 'ir.actions.act_window', - 'target': 'current', - 'nodestroy':False, - } - if val.customers == 'import': - return {'type': 'ir.actions.act_window'} - # Define users preferences for new users (ir.values) - def _lang_get(self, cr, uid, context=None): obj = self.pool.get('res.lang') ids = obj.search(cr, uid, [('translatable','=',True)]) @@ -130,8 +82,7 @@ class user_preferences_config(osv.osv_memory): ir_values_obj.set(cr, uid, 'default', False, 'menu_tips', ['res.users'], o.menu_tips) return {} -# Specify Your Terminology - +# Specify Your Terminology will move to 'partner' module class specify_partner_terminology(osv.osv_memory): _name = 'base.setup.terminology' _inherit = 'res.config' @@ -201,12 +152,9 @@ class specify_partner_terminology(osv.osv_memory): self.make_translations(cr, uid, ids, act_ref, 'model', act_id.help, _case_insensitive_replace(act_id.help,'Customer',o.partner), res_id=act_id.id, context=context) return {} - - # Preferences wizard for Sales & CRM. # It is defined here because it is inherited independently in modules sale, crm, # plugin_outlook and plugin_thunderbird. -# class sale_config_settings(osv.osv_memory): _name = 'sale.config.settings' _inherit = 'res.config.settings' diff --git a/addons/base_setup/base_setup_views.xml b/addons/base_setup/base_setup_views.xml index 40e88c604ef..f7562a796f2 100644 --- a/addons/base_setup/base_setup_views.xml +++ b/addons/base_setup/base_setup_views.xml @@ -1,6 +1,5 @@ - Set default users preferences @@ -48,22 +47,6 @@ once - - - Create Additional Users - ir.actions.act_window - res.users - form - tree,form - - - - - - 1000 - - - Specify Your Terminology @@ -102,13 +85,6 @@ form new - @@ -140,7 +116,6 @@ - @@ -157,6 +132,7 @@ + Configure Sales ir.actions.act_window From cf322b006434e650d4ffeb51975bee416b116da1 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Mon, 30 Apr 2012 17:02:44 +0200 Subject: [PATCH 3/4] [IMP] move openerp session into coresetup bzr revid: al@openerp.com-20120430150244-wh38i70f6pweu4yy --- addons/web/static/src/js/corelib.js | 442 ------------------------- addons/web/static/src/js/coresetup.js | 443 ++++++++++++++++++++++++++ 2 files changed, 443 insertions(+), 442 deletions(-) diff --git a/addons/web/static/src/js/corelib.js b/addons/web/static/src/js/corelib.js index 4dea72bfc9c..465ad2c921b 100644 --- a/addons/web/static/src/js/corelib.js +++ b/addons/web/static/src/js/corelib.js @@ -1341,448 +1341,6 @@ instance.web.JsonRPC = instance.web.CallbackEnabled.extend({ }, }); -instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Session# */{ - init: function() { - this._super.apply(this, arguments); - // TODO: session store in cookie should be optional - this.name = instance._session_id; - this.qweb_mutex = new $.Mutex(); - }, - rpc: function(url, params, success_callback, error_callback) { - params.session_id = this.session_id; - return this._super(url, params, success_callback, error_callback); - }, - /** - * Setup a sessionm - */ - session_bind: function(origin) { - var self = this; - this.setup(origin); - instance.web.qweb.default_dict['_s'] = this.origin; - this.session_id = false; - this.uid = false; - this.username = false; - this.user_context= {}; - this.db = false; - this.openerp_entreprise = false; - this.module_list = instance._modules.slice(); - this.module_loaded = {}; - _(this.module_list).each(function (mod) { - self.module_loaded[mod] = true; - }); - this.context = {}; - this.shortcuts = []; - this.active_id = null; - return this.session_init(); - }, - /** - * Init a session, reloads from cookie, if it exists - */ - session_init: function () { - var self = this; - // TODO: session store in cookie should be optional - this.session_id = this.get_cookie('session_id'); - return this.session_reload().pipe(function(result) { - var modules = instance._modules.join(','); - var deferred = self.rpc('/web/webclient/qweblist', {mods: modules}).pipe(self.do_load_qweb); - if(self.session_is_valid()) { - return deferred.pipe(function() { return self.load_modules(); }); - } - return deferred; - }); - }, - /** - * (re)loads the content of a session: db name, username, user id, session - * context and status of the support contract - * - * @returns {$.Deferred} deferred indicating the session is done reloading - */ - session_reload: function () { - var self = this; - return this.rpc("/web/session/get_session_info", {}).then(function(result) { - // If immediately follows a login (triggered by trying to restore - // an invalid session or no session at all), refresh session data - // (should not change, but just in case...) - _.extend(self, { - session_id: result.session_id, - db: result.db, - username: result.login, - uid: result.uid, - user_context: result.context, - openerp_entreprise: result.openerp_entreprise - }); - }); - }, - session_is_valid: function() { - return !!this.uid; - }, - /** - * The session is validated either by login or by restoration of a previous session - */ - session_authenticate: function(db, login, password, _volatile) { - var self = this; - var base_location = document.location.protocol + '//' + document.location.host; - var params = { db: db, login: login, password: password, base_location: base_location }; - return this.rpc("/web/session/authenticate", params).pipe(function(result) { - _.extend(self, { - session_id: result.session_id, - db: result.db, - username: result.login, - uid: result.uid, - user_context: result.context, - openerp_entreprise: result.openerp_entreprise - }); - if (!_volatile) { - self.set_cookie('session_id', self.session_id); - } - return self.load_modules(); - }); - }, - session_logout: function() { - this.set_cookie('session_id', ''); - return this.rpc("/web/session/destroy", {}); - }, - on_session_valid: function() { - }, - /** - * Called when a rpc call fail due to an invalid session. - * By default, it's a noop - */ - on_session_invalid: function(retry_callback) { - }, - /** - * Fetches a cookie stored by an openerp session - * - * @private - * @param name the cookie's name - */ - get_cookie: function (name) { - if (!this.name) { return null; } - var nameEQ = this.name + '|' + name + '='; - var cookies = document.cookie.split(';'); - for(var i=0; i', { - 'href': self.get_url(file), - 'rel': 'stylesheet', - 'type': 'text/css' - })); - }); - }, - do_load_js: function(files) { - var self = this; - var d = $.Deferred(); - if(files.length != 0) { - var file = files.shift(); - var tag = document.createElement('script'); - tag.type = 'text/javascript'; - tag.src = self.get_url(file); - tag.onload = tag.onreadystatechange = function() { - if ( (tag.readyState && tag.readyState != "loaded" && tag.readyState != "complete") || tag.onload_done ) - return; - tag.onload_done = true; - self.do_load_js(files).then(function () { - d.resolve(); - }); - }; - var head = document.head || document.getElementsByTagName('head')[0]; - head.appendChild(tag); - } else { - d.resolve(); - } - return d; - }, - do_load_qweb: function(files) { - var self = this; - _.each(files, function(file) { - self.qweb_mutex.exec(function() { - return self.rpc('/web/proxy/load', {path: file}).pipe(function(xml) { - if (!xml) { return; } - instance.web.qweb.add_template(_.str.trim(xml)); - }); - }); - }); - return self.qweb_mutex.def; - }, - on_modules_loaded: function() { - for(var j=0; j'); - - var complete = function () { - if (options.complete) { options.complete(); } - clearTimeout(timer); - $form_data.remove(); - $target.remove(); - if (remove_form && $form) { $form.remove(); } - }; - var $target = $('