diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 0d5194829ad..6d12f8a49fe 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -679,9 +679,7 @@ class WebClient(openerpweb.Controller): @openerpweb.jsonrequest def version_info(self, req): - return { - "version": openerp.release.version - } + return openerp.service.web_services.RPC_VERSION_1 class Proxy(openerpweb.Controller): _cp_path = '/web/proxy' diff --git a/addons/web/http.py b/addons/web/http.py index 25cbecc56fc..8595e38446f 100644 --- a/addons/web/http.py +++ b/addons/web/http.py @@ -478,10 +478,9 @@ class Root(object): """ def __init__(self): self.addons = {} + self.statics = {} - static_dirs = self._load_addons() - app = werkzeug.wsgi.SharedDataMiddleware( self.dispatch, static_dirs) - self.dispatch = DisableCacheMiddleware(app) + self.load_addons() # Setup http sessions path = session_path() @@ -530,12 +529,10 @@ class Root(object): return response(environ, start_response) - def _load_addons(self): - """ - Loads all addons at the specified addons path, returns a mapping of - static URLs to the corresponding directories - """ - statics = {} + def load_addons(self): + """ Load all addons from addons patch containg static files and + controllers and configure them. """ + for addons_path in openerp.modules.module.ad_paths: for module in sorted(os.listdir(addons_path)): if module not in addons_module: @@ -551,14 +548,17 @@ class Root(object): m = __import__(module) addons_module[module] = m addons_manifest[module] = manifest - statics['/%s/static' % module] = path_static + self.statics['/%s/static' % module] = path_static + for k, v in controllers_class: if k not in controllers_object: o = v() controllers_object[k] = o if hasattr(o, '_cp_path'): controllers_path[o._cp_path] = o - return statics + + app = werkzeug.wsgi.SharedDataMiddleware(self.dispatch, self.statics) + self.dispatch = DisableCacheMiddleware(app) def find_handler(self, *l): """ diff --git a/addons/web/i18n/et.po b/addons/web/i18n/et.po index 7b049be508d..ca376075f76 100644 --- a/addons/web/i18n/et.po +++ b/addons/web/i18n/et.po @@ -8,14 +8,14 @@ msgstr "" "Project-Id-Version: openerp-web\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2012-11-30 18:13+0000\n" -"PO-Revision-Date: 2012-12-17 20:17+0000\n" +"PO-Revision-Date: 2012-12-19 20:37+0000\n" "Last-Translator: Ahti Hinnov \n" "Language-Team: Estonian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-12-18 05:08+0000\n" -"X-Generator: Launchpad (build 16372)\n" +"X-Launchpad-Export-Date: 2012-12-20 04:59+0000\n" +"X-Generator: Launchpad (build 16378)\n" #. module: web #. openerp-web @@ -147,7 +147,7 @@ msgstr "Fail" #: code:addons/web/controllers/main.py:842 #, python-format msgid "You cannot leave any password empty." -msgstr "" +msgstr "Sa ei saa jätta ühtegi salasõna tühjaks." #. module: web #. openerp-web @@ -192,7 +192,7 @@ msgstr "Versioon" #: code:addons/web/static/src/xml/base.xml:564 #, python-format msgid "Latest Modification Date:" -msgstr "" +msgstr "Viimase muudatuse kuupäev:" #. module: web #. openerp-web @@ -213,7 +213,7 @@ msgstr "" #: code:addons/web/static/src/xml/base.xml:1583 #, python-format msgid "Share with all users" -msgstr "" +msgstr "Jaga kõigi kasutajatega" #. module: web #. openerp-web @@ -242,7 +242,7 @@ msgstr "" #: code:addons/web/static/src/js/search.js:1299 #, python-format msgid "not a valid number" -msgstr "" +msgstr "ei ole korrektne number" #. module: web #. openerp-web @@ -263,7 +263,7 @@ msgstr "" #: code:addons/web/static/src/js/view_list.js:1319 #, python-format msgid "Undefined" -msgstr "" +msgstr "Määramata" #. module: web #. openerp-web @@ -277,7 +277,7 @@ msgstr "" #: code:addons/web/static/src/js/coresetup.js:598 #, python-format msgid "about a month ago" -msgstr "" +msgstr "umbes kuu eest" #. module: web #. openerp-web @@ -298,7 +298,7 @@ msgstr "Nupu tüüp:" #: code:addons/web/static/src/xml/base.xml:419 #, python-format msgid "OpenERP SA Company" -msgstr "" +msgstr "OpenERP SA Ettevõte" #. module: web #. openerp-web @@ -377,7 +377,7 @@ msgstr "Valik:" #: code:addons/web/static/src/js/view_form.js:869 #, python-format msgid "The following fields are invalid:" -msgstr "" +msgstr "Järgnevad väljad on vigased:" #. module: web #: code:addons/web/controllers/main.py:863 @@ -390,7 +390,7 @@ msgstr "Keeled" #: code:addons/web/static/src/xml/base.xml:1245 #, python-format msgid "...Upload in progress..." -msgstr "" +msgstr "...Toimub üleslaadimine..." #. module: web #. openerp-web @@ -447,7 +447,7 @@ msgstr "" #: code:addons/web/static/src/xml/base.xml:413 #, python-format msgid "Activate the developer mode" -msgstr "" +msgstr "Aktiveeri arendusreziim" #. module: web #. openerp-web @@ -468,7 +468,7 @@ msgstr "" #: code:addons/web/static/src/js/view_list.js:684 #, python-format msgid "You must select at least one record." -msgstr "" +msgstr "Sa pead valima vähemalt ühe kirje." #. module: web #. openerp-web @@ -489,7 +489,7 @@ msgstr "" #: code:addons/web/static/src/xml/base.xml:956 #, python-format msgid "Relation:" -msgstr "" +msgstr "Seos:" #. module: web #. openerp-web @@ -503,7 +503,7 @@ msgstr "vähe kui minuti eest" #: code:addons/web/static/src/xml/base.xml:829 #, python-format msgid "Condition:" -msgstr "" +msgstr "Seisukord:" #. module: web #. openerp-web @@ -524,7 +524,7 @@ msgstr "" #: code:addons/web/static/src/js/chrome.js:549 #, python-format msgid "Restored" -msgstr "" +msgstr "Taastatud" #. module: web #. openerp-web @@ -559,7 +559,7 @@ msgstr "" #: code:addons/web/static/src/js/search.js:1963 #, python-format msgid "is not" -msgstr "" +msgstr "ei ole" #. module: web #. openerp-web @@ -587,7 +587,7 @@ msgstr "UTF-8" #: code:addons/web/static/src/xml/base.xml:421 #, python-format msgid "For more information visit" -msgstr "" +msgstr "Rohkema info saamiseks külastage" #. module: web #. openerp-web @@ -601,7 +601,7 @@ msgstr "Lisa kogu info..." #: code:addons/web/static/src/xml/base.xml:1658 #, python-format msgid "Export Formats" -msgstr "" +msgstr "Ekspordi formaadid" #. module: web #. openerp-web @@ -666,7 +666,7 @@ msgstr "Toimingu ID:" #: code:addons/web/static/src/xml/base.xml:453 #, python-format msgid "Your user's preference timezone does not match your browser timezone:" -msgstr "" +msgstr "Sinu kasutaja ajatvöönd ei ühti brauseri ajatsooniga." #. module: web #. openerp-web @@ -751,7 +751,7 @@ msgstr "" #: code:addons/web/static/src/js/view_list.js:325 #, python-format msgid "Unlimited" -msgstr "" +msgstr "Piiramatu" #. module: web #. openerp-web @@ -762,6 +762,9 @@ msgid "" "\n" "Are you sure you want to leave this page ?" msgstr "" +"Hoiatus. Kirjet on muudetud ja su muudatused hüljatakse.\n" +"\n" +"Kas oled kindel, et soovid sellelt lehelt lahkuda?" #. module: web #. openerp-web @@ -789,7 +792,7 @@ msgstr "" #: code:addons/web/static/src/xml/base.xml:458 #, python-format msgid "Browser's timezone" -msgstr "Brauseri ajatsoon" +msgstr "Brauseri ajavöönd" #. module: web #. openerp-web @@ -834,7 +837,7 @@ msgstr "OpenERP.com" #: code:addons/web/static/src/js/view_form.js:2316 #, python-format msgid "Can't send email to invalid e-mail address" -msgstr "" +msgstr "Ei saa saata kirja vigasele e-posti aadressile" #. module: web #. openerp-web @@ -870,7 +873,7 @@ msgstr "Andmebaasi Hülgamine" #: code:addons/web/static/src/xml/base.xml:462 #, python-format msgid "Click here to change your user's timezone." -msgstr "Klõpsa siia, et vahetada oma kasutaja ajatsooni." +msgstr "Klõpsa siia, et vahetada oma kasutaja ajavööndit." #. module: web #. openerp-web @@ -902,7 +905,7 @@ msgstr "Salvesta" #: code:addons/web/static/src/xml/base.xml:355 #, python-format msgid "More" -msgstr "" +msgstr "Lisaks" #. module: web #. openerp-web @@ -1039,7 +1042,7 @@ msgstr "" #: code:addons/web/static/src/js/view_form.js:4313 #, python-format msgid "Open: " -msgstr "" +msgstr "Avatud " #. module: web #. openerp-web @@ -1093,7 +1096,7 @@ msgstr "" #: code:addons/web/static/src/xml/base.xml:1835 #, python-format msgid "Cancel" -msgstr "Tühista" +msgstr "Loobu" #. module: web #. openerp-web @@ -1108,7 +1111,7 @@ msgstr "Laadimine..." #: code:addons/web/static/src/xml/base.xml:561 #, python-format msgid "Latest Modification by:" -msgstr "" +msgstr "Viimase muudatuse tegija:" #. module: web #. openerp-web @@ -1116,7 +1119,7 @@ msgstr "" #: code:addons/web/static/src/xml/base.xml:466 #, python-format msgid "Timezone mismatch" -msgstr "" +msgstr "Ajavööndi ebakõla" #. module: web #. openerp-web @@ -1137,7 +1140,7 @@ msgstr "%d / %d" #: code:addons/web/static/src/xml/base.xml:1757 #, python-format msgid "2. Check your file format" -msgstr "" +msgstr "2. Kontrolli oma faili formaati" #. module: web #. openerp-web @@ -1324,7 +1327,7 @@ msgstr "Salvesta kui..." #: code:addons/web/static/src/js/view_form.js:4971 #, python-format msgid "Could not display the selected image." -msgstr "" +msgstr "Ei saa kuvada valitud pilti." #. module: web #. openerp-web @@ -1790,7 +1793,7 @@ msgstr "Domeen:" #: code:addons/web/static/src/xml/base.xml:812 #, python-format msgid "Default:" -msgstr "" +msgstr "Vaikimisi:" #. module: web #. openerp-web @@ -1815,7 +1818,7 @@ msgstr "Andmebaas:" #: code:addons/web/static/src/xml/base.xml:1215 #, python-format msgid "Uploading ..." -msgstr "" +msgstr "Üleslaadimine ..." #. module: web #. openerp-web @@ -1829,14 +1832,14 @@ msgstr "Nimi:" #: code:addons/web/static/src/js/chrome.js:1027 #, python-format msgid "About" -msgstr "" +msgstr "Infot" #. module: web #. openerp-web #: code:addons/web/static/src/xml/base.xml:1406 #, python-format msgid "Search Again" -msgstr "" +msgstr "Otsi Uuesti" #. module: web #. openerp-web @@ -1997,14 +2000,14 @@ msgstr "Latin 1" #: code:addons/web/static/src/xml/base.xml:1727 #, python-format msgid "Ok" -msgstr "Ok" +msgstr "Olgu" #. module: web #. openerp-web #: code:addons/web/static/src/js/views.js:1163 #, python-format msgid "Uploading..." -msgstr "" +msgstr "Üleslaadimine..." #. module: web #. openerp-web @@ -2071,7 +2074,7 @@ msgstr "" #: code:addons/web/static/src/js/view_form.js:3880 #, python-format msgid "Add an item" -msgstr "Lisa element" +msgstr "Lisa kirje" #. module: web #. openerp-web @@ -2271,7 +2274,7 @@ msgstr "Tee koopia" #: code:addons/web/static/src/xml/base.xml:1366 #, python-format msgid "Discard" -msgstr "" +msgstr "Unusta" #. module: web #. openerp-web @@ -2348,7 +2351,7 @@ msgstr "Filter" #: code:addons/web/static/src/xml/base.xml:928 #, python-format msgid "Widget:" -msgstr "" +msgstr "Vidin:" #. module: web #. openerp-web @@ -2411,7 +2414,7 @@ msgstr "Andmebaas %s on eemaldatud" #: code:addons/web/static/src/xml/base.xml:456 #, python-format msgid "User's timezone" -msgstr "Kasutaja ajatsoon" +msgstr "Kasutaja ajavöönd" #. module: web #. openerp-web @@ -2549,7 +2552,7 @@ msgstr "Tagasi sisenemiskuvale" #: code:addons/web/static/src/xml/base.xml:1429 #, python-format msgid "Filters" -msgstr "" +msgstr "Filtrid" #~ msgid "Translations" #~ msgstr "Tõlked" diff --git a/addons/web/i18n/it.po b/addons/web/i18n/it.po index f4fdb0931d6..9f140fb429d 100644 --- a/addons/web/i18n/it.po +++ b/addons/web/i18n/it.po @@ -8,14 +8,14 @@ msgstr "" "Project-Id-Version: openerp-web\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2012-11-30 18:13+0000\n" -"PO-Revision-Date: 2012-12-13 19:55+0000\n" +"PO-Revision-Date: 2012-12-19 19:44+0000\n" "Last-Translator: Davide Corio - agilebg.com \n" "Language-Team: Italian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-12-14 05:48+0000\n" -"X-Generator: Launchpad (build 16369)\n" +"X-Launchpad-Export-Date: 2012-12-20 04:59+0000\n" +"X-Generator: Launchpad (build 16378)\n" #. module: web #. openerp-web @@ -1685,7 +1685,7 @@ msgstr "Linee da saltare" #: code:addons/web/static/src/js/view_form.js:2831 #, python-format msgid "Create \"%s\"" -msgstr "Creato \"%s\"" +msgstr "Crea \"%s\"" #. module: web #. openerp-web diff --git a/addons/web/static/lib/jquery/jquery-1.8.3.js b/addons/web/static/lib/jquery/jquery-1.8.3.js index a86bf797a8b..c54e2bedb3b 100644 --- a/addons/web/static/lib/jquery/jquery-1.8.3.js +++ b/addons/web/static/lib/jquery/jquery-1.8.3.js @@ -6484,9 +6484,9 @@ jQuery.uaMatch = function( ua ) { ua = ua.toLowerCase(); var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || - /(webkit)[ \/]([\w.]+)/.exec( ua ) || - /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || - /(msie) ([\w.]+)/.exec( ua ) || + (/(webkit)[ \/]([\w.]+)/.exec( ua )) || + (/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua )) || + (/(msie) ([\w.]+)/.exec( ua )) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || []; diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 93fae7ce3a5..c43a2ba10d2 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -819,6 +819,16 @@ margin-top: 1px; background-color: #f6cf3b; } +.openerp .oe_dialog_warning { + width: 100%; +} +.openerp .oe_dialog_warning p { + text-align: center; +} +.openerp .oe_dialog_icon { + padding: 5px; + width: 32px; +} .openerp .oe_login { background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=); text-align: center; @@ -1182,6 +1192,7 @@ padding-bottom: 16px; } .openerp a.oe_logo { + position: relative; width: 220px; display: block; text-align: center; @@ -1190,6 +1201,24 @@ margin: 14px 0; border: 0; } +.openerp a.oe_logo .oe_logo_edit { + margin: 14px 0; + position: absolute; + top: 1px; + padding: 4px; + width: 100%; + display: none; + text-align: center; + color: #eeeeee; + background: rgba(37, 37, 37, 0.9); + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; +} +.openerp a.oe_logo:hover .oe_logo_edit_admin { + display: block; +} .openerp .oe_footer { position: fixed; bottom: 0; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 30f88678c79..5ab7332be7f 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -696,6 +696,15 @@ $sheet-padding: 16px margin-top: 1px background-color: #f6cf3b // }}} + // CrashManager {{{ + .oe_dialog_warning + width: 100% + p + text-align: center + .oe_dialog_icon + padding: 5px + width: 32px + // }}} // Login {{{ .oe_login background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=) @@ -958,12 +967,26 @@ $sheet-padding: 16px text-shadow: 0 1px 1px white padding-bottom: 16px a.oe_logo + position: relative width: 220px display: block text-align: center img margin: 14px 0 border: 0 + .oe_logo_edit + margin: 14px 0 + position: absolute + top: 1px + padding: 4px + width: 100% + display: none + text-align: center + color: #eee + background: rgba(37,37,37,0.9) + @include box-sizing(border) + &:hover .oe_logo_edit_admin + display: block .oe_footer position: fixed bottom: 0 diff --git a/addons/web/static/src/css/full.css b/addons/web/static/src/css/full.css index 7f3a2f60ea4..2692792d46d 100644 --- a/addons/web/static/src/css/full.css +++ b/addons/web/static/src/css/full.css @@ -1,6 +1,12 @@ +/* This css contains the styling specific to the 'normal mode'. (as opposite to the embedded mode) */ +/* In embedded mode [1], this stylesheet won't be loaded. */ + +/* [1] The web client features an embedded mode in which the webclient */ +/* or a part of it can be started in any element of any webpage host. */ + body { padding: 0; margin: 0; overflow-y: scroll; height: 100%; -} \ No newline at end of file +} diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 9e5a5936089..db418eb6827 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -691,6 +691,7 @@ instance.web.Login = instance.web.Widget.extend({ }); instance.web.client_actions.add("login", "instance.web.Login"); + /** * Redirect to url by replacing window.location * If wait is true, sleep 1s and wait for the server i.e. after a restart. @@ -804,6 +805,7 @@ instance.web.Menu = instance.web.Widget.extend({ this.maximum_visible_links = 'auto'; // # of menu to show. 0 = do not crop, 'auto' = algo this.data = {data:{children:[]}}; this.on("menu_loaded", this, function (menu_data) { + self.reflow(); // launch the fetch of needaction counters, asynchronous if (!_.isEmpty(menu_data.all_menu_ids)) { this.rpc("/web/menu/load_needaction", {menu_ids: menu_data.all_menu_ids}).done(function(r) { @@ -811,6 +813,11 @@ instance.web.Menu = instance.web.Widget.extend({ }); } }); + var lazyreflow = _.debounce(this.reflow.bind(this), 200); + instance.web.bus.on('resize', this, function() { + self.$el.height(0); + lazyreflow(); + }); }, start: function() { this._super.apply(this, arguments); @@ -828,12 +835,6 @@ instance.web.Menu = instance.web.Widget.extend({ var self = this; this.data = {data: data}; this.renderElement(); - this.limit_entries(); - // Hide toplevel item if there is only one - var $toplevel = this.$("li"); - if($toplevel.length == 1) { - $toplevel.hide(); - } this.$secondary_menus.html(QWeb.render("Menu.secondary", { widget : this })); this.$el.on('click', 'a[data-menu]', this.on_menu_click); // Hide second level submenus @@ -855,23 +856,34 @@ instance.web.Menu = instance.web.Widget.extend({ } }); }, - limit_entries: function() { - var maximum_visible_links = this.maximum_visible_links; - if (maximum_visible_links === 'auto') { - maximum_visible_links = this.auto_limit_entries(); + /** + * Reflow the menu items and dock overflowing items into a "More" menu item. + * Automatically called when 'menu_loaded' event is triggered and on window resizing. + */ + reflow: function() { + var self = this; + this.$el.height('auto').show(); + var $more_container = this.$('.oe_menu_more_container').hide(); + var $more = this.$('.oe_menu_more'); + $more.children('li').insertBefore($more_container); + var $toplevel_items = this.$el.children('li').not($more_container).hide(); + $toplevel_items.each(function() { + var remaining_space = self.$el.parent().width() - $more_container.outerWidth(); + self.$el.parent().children(':visible').each(function() { + remaining_space -= $(this).outerWidth(); + }); + if ($(this).width() > remaining_space) { + return false; + } + $(this).show(); + }); + $more.append($toplevel_items.filter(':hidden').show()); + $more_container.toggle(!!$more.children().length); + // Hide toplevel item if there is only one + var $toplevel = this.$el.children("li:visible"); + if ($toplevel.length === 1) { + $toplevel.hide(); } - if (maximum_visible_links < this.data.data.children.length) { - var $more = $(QWeb.render('Menu.more')), - $index = this.$el.find('li').eq(maximum_visible_links - 1); - $index.after($more); - //$('.oe_topbar').append($more); - $more.find('.oe_menu_more').append($index.next().nextAll()); - } - }, - auto_limit_entries: function() { - // TODO: auto detect overflow and bind window on resize - var width = $(window).width(); - return Math.floor(width / 125); }, /** * Opens a given menu by id, as if a user had browsed to that menu by hand @@ -1118,6 +1130,9 @@ instance.web.Client = instance.web.Widget.extend({ instance.web.WebClient = instance.web.Client.extend({ _template: 'WebClient', + events: { + 'click .oe_logo_edit_admin': 'logo_edit' + }, init: function(parent) { this._super(parent); this._current_state = null; @@ -1188,7 +1203,29 @@ instance.web.WebClient = instance.web.Client.extend({ }, update_logo: function() { var img = this.session.url('/web/binary/company_logo'); - this.$el.find('.oe_logo img').attr('src', '').attr('src', img); + this.$('.oe_logo img').attr('src', '').attr('src', img); + this.$('.oe_logo_edit').toggleClass('oe_logo_edit_admin', this.session.uid === 1); + }, + logo_edit: function(ev) { + var self = this; + new instance.web.Model("res.users").get_func("read")(this.session.uid, ["company_id"]).then(function(res) { + self.rpc("/web/action/load", { action_id: "base.action_res_company_form" }).done(function(result) { + result.res_id = res['company_id'][0]; + result.target = "new"; + result.views = [[false, 'form']]; + result.flags = { + action_buttons: true, + }; + self.action_manager.do_action(result); + var form = self.action_manager.dialog_widget.views.form.controller; + form.on("on_button_cancel", self.action_manager.dialog, self.action_manager.dialog.close); + form.on('record_saved', self, function() { + self.action_manager.dialog.close(); + self.update_logo(); + }); + }); + }); + return false; }, check_timezone: function() { var self = this; @@ -1343,17 +1380,17 @@ instance.web.EmbeddedClient = instance.web.Client.extend({ _template: 'EmbedClient', init: function(parent, origin, dbname, login, key, action_id, options) { this._super(parent, origin); - - this.dbname = dbname; - this.login = login; - this.key = key; + this.bind_credentials(dbname, login, key); this.action_id = action_id; this.options = options || {}; }, start: function() { var self = this; return $.when(this._super()).then(function() { - return instance.session.session_authenticate(self.dbname, self.login, self.key, true).then(function() { + return self.authenticate().then(function() { + if (!self.action_id) { + return; + } return self.rpc("/web/action/load", { action_id: self.action_id }).done(function(result) { var action = result; action.flags = _.extend({ @@ -1364,11 +1401,30 @@ instance.web.EmbeddedClient = instance.web.Client.extend({ //pager : false }, self.options, action.flags || {}); - self.action_manager.do_action(action); + self.do_action(action); }); }); }); }, + + do_action: function(action) { + return this.action_manager.do_action(action); + }, + + authenticate: function() { + var s = instance.session; + if (s.session_is_valid() && s.db === this.dbname && s.login === this.login) { + return $.when(); + } + return instance.session.session_authenticate(this.dbname, this.login, this.key, true); + }, + + bind_credentials: function(dbname, login, key) { + this.dbname = dbname; + this.login = login; + this.key = key; + }, + }); instance.web.embed = function (origin, dbname, login, key, action, options) { diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index c88e0ca0512..a8b0510389b 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -30,6 +30,12 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess * Setup a sessionm */ session_bind: function(origin) { + if (!_.isUndefined(this.origin)) { + if (this.origin === origin) { + return $.when(); + } + throw new Error('Session already bound to ' + this.origin); + } var self = this; this.setup(origin); instance.web.qweb.default_dict['_s'] = this.origin; @@ -471,6 +477,11 @@ $.fn.openerpClass = function(additionalClass) { $(this).addClass('openerp ' + additionalClass); }); }; +$.fn.openerpBounce = function() { + return this.each(function() { + $(this).css('box-sizing', 'content-box').effect('bounce', {distance: 18, times: 5}, 250); + }); +}; /** Jquery extentions */ $.Mutex = (function() { diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index cfc8be391b4..5c76a13ef0d 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -206,16 +206,16 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.$el.find(".oe_form_group_row,.oe_form_field,label").on('click', function (e) { if(self.get("actual_mode") == "view") { var $button = self.options.$buttons.find(".oe_form_button_edit"); - $button.css('box-sizing', 'content-box').effect('bounce', {distance: 18, times: 5}, 150); + $button.openerpBounce(); e.stopPropagation(); instance.web.bus.trigger('click', e); } }); //bounce effect on red button when click on statusbar. this.$el.find(".oe_form_field_status:not(.oe_form_status_clickable)").on('click', function (e) { - if((self.get("actual_mode") == "view")) { + if((self.get("actual_mode") == "view")) { var $button = self.$el.find(".oe_highlight:not(.oe_form_invisible)").css({'float':'left','clear':'none'}); - $button.effect('bounce', {distance:18, times: 5}, 150); + $button.openerpBounce(); e.stopPropagation(); } }); @@ -919,7 +919,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.do_update_pager(); if (this.sidebar) { this.sidebar.do_attachement_update(this.dataset, this.datarecord.id); - } + } //openerp.log("The record has been created with id #" + this.datarecord.id); return $.when(this.reload()).then(function () { self.trigger('record_created', r); @@ -2289,7 +2289,10 @@ instance.web.form.FieldChar = instance.web.form.AbstractField.extend(instance.we }); instance.web.form.FieldID = instance.web.form.FieldChar.extend({ - + process_modifiers: function () { + this._super(); + this.set({ readonly: true }); + }, }); instance.web.form.FieldEmail = instance.web.form.FieldChar.extend({ @@ -2389,7 +2392,7 @@ instance.web.DateTimeWidget = instance.web.Widget.extend({ var self = this; this.$input = this.$el.find('input.oe_datepicker_master'); this.$input_picker = this.$el.find('input.oe_datepicker_container'); - + this.picker({ onClose: this.on_picker_select, onSelect: this.on_picker_select, @@ -5092,7 +5095,7 @@ instance.web.form.FieldMany2ManyBinaryMultiFiles = instance.web.form.AbstractFie _.each(datas, function (data) { data.no_unlink = true; data.url = self.session.url('/web/binary/saveas', {model: 'ir.attachment', field: 'datas', filename_field: 'datas_fname', id: data.id}); - + _.each(self.get('value'), function (val, key) { if(val == data.id) { self.get('value')[key] = data; @@ -5258,7 +5261,8 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ if (this.field.type == "many2one") { var domain = []; if(!_.isEmpty(this.field.domain) || !_.isEmpty(this.node.attrs.domain)) { - domain = new instance.web.CompoundDomain(['|'], self.build_domain(), [['id', '=', self.get('value')]]); + var d = instance.web.pyeval.eval('domain', self.build_domain()); + domain = ['|', ['id', '=', self.get('value')]].concat(d); } var ds = new instance.web.DataSetSearch(this, this.field.relation, self.build_context(), domain); return ds.read_slice(['name'], {}).then(function (records) { diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index f6794bd435c..4687b3cb2ba 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -833,7 +833,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi ); var create_nocontent = this.$buttons; this.$el.find('.oe_view_nocontent').click(function() { - create_nocontent.effect('bounce', {distance: 18, times: 5}, 150); + create_nocontent.openerpBounce(); }); } }); diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index dc31a24dc31..877a2c183ee 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -36,7 +36,7 @@ - +

@@ -348,16 +348,14 @@

  • +
  • - - More -
      - - -
  • - +
    +