From fb3f7aa747d4d196abd3963ef1cbdfae910551a5 Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Tue, 10 Jan 2012 13:35:59 +0100 Subject: [PATCH 01/48] [IMP] delivery: move picking's net weight to extended view bzr revid: ls@numerigraphe.fr-20120110123559-1llywc42k606hryj --- addons/delivery/delivery_view.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/delivery/delivery_view.xml b/addons/delivery/delivery_view.xml index c46253777d2..47ed9d6d274 100644 --- a/addons/delivery/delivery_view.xml +++ b/addons/delivery/delivery_view.xml @@ -194,7 +194,7 @@ - + - + - + @@ -245,7 +245,7 @@ - + @@ -258,7 +258,7 @@ - + @@ -271,7 +271,7 @@ - + From 32781b0268a8b3583869cd14809e466568ee2a7f Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Mon, 16 Jan 2012 11:34:06 +0100 Subject: [PATCH 02/48] [FIX] typo in XML file bzr revid: ls@numerigraphe.fr-20120116103406-gwx3w8zlnrnvlyyr --- addons/delivery/delivery_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/delivery/delivery_view.xml b/addons/delivery/delivery_view.xml index 47ed9d6d274..6c9e8c85cdb 100644 --- a/addons/delivery/delivery_view.xml +++ b/addons/delivery/delivery_view.xml @@ -194,7 +194,7 @@ - @@ -207,7 +207,7 @@ - From 438cde1f2f9b6204a0cb71338eacc7dfa1fab4e9 Mon Sep 17 00:00:00 2001 From: "nicolas.bessi@camptocamp.com" <> Date: Wed, 8 Feb 2012 11:37:15 +0100 Subject: [PATCH 03/48] [FIX] l10n_ch bvr report to follow last patches of report_webkit addons bzr revid: nicolas.bessi@camptocamp.com-20120208103715-gk6upkf3b47av9h1 --- addons/l10n_ch/report/report_webkit_html.py | 154 +++++++------------- 1 file changed, 51 insertions(+), 103 deletions(-) diff --git a/addons/l10n_ch/report/report_webkit_html.py b/addons/l10n_ch/report/report_webkit_html.py index e6f7239c4e4..72158361da7 100644 --- a/addons/l10n_ch/report/report_webkit_html.py +++ b/addons/l10n_ch/report/report_webkit_html.py @@ -20,22 +20,31 @@ ############################################################################## import time -from report import report_sxw -from report_webkit import webkit_report -from report_webkit import report_helper -from osv import osv -from tools import mod10r import sys import os import re + +from mako.template import Template +from mako.lookup import TemplateLookup +from mako import exceptions + + +from report import report_sxw +from report_webkit import webkit_report +from report_webkit import report_helper + +from osv import osv +from osv.osv import except_osv + +from tools import mod10r +from tools.translate import _ +from tools.config import config + import wizard import addons import pooler -from tools.config import config -from mako.template import Template -from mako import exceptions -from tools.translate import _ -from osv.osv import except_osv + + class l10n_ch_report_webkit_html(report_sxw.rml_parse): @@ -143,53 +152,26 @@ class l10n_ch_report_webkit_html(report_sxw.rml_parse): 'digits!\nPlease check your company ' 'information for the invoice:\n%s') %(invoice_name))) return '' + +def mako_template(text): + """Build a Mako template. + + This template uses UTF-8 encoding + """ + tmp_lookup = TemplateLookup() #we need it in order to allow inclusion and inheritance + return Template(text, input_encoding='utf-8', output_encoding='utf-8', lookup=tmp_lookup) class BVRWebKitParser(webkit_report.WebKitParser): - def setLang(self, lang): - if not lang: - lang = 'en_US' - self.localcontext['lang'] = lang - - def formatLang(self, value, digits=None, date=False, date_time=False, grouping=True, monetary=False): - """format using the know cursor, language from localcontext""" - if digits is None: - digits = self.parser_instance.get_digits(value) - if isinstance(value, (str, unicode)) and not value: - return '' - pool_lang = self.pool.get('res.lang') - lang = self.localcontext['lang'] - - lang_ids = pool_lang.search(self.parser_instance.cr, self.parser_instance.uid, [('code','=',lang)])[0] - lang_obj = pool_lang.browse(self.parser_instance.cr, self.parser_instance.uid, lang_ids) - - if date or date_time: - if not str(value): - return '' - - date_format = lang_obj.date_format - parse_format = '%Y-%m-%d' - if date_time: - value=value.split('.')[0] - date_format = date_format + " " + lang_obj.time_format - parse_format = '%Y-%m-%d %H:%M:%S' - if not isinstance(value, time.struct_time): - return time.strftime(date_format, time.strptime(value, parse_format)) - - else: - date = datetime(*value.timetuple()[:6]) - return date.strftime(date_format) - - return lang_obj.format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary) - def create_single_pdf(self, cursor, uid, ids, data, report_xml, context=None): """generate the PDF""" - self.parser_instance = self.parser( - cursor, + context = context or {} + if report_xml.report_type != 'webkit': + return super(WebKitParser,self).create_single_pdf(cursor, uid, ids, data, report_xml, context=context) + self.parser_instance = self.parser(cursor, uid, self.name2, - context=context - ) + context=context) self.pool = pooler.get_pool(cursor.dbname) objs = self.getObjects(cursor, uid, ids, context) self.parser_instance.set_context(objs, data, ids, report_xml.report_type) @@ -201,7 +183,7 @@ class BVRWebKitParser(webkit_report.WebKitParser): if not template and report_xml.report_webkit_data : template = report_xml.report_webkit_data if not template : - raise except_osv(_('Webkit Report template not found !'), _('')) + raise except_osv(_('Error'),_('Webkit Report template not found !')) header = report_xml.webkit_header.html footer = report_xml.webkit_header.footer_html if not header and report_xml.header: @@ -210,43 +192,19 @@ class BVRWebKitParser(webkit_report.WebKitParser): _('Please set a header in company settings') ) if not report_xml.header : - #I know it could be cleaner ... - header = u""" - - - - - - - -""" - self.parser_instance.localcontext.update({'setLang':self.setLang}) - self.parser_instance.localcontext.update({'formatLang':self.formatLang}) + header = '' + default_head = addons.get_module_resource('report_webkit', 'default_header.html') + with open(default_head,'r') as f: + header = f.read() css = report_xml.webkit_header.css if not css : css = '' user = self.pool.get('res.users').browse(cursor, uid, uid) company = user.company_id - parse_template = template - #default_filters=['unicode', 'entity'] can be used to set global filter - body_mako_tpl = Template(parse_template ,input_encoding='utf-8', output_encoding='utf-8') + body_mako_tpl = mako_template(template) #BVR specific bvr_path = addons.get_module_resource(os.path.join('l10n_ch','report','bvr.mako')) - body_bvr_tpl = Template(file(bvr_path).read(), input_encoding='utf-8', output_encoding='utf-8') - + body_bvr_tpl = mako_template(file(bvr_path).read()) helper = report_helper.WebKitHelper(cursor, uid, report_xml.id, context) ##BVR Specific htmls = [] @@ -254,58 +212,48 @@ class BVRWebKitParser(webkit_report.WebKitParser): self.parser_instance.localcontext['objects'] = [obj] if not company.bvr_only: try: - html = body_mako_tpl.render( - helper=helper, + html = body_mako_tpl.render(helper=helper, css=css, _=self.translate_call, - **self.parser_instance.localcontext - ) + **self.parser_instance.localcontext) except Exception, e: raise Exception(exceptions.text_error_template().render()) htmls.append(html) if not company.invoice_only: try: - bvr = body_bvr_tpl.render( - helper=helper, - css=css, - _=self.translate_call, - **self.parser_instance.localcontext - ) + bvr = body_bvr_tpl.render(helper=helper, + css=css, + _=self.translate_call, + **self.parser_instance.localcontext) except Exception, e: raise Exception(exceptions.text_error_template().render()) htmls.append(bvr) head_mako_tpl = Template(header, input_encoding='utf-8', output_encoding='utf-8') try: - head = head_mako_tpl.render( - helper=helper, + head = head_mako_tpl.render(helper=helper, css=css, _debug=False, _=self.translate_call, - **self.parser_instance.localcontext - ) + **self.parser_instance.localcontext) except Exception, e: raise Exception(exceptions.text_error_template().render()) foot = False if footer and company.invoice_only : foot_mako_tpl = Template(footer, input_encoding='utf-8', output_encoding='utf-8') try: - foot = foot_mako_tpl.render( - helper=helper, + foot = foot_mako_tpl.render(helper=helper, css=css, _=self.translate_call, - **self.parser_instance.localcontext - ) + **self.parser_instance.localcontext) except Exception, e: raise Exception(exceptions.text_error_template().render()) if report_xml.webkit_debug : try: - deb = head_mako_tpl.render( - helper=helper, + deb = head_mako_tpl.render(helper=helper, css=css, _debug=html, _=self.translate_call, - **self.parser_instance.localcontext - ) + **self.parser_instance.localcontext) except Exception, e: raise Exception(exceptions.text_error_template().render()) return (deb, 'html') From 2c115e6856f5c6eb7f3d730b0ccfa028b386b009 Mon Sep 17 00:00:00 2001 From: Ronald Portier Date: Fri, 22 Jun 2012 16:19:32 +0200 Subject: [PATCH 04/48] [FIX] Problem with runaway cpu and/or postgres crash on analytic account analysis. lp bug: https://launchpad.net/bugs/1015995 fixed bzr revid: ronald@therp.nl-20120622141932-f6rywvd1nawn186w --- .../account_analytic_analysis.py | 54 +++++++------------ 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index 20c170cb5c0..cedcc9fa533 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -418,41 +418,25 @@ class account_analytic_account_summary_user(osv.osv): } def init(self, cr): - tools.sql.drop_view_if_exists(cr, 'account_analytic_analysis_summary_user') - cr.execute('CREATE OR REPLACE VIEW account_analytic_analysis_summary_user AS (' \ - 'SELECT ' \ - '(u.account_id * u.max_user) + u."user" AS id, ' \ - 'u.account_id AS account_id, ' \ - 'u."user" AS "user", ' \ - 'COALESCE(SUM(l.unit_amount), 0.0) AS unit_amount ' \ - 'FROM ' \ - '(SELECT ' \ - 'a.id AS account_id, ' \ - 'u1.id AS "user", ' \ - 'MAX(u2.id) AS max_user ' \ - 'FROM ' \ - 'res_users AS u1, ' \ - 'res_users AS u2, ' \ - 'account_analytic_account AS a ' \ - 'GROUP BY u1.id, a.id ' \ - ') AS u ' \ - 'LEFT JOIN ' \ - '(SELECT ' \ - 'l.account_id AS account_id, ' \ - 'l.user_id AS "user", ' \ - 'SUM(l.unit_amount) AS unit_amount ' \ - 'FROM account_analytic_line AS l, ' \ - 'account_analytic_journal AS j ' \ - 'WHERE (j.type = \'general\') and (j.id=l.journal_id) ' \ - 'GROUP BY l.account_id, l.user_id ' \ - ') AS l ' - 'ON (' \ - 'u.account_id = l.account_id ' \ - 'AND u."user" = l."user"' \ - ') ' \ - 'GROUP BY u."user", u.account_id, u.max_user' \ - ')') - + cr.execute('''CREATE OR REPLACE VIEW account_analytic_analysis_summary_user AS ( + with mu as + (select max(id) as max_user from res_users) + , lu AS + (SELECT + l.account_id AS account_id, + coalesce(l.user_id, 0) AS user_id, + SUM(l.unit_amount) AS unit_amount + FROM account_analytic_line AS l, + account_analytic_journal AS j + WHERE (j.type = 'general' ) and (j.id=l.journal_id) + GROUP BY l.account_id, l.user_id + ) + select (lu.account_id * mu.max_user) + lu.user_id as id, + lu.account_id as account_id, + lu.user_id as "user", + unit_amount + from lu, mu)''') + account_analytic_account_summary_user() class account_analytic_account_summary_month(osv.osv): From 6d9cf3fe2dd641fdffa7f5e816728b66d0ec3c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Mon, 16 Jul 2012 11:46:37 +0200 Subject: [PATCH 05/48] [IMP] point_of_sale: no scrollbar in fullscreen mode bzr revid: fva@openerp.com-20120716094637-n2mdh94pb147ggc0 --- addons/web/static/src/js/chrome.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 094e2f184e6..7830102f9f6 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1056,10 +1056,13 @@ instance.web.WebClient = instance.web.Widget.extend({ } }, set_content_full_screen: function(fullscreen) { - if (fullscreen) + if (fullscreen){ $(".oe_webclient", this.$element).addClass("oe_content_full_screen"); - else + $("body").css({'overflow-y':'hidden'}); + }else{ $(".oe_webclient", this.$element).removeClass("oe_content_full_screen"); + $("body").css({'overflow-y':'scroll'}); + } } }); From 31621f412a76cdaa04b866d94d94fe0e96f24a12 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Wed, 25 Jul 2012 16:13:33 +0200 Subject: [PATCH 06/48] wip bzr revid: nicolas.vanhoren@openerp.com-20120725141333-ueaj3e0i8imlwvre --- addons/web/static/src/js/corelib.js | 12 ++++++---- addons/web/static/src/js/view_form.js | 33 +++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/addons/web/static/src/js/corelib.js b/addons/web/static/src/js/corelib.js index 1ed4c4788e3..a092b670ef1 100644 --- a/addons/web/static/src/js/corelib.js +++ b/addons/web/static/src/js/corelib.js @@ -378,7 +378,8 @@ instance.web.PropertiesMixin = _.extend({}, instance.web.EventDispatcherMixin, { instance.web.EventDispatcherMixin.init.call(this); this.__getterSetterInternalMap = {}; }, - set: function(map) { + set: function(map, options) { + options = options || {}; var self = this; var changed = false; _.each(map, function(val, key) { @@ -387,10 +388,11 @@ instance.web.PropertiesMixin = _.extend({}, instance.web.EventDispatcherMixin, { return; changed = true; self.__getterSetterInternalMap[key] = val; - self.trigger("change:" + key, self, { - oldValue: tmp, - newValue: val - }); + if (! options.silent) + self.trigger("change:" + key, self, { + oldValue: tmp, + newValue: val + }); }); if (changed) self.trigger("change", self); diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index f8f09ae2762..7c2ad5cfaf3 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -33,6 +33,14 @@ instance.web.form.FieldManagerMixin = { }; instance.web.views.add('form', 'instance.web.FormView'); +/** + * Properties: + * - mode: always "view" or "edit". Used to switch the view between page (view) and + * form (edit) mode. Depending what is indicated in the dataset, the view can still + * switch to create mode if needed. + * - actual_mode: always "view", "edit" or "create". Read-only property. Determines + * the real mode used by the view. + */ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerMixin, { /** * Indicates that this view is not searchable, and thus that no search @@ -82,6 +90,8 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.__blur_timeout = null; this.rendering_engine = new instance.web.form.FormRenderingEngine(this); this.qweb = null; // A QWeb instance will be created if the view is a QWeb template + this.on("change:mode", this, this._check_mode); + this.set({mode: "view"}); }, destroy: function() { _.each(this.get_widgets(), function(w) { @@ -91,6 +101,16 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.$element.off('.formBlur'); this._super(); }, + /** + * Reactualize actual_mode. + */ + _check_mode: function(options) { + options = options || {}; + var mode = this.get("mode"); + if (mode === "edit" && ! this.datarecord.id) + mode = "create"; + this.set({actual_mode: mode}, options); + }, on_loaded: function(data) { var self = this; if (!data) { @@ -149,8 +169,10 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM { label: _t('Set Default'), callback: function (item) { self.open_defaults_dialog(); } }, ]); } - this.on("change:mode", this, this.switch_mode); - this.set({mode: this.options.initial_mode}); + this.on("change:actual_mode", this, this.switch_mode); + this.set({mode: this.options.initial_mode}, {silent: true}); + this._check_mode({silent: true}); + this.switch_mode(); this.has_been_loaded.resolve(); return $.when(); }, @@ -300,6 +322,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM return $.Deferred().reject(); } this.datarecord = record; + this._check_mode(); this.set({ 'title' : record.id ? record.name : "New record" }); if (this.qweb) { @@ -576,9 +599,9 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM return $.Deferred().reject(); } }, - switch_mode: function() { + switch_mode: function(source, options) { var self = this; - if(this.get("mode") == "view") { + if(this.get("actual_mode") === "view") { self.$element.removeClass('oe_form_editable').addClass('oe_form_readonly'); self.$buttons.find('.oe_form_buttons_edit').hide(); self.$buttons.find('.oe_form_buttons_view').show(); @@ -957,7 +980,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM return this.fields_view.fields[field_name]; }, is_create_mode: function() { - return !this.datarecord.id; + return this.get("actual_mode") === "create"; }, open_translate_dialog: function(field) { return this._super(field); From fe8b2937c9e8652d5726c4fe74d0c51024923362 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Wed, 25 Jul 2012 16:18:32 +0200 Subject: [PATCH 07/48] Solved problems with switch_mode bzr revid: nicolas.vanhoren@openerp.com-20120725141832-4zqw6g0zf9m4hfro --- addons/web/static/src/js/view_form.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 7c2ad5cfaf3..5ba4dfcea54 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -63,6 +63,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM * @property {instance.web.Registry} registry=instance.web.form.widgets widgets registry for this form view instance */ init: function(parent, dataset, view_id, options) { + var self = this; this._super(parent); this.set_default_options(options); this.dataset = dataset; @@ -92,6 +93,11 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.qweb = null; // A QWeb instance will be created if the view is a QWeb template this.on("change:mode", this, this._check_mode); this.set({mode: "view"}); + this.has_been_loaded.then(function() { + self.switch_mode(); + self.on("change:actual_mode", self, self.switch_mode); + self.set({mode: self.options.initial_mode}); + }); }, destroy: function() { _.each(this.get_widgets(), function(w) { @@ -104,12 +110,11 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM /** * Reactualize actual_mode. */ - _check_mode: function(options) { - options = options || {}; + _check_mode: function() { var mode = this.get("mode"); if (mode === "edit" && ! this.datarecord.id) mode = "create"; - this.set({actual_mode: mode}, options); + this.set({actual_mode: mode}); }, on_loaded: function(data) { var self = this; @@ -169,10 +174,6 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM { label: _t('Set Default'), callback: function (item) { self.open_defaults_dialog(); } }, ]); } - this.on("change:actual_mode", this, this.switch_mode); - this.set({mode: this.options.initial_mode}, {silent: true}); - this._check_mode({silent: true}); - this.switch_mode(); this.has_been_loaded.resolve(); return $.when(); }, From e406b7759ae4fe6240f8ab2c04edd4b163ea1c9c Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Wed, 25 Jul 2012 16:31:50 +0200 Subject: [PATCH 08/48] Fixed problem with m2mtags bzr revid: nicolas.vanhoren@openerp.com-20120725143150-x6u8pfira3wbc8mg --- addons/web/static/src/js/view_form.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 5ba4dfcea54..6d55ad40378 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -94,8 +94,8 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.on("change:mode", this, this._check_mode); this.set({mode: "view"}); this.has_been_loaded.then(function() { - self.switch_mode(); - self.on("change:actual_mode", self, self.switch_mode); + self.check_actual_mode(); + self.on("change:actual_mode", self, self.check_actual_mode); self.set({mode: self.options.initial_mode}); }); }, @@ -112,7 +112,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM */ _check_mode: function() { var mode = this.get("mode"); - if (mode === "edit" && ! this.datarecord.id) + if (! this.datarecord.id) mode = "create"; this.set({actual_mode: mode}); }, @@ -600,7 +600,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM return $.Deferred().reject(); } }, - switch_mode: function(source, options) { + check_actual_mode: function(source, options) { var self = this; if(this.get("actual_mode") === "view") { self.$element.removeClass('oe_form_editable').addClass('oe_form_readonly'); @@ -3563,12 +3563,13 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in render_value: function() { var self = this; var dataset = new instance.web.DataSetStatic(this, this.field.relation, self.view.dataset.get_context()); + var values = self.get("value") var handle_names = function(data) { var indexed = {}; _.each(data, function(el) { indexed[el[0]] = el; }); - data = _.map(self.get("value"), function(el) { return indexed[el]; }); + data = _.map(values, function(el) { return indexed[el]; }); if (! self.get("effective_readonly")) { self.tags.containerElement().children().remove(); $("textarea", self.$element).css("padding-left", "3px"); @@ -3577,8 +3578,8 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in self.$element.html(QWeb.render("FieldMany2ManyTag", {elements: data})); } }; - if (! self.get('values') || self.get('values').length > 0) { - this._display_orderer.add(dataset.name_get(self.get("value"))).then(handle_names); + if (! values || values.length > 0) { + this._display_orderer.add(dataset.name_get(values)).then(handle_names); } else { handle_names([]); } From 0d84cf675524e650cc4f63bca8973bd8ed6e908a Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Thu, 26 Jul 2012 14:31:25 +0530 Subject: [PATCH 09/48] [IMP]sale : made send buttons red at draft state bzr revid: cha@tinyerp.com-20120726090125-50nwqvimqgb82lej --- addons/sale/sale_view.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index ac665df7a6b..a73f7744e53 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -156,9 +156,11 @@ - + or + + Cancel + + + + + + + + + + or Cancel + + this.attr('t-if', 'views.length != 1'); @@ -1243,7 +1282,6 @@ - @@ -1268,7 +1306,6 @@

(Any existing filter with the same name will be replaced)

- @@ -1465,49 +1502,6 @@ - -
-
- - - - - - -
- -
-
-
-
- -
- - - - or - - Cancel - - - - - - - - - - or Cancel - - - - - - - @@ -1572,6 +1566,7 @@ + Export From b65161c4ead5ac5aac3090f195424acee8c79415 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Thu, 26 Jul 2012 11:19:20 +0200 Subject: [PATCH 12/48] o2m popup rename cancel in discard bzr revid: al@openerp.com-20120726091920-1rnj1vw8ef1j8w98 --- addons/web/static/src/xml/base.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index bb25ffa99a9..55353f0a748 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1227,7 +1227,7 @@ - or Cancel + or Discard From c59c7f323748ef3c81ea8c4d8bde638d43caab4e Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Thu, 26 Jul 2012 11:26:18 +0200 Subject: [PATCH 13/48] [FIX] listview dont show sidebar by default bzr revid: al@openerp.com-20120726092618-atzkidy1gpd25n6w --- addons/web/static/src/js/view_list.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 53a8c0126b2..485b4e8d59b 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -357,6 +357,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi { label: _t('Delete'), callback: this.do_delete_selected }, ]); this.sidebar.add_toolbar(this.fields_view.toolbar); + this.sidebar.$element.hide(); } }, /** @@ -493,9 +494,6 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi }, do_show: function () { this._super(); - if (this.sidebar) { - this.sidebar.$element.show(); - } if (this.$buttons) { this.$buttons.show(); } From dd7e7d2c56512989b17533c3eaa12cb4b754a714 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 26 Jul 2012 11:51:04 +0200 Subject: [PATCH 14/48] Removed mode in favor of actual_mode bzr revid: nicolas.vanhoren@openerp.com-20120726095104-txzid0fb9tn3t1ne --- addons/web/static/src/js/view_form.js | 41 +++++++++++++++------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 6d55ad40378..52c12407688 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -91,12 +91,11 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.__blur_timeout = null; this.rendering_engine = new instance.web.form.FormRenderingEngine(this); this.qweb = null; // A QWeb instance will be created if the view is a QWeb template - this.on("change:mode", this, this._check_mode); - this.set({mode: "view"}); + this.set({actual_mode: "view"}); this.has_been_loaded.then(function() { self.check_actual_mode(); self.on("change:actual_mode", self, self.check_actual_mode); - self.set({mode: self.options.initial_mode}); + self.set({actual_mode: self.options.initial_mode}); }); }, destroy: function() { @@ -107,15 +106,6 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.$element.off('.formBlur'); this._super(); }, - /** - * Reactualize actual_mode. - */ - _check_mode: function() { - var mode = this.get("mode"); - if (! this.datarecord.id) - mode = "create"; - this.set({actual_mode: mode}); - }, on_loaded: function(data) { var self = this; if (!data) { @@ -298,7 +288,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM } return shown.pipe(function() { if (options.editable) { - self.set({mode: "edit"}); + self.to_edit_mode(); } self.$element.css('visibility', 'visible'); }); @@ -600,6 +590,21 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM return $.Deferred().reject(); } }, + to_view_mode: function() { + this._check_mode("view"); + }, + to_edit_mode: function() { + this._check_mode("edit"); + }, + /** + * Reactualize actual_mode. + */ + _check_mode: function(switch_to) { + var mode = switch_to || this.get("actual_mode"); + if (! this.datarecord.id) + mode = "create"; + this.set({actual_mode: mode}); + }, check_actual_mode: function(source, options) { var self = this; if(this.get("actual_mode") === "view") { @@ -633,19 +638,19 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM on_button_save: function() { var self = this; return this.do_save().then(function(result) { - self.set({mode: "view"}); + self.to_view_mode(); }); }, on_button_cancel: function(event) { if (this.can_be_discarded()) { - this.set({mode: "view"}); + this.to_view_mode(); this.on_record_loaded(this.datarecord); } return false; }, on_button_new: function() { var self = this; - this.set({mode: "edit"}); + this.to_edit_mode(); return $.when(this.has_been_loaded).pipe(function() { if (self.can_be_discarded()) { return self.load_defaults(); @@ -653,7 +658,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM }); }, on_button_edit: function() { - return this.set({mode: "edit"}); + return this.to_edit_mode(); }, on_button_create: function() { this.dataset.index = null; @@ -666,7 +671,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM self.dataset.call('copy', [self.datarecord.id, {}, self.dataset.context]).then(function(new_id) { return self.on_created({ result : new_id }); }).then(function() { - return self.set({mode: "edit"}); + return self.to_edit_mode(); }).then(function() { def.resolve(); }); From 5d80e9a3e7dbc88ebb4c36557dee666083295524 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 26 Jul 2012 11:52:31 +0200 Subject: [PATCH 15/48] Small optimization bzr revid: nicolas.vanhoren@openerp.com-20120726095231-k30uufa9ny2bo28h --- addons/web/static/src/js/view_form.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 52c12407688..5f65affce90 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -91,11 +91,10 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.__blur_timeout = null; this.rendering_engine = new instance.web.form.FormRenderingEngine(this); this.qweb = null; // A QWeb instance will be created if the view is a QWeb template - this.set({actual_mode: "view"}); + self.set({actual_mode: self.options.initial_mode}); this.has_been_loaded.then(function() { - self.check_actual_mode(); self.on("change:actual_mode", self, self.check_actual_mode); - self.set({actual_mode: self.options.initial_mode}); + self.check_actual_mode(); }); }, destroy: function() { From f6e615cedc37bf91ee609aa9bd9120a6bd46e017 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 26 Jul 2012 11:56:53 +0200 Subject: [PATCH 16/48] Changed my mind about method naming bzr revid: nicolas.vanhoren@openerp.com-20120726095653-bi90exba20x8gu4n --- addons/web/static/src/js/view_form.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 5f65affce90..2968fe368dc 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -312,7 +312,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM return $.Deferred().reject(); } this.datarecord = record; - this._check_mode(); + this._actualize_mode(); this.set({ 'title' : record.id ? record.name : "New record" }); if (this.qweb) { @@ -590,15 +590,15 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM } }, to_view_mode: function() { - this._check_mode("view"); + this._actualize_mode("view"); }, to_edit_mode: function() { - this._check_mode("edit"); + this._actualize_mode("edit"); }, /** * Reactualize actual_mode. */ - _check_mode: function(switch_to) { + _actualize_mode: function(switch_to) { var mode = switch_to || this.get("actual_mode"); if (! this.datarecord.id) mode = "create"; From 49892307b7708b8901d48da7152de80c793351b7 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Thu, 26 Jul 2012 12:08:35 +0200 Subject: [PATCH 17/48] [FIX] disable red button of kanban in popups bzr revid: al@openerp.com-20120726100835-j0ol9h0wencpp037 --- addons/web_kanban/static/src/css/kanban.css | 42 +++++++++++++++++++ addons/web_kanban/static/src/css/kanban.sass | 26 ++++++++++++ .../web_kanban/static/src/xml/web_kanban.xml | 2 +- 3 files changed, 69 insertions(+), 1 deletion(-) diff --git a/addons/web_kanban/static/src/css/kanban.css b/addons/web_kanban/static/src/css/kanban.css index 51cdc568a1e..a6f2cc7441b 100644 --- a/addons/web_kanban/static/src/css/kanban.css +++ b/addons/web_kanban/static/src/css/kanban.css @@ -1,3 +1,4 @@ +@charset "utf-8"; .openerp .oe_kanban_view { background: url(/web/static/src/img/form_sheetbg.png); height: inherit; @@ -525,3 +526,44 @@ padding: 0px; background: white; } + +.openerp .oe_popup_form .oe_kanban_buttons .oe_highlight { + color: #404040; + background: none; +} +.openerp .oe_popup_form .oe_kanban_buttons button.oe_highlight { + background-color: #efefef; + background-image: -webkit-gradient(linear, left top, left bottom, from(#efefef), to(#d8d8d8)); + background-image: -webkit-linear-gradient(top, #efefef, #d8d8d8); + background-image: -moz-linear-gradient(top, #efefef, #d8d8d8); + background-image: -ms-linear-gradient(top, #efefef, #d8d8d8); + background-image: -o-linear-gradient(top, #efefef, #d8d8d8); + background-image: linear-gradient(to bottom, #efefef, #d8d8d8); + -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; + -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; +} +.openerp .oe_popup_form .oe_kanban_buttons button.oe_highlight:active { + background-color: #e3e3e3; + background-image: -webkit-gradient(linear, left top, left bottom, from(#e3e3e3), to(#f6f6f6)); + background-image: -webkit-linear-gradient(top, #e3e3e3, #f6f6f6); + background-image: -moz-linear-gradient(top, #e3e3e3, #f6f6f6); + background-image: -ms-linear-gradient(top, #e3e3e3, #f6f6f6); + background-image: -o-linear-gradient(top, #e3e3e3, #f6f6f6); + background-image: linear-gradient(to bottom, #e3e3e3, #f6f6f6); + -moz-box-shadow: none; + -webkit-box-shadow: none; + -box-shadow: none; +} +.openerp .oe_popup_form .oe_kanban_buttons button.oe_highlight:hover { + background-color: #f6f6f6; + background-image: -webkit-gradient(linear, left top, left bottom, from(#f6f6f6), to(#e3e3e3)); + background-image: -webkit-linear-gradient(top, #f6f6f6, #e3e3e3); + background-image: -moz-linear-gradient(top, #f6f6f6, #e3e3e3); + background-image: -ms-linear-gradient(top, #f6f6f6, #e3e3e3); + background-image: -o-linear-gradient(top, #f6f6f6, #e3e3e3); + background-image: linear-gradient(to bottom, #f6f6f6, #e3e3e3); + -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; + -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; +} diff --git a/addons/web_kanban/static/src/css/kanban.sass b/addons/web_kanban/static/src/css/kanban.sass index 6478ea5b213..7175b398cbe 100644 --- a/addons/web_kanban/static/src/css/kanban.sass +++ b/addons/web_kanban/static/src/css/kanban.sass @@ -1,6 +1,15 @@ @charset "utf-8" // Mixins {{{ +@mixin vertical-gradient($startColor: #555, $endColor: #333) + background-color: $startColor + background-image: -webkit-gradient(linear, left top, left bottom, from($startColor), to($endColor)) /* Saf4+, Chrome */ + background-image: -webkit-linear-gradient(top, $startColor, $endColor) /* Chrome 10+, Saf5.1+, iOS 5+ */ + background-image: -moz-linear-gradient(top, $startColor, $endColor) /* FF3.6 */ + background-image: -ms-linear-gradient(top, $startColor, $endColor) /* IE10 */ + background-image: -o-linear-gradient(top, $startColor, $endColor) /* Opera 11.10+ */ + background-image: linear-gradient(to bottom, $startColor, $endColor) + @mixin radial-gradient($gradient) background-position: center center background-image: -webkit-radial-gradient(circle, $gradient) @@ -439,5 +448,22 @@ padding: 0px background: #ffffff +.openerp + .oe_popup_form + .oe_kanban_buttons + .oe_highlight + color: #404040 + background: none + button.oe_highlight + @include vertical-gradient(#efefef, #d8d8d8) + @include box-shadow((0 1px 2px rgba(0, 0, 0, .1), 0 1px 1px rgba(255, 255, 255, .8) inset)) + button.oe_highlight:active + @include vertical-gradient(#e3e3e3, #f6f6f6) + @include box-shadow(none) + button.oe_highlight:hover + @include vertical-gradient(#f6f6f6, #e3e3e3) + @include box-shadow((0 1px 2px rgba(0, 0, 0, .1), 0 1px 1px rgba(255, 255, 255, .8) inset)) + + // au BufWritePost,FileWritePost *.sass :!sass --style expanded --line-numbers > "%:p:r.css" // vim:tabstop=4:shiftwidth=4:softtabstop=4:fdm=marker: diff --git a/addons/web_kanban/static/src/xml/web_kanban.xml b/addons/web_kanban/static/src/xml/web_kanban.xml index 7eb453371b2..820189c7b27 100644 --- a/addons/web_kanban/static/src/xml/web_kanban.xml +++ b/addons/web_kanban/static/src/xml/web_kanban.xml @@ -13,7 +13,7 @@
- From 712897852dd01e0e93d5dc33ee13d554ee92e51c Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 26 Jul 2012 12:27:19 +0200 Subject: [PATCH 18/48] [IMP] corrected some code documentation bzr revid: nicolas.vanhoren@openerp.com-20120726102719-ct3c5tx06izemg21 --- addons/web/static/src/js/view_form.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 39dc321f97d..4426c93c619 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -35,11 +35,8 @@ instance.web.form.FieldManagerMixin = { instance.web.views.add('form', 'instance.web.FormView'); /** * Properties: - * - mode: always "view" or "edit". Used to switch the view between page (view) and - * form (edit) mode. Depending what is indicated in the dataset, the view can still - * switch to create mode if needed. * - actual_mode: always "view", "edit" or "create". Read-only property. Determines - * the real mode used by the view. + * the mode used by the view. */ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerMixin, { /** @@ -598,9 +595,17 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM return $.Deferred().reject(); } }, + /** + * Ask the view to switch to view mode if possible. The view may not do it + * if the current record is not yet saved. It will then stay in create mode. + */ to_view_mode: function() { this._actualize_mode("view"); }, + /** + * Ask the view to switch to edit mode if possible. The view may not do it + * if the current record is not yet saved. It will then stay in create mode. + */ to_edit_mode: function() { this._actualize_mode("edit"); }, From a2154e35b61a5ab3845226697a27e29e54cbd8e8 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Thu, 26 Jul 2012 12:59:30 +0200 Subject: [PATCH 19/48] [FIX] stock,delivery: rename 'Create Invoice' to 'Create Invoice/Refund' bzr revid: stw@openerp.com-20120726105930-ls0u5zfpfh9u64vr --- addons/delivery/delivery_view.xml | 2 +- addons/stock/stock_view.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/delivery/delivery_view.xml b/addons/delivery/delivery_view.xml index 457b2d38c90..77c456a3930 100644 --- a/addons/delivery/delivery_view.xml +++ b/addons/delivery/delivery_view.xml @@ -299,7 +299,7 @@ stock.picking - +