From 271885716f7303551d74e0989183e5f27d35da54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=C3=ABl=20Closson?= Date: Tue, 3 Jun 2014 16:19:05 +0200 Subject: [PATCH 01/10] [FIX] sale: cannot filter on paid = False --- addons/sale/sale.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 0664b6521c1..dc79c435ee0 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -128,13 +128,12 @@ class sale_order(osv.osv): sale_clause = '' no_invoiced = False for arg in args: - if arg[1] == '=': - if arg[2]: - clause += 'AND inv.state = \'paid\'' - else: - clause += 'AND inv.state != \'cancel\' AND sale.state != \'cancel\' AND inv.state <> \'paid\' AND rel.order_id = sale.id ' - sale_clause = ', sale_order AS sale ' - no_invoiced = True + if (arg[1] == '=' and arg[2]) or (arg[1] == '!=' and not arg[2]): + clause += 'AND inv.state = \'paid\'' + else: + clause += 'AND inv.state != \'cancel\' AND sale.state != \'cancel\' AND inv.state <> \'paid\' AND rel.order_id = sale.id ' + sale_clause = ', sale_order AS sale ' + no_invoiced = True cursor.execute('SELECT rel.order_id ' \ 'FROM sale_order_invoice_rel AS rel, account_invoice AS inv '+ sale_clause + \ From 9b0d8c050380cedec45128dc45f245f3394aa344 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 18 Jun 2014 10:24:37 +0200 Subject: [PATCH 02/10] [FIX] Session Expired message in backend --- openerp/addons/base/ir/ir_http.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/openerp/addons/base/ir/ir_http.py b/openerp/addons/base/ir/ir_http.py index bd211d14cb8..13997c6cd2f 100644 --- a/openerp/addons/base/ir/ir_http.py +++ b/openerp/addons/base/ir/ir_http.py @@ -98,11 +98,13 @@ class ir_http(osv.AbstractModel): # check authentication level try: auth_method = self._authenticate(func.routing["auth"]) - except Exception: - # force a Forbidden exception with the original traceback - return self._handle_exception( - convert_exception_to( - werkzeug.exceptions.Forbidden)) + except Exception, e: + # Json requests have their own exception handler + # therefore we should not alter their exception's type + if func.routing.get('type') != 'json': + # for the rest, convert to a Forbidden exception keeping the original traceback + e = convert_exception_to(werkzeug.exceptions.Forbidden) + return self._handle_exception(e) processing = self._postprocess_args(arguments) if processing: From 624f256f61b1a766463398ebdb2d989bd7eaf938 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 18 Jun 2014 14:31:16 +0200 Subject: [PATCH 03/10] Changed as per the recommandation of Sir Odo --- openerp/addons/base/ir/ir_http.py | 33 ++++++++++++++++--------------- openerp/http.py | 13 ++++++++++-- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/openerp/addons/base/ir/ir_http.py b/openerp/addons/base/ir/ir_http.py index 13997c6cd2f..4b488103060 100644 --- a/openerp/addons/base/ir/ir_http.py +++ b/openerp/addons/base/ir/ir_http.py @@ -71,17 +71,23 @@ class ir_http(osv.AbstractModel): request.uid = request.session.uid def _authenticate(self, auth_method='user'): - if request.session.uid: - try: - request.session.check_security() - # what if error in security.check() - # -> res_users.check() - # -> res_users.check_credentials() - except (openerp.exceptions.AccessDenied, openerp.http.SessionExpiredException): - # All other exceptions mean undetermined status (e.g. connection pool full), - # let them bubble up - request.session.logout() - getattr(self, "_auth_method_%s" % auth_method)() + try: + if request.session.uid: + try: + request.session.check_security() + # what if error in security.check() + # -> res_users.check() + # -> res_users.check_credentials() + except (openerp.exceptions.AccessDenied, openerp.http.SessionExpiredException): + # All other exceptions mean undetermined status (e.g. connection pool full), + # let them bubble up + request.session.logout() + getattr(self, "_auth_method_%s" % auth_method)() + except (openerp.exceptions.AccessDenied, openerp.http.SessionExpiredException): + raise + except Exception: + _logger.exception("Exception during request Authentication.") + raise openerp.exceptions.AccessDenied() return auth_method def _handle_exception(self, exception): @@ -99,11 +105,6 @@ class ir_http(osv.AbstractModel): try: auth_method = self._authenticate(func.routing["auth"]) except Exception, e: - # Json requests have their own exception handler - # therefore we should not alter their exception's type - if func.routing.get('type') != 'json': - # for the rest, convert to a Forbidden exception keeping the original traceback - e = convert_exception_to(werkzeug.exceptions.Forbidden) return self._handle_exception(e) processing = self._postprocess_args(arguments) diff --git a/openerp/http.py b/openerp/http.py index ec979fd1793..3bc2bc3c8ea 100644 --- a/openerp/http.py +++ b/openerp/http.py @@ -208,8 +208,6 @@ class WebRequest(object): to abitrary responses. Anything returned (except None) will be used as response.""" self._failed = exception # prevent tx commit - if isinstance(exception, werkzeug.exceptions.HTTPException): - return exception raise def _call_function(self, *args, **kwargs): @@ -456,6 +454,17 @@ class HttpRequest(WebRequest): params.pop('session_id', None) self.params = params + def _handle_exception(self, exception): + """Called within an except block to allow converting exceptions + to abitrary responses. Anything returned (except None) will + be used as response.""" + try: + return super(HttpRequest, self)._handle_exception(exception) + except Exception, e: + if isinstance(e, werkzeug.exceptions.HTTPException): + return e + raise + def dispatch(self): # TODO: refactor this correctly. This is a quick fix for pos demo. if request.httprequest.method == 'OPTIONS' and request.func and request.func.routing.get('cors'): From 4c785069bc16257c568e65e601d3808fe8248546 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 18 Jun 2014 15:40:09 +0200 Subject: [PATCH 04/10] Bring back exception conversion to Forbidden --- openerp/addons/base/ir/ir_http.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openerp/addons/base/ir/ir_http.py b/openerp/addons/base/ir/ir_http.py index 4b488103060..867abf178dc 100644 --- a/openerp/addons/base/ir/ir_http.py +++ b/openerp/addons/base/ir/ir_http.py @@ -105,7 +105,10 @@ class ir_http(osv.AbstractModel): try: auth_method = self._authenticate(func.routing["auth"]) except Exception, e: - return self._handle_exception(e) + # force a Forbidden exception with the original traceback + return self._handle_exception( + convert_exception_to( + werkzeug.exceptions.Forbidden)) processing = self._postprocess_args(arguments) if processing: From fef8077df31988f984d8f80ce8050a05bbe145eb Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 18 Jun 2014 16:56:46 +0200 Subject: [PATCH 05/10] git commit -a -mm --- openerp/addons/base/ir/ir_http.py | 2 +- openerp/http.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/openerp/addons/base/ir/ir_http.py b/openerp/addons/base/ir/ir_http.py index 867abf178dc..122b9d9bb26 100644 --- a/openerp/addons/base/ir/ir_http.py +++ b/openerp/addons/base/ir/ir_http.py @@ -104,7 +104,7 @@ class ir_http(osv.AbstractModel): # check authentication level try: auth_method = self._authenticate(func.routing["auth"]) - except Exception, e: + except Exception: # force a Forbidden exception with the original traceback return self._handle_exception( convert_exception_to( diff --git a/openerp/http.py b/openerp/http.py index 3bc2bc3c8ea..d32d00326f7 100644 --- a/openerp/http.py +++ b/openerp/http.py @@ -460,10 +460,8 @@ class HttpRequest(WebRequest): be used as response.""" try: return super(HttpRequest, self)._handle_exception(exception) - except Exception, e: - if isinstance(e, werkzeug.exceptions.HTTPException): - return e - raise + except werkzeug.exceptions.HTTPException, e: + return e def dispatch(self): # TODO: refactor this correctly. This is a quick fix for pos demo. From bccd75796e8ff3c9dee23dd3f9a8ce75274e3289 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 20 Jun 2014 14:04:52 +0200 Subject: [PATCH 06/10] [IMP] web: allow fields in list view to use the attrs readonly to dynamically show and hide the fields --- addons/web/static/src/css/base.css | 18 +++++++++++++++--- addons/web/static/src/css/base.sass | 13 +++++++++++-- addons/web/static/src/js/view_form.js | 7 +++++-- addons/web/static/src/js/view_list_editable.js | 17 +++++++---------- 4 files changed, 38 insertions(+), 17 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 7c2bc81b9e3..2b08a7c06f4 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -2815,11 +2815,11 @@ .openerp .oe_list_editable .oe_list_content td.oe_list_field_cell { padding: 4px 6px 3px; } -.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) { +.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell { color: transparent; text-shadow: none; } -.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) * { +.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell * { visibility: hidden; } .openerp .oe_list.oe_list_editable.oe_editing .oe_m2o_drop_down_button { @@ -2835,6 +2835,13 @@ min-width: 0; max-width: none; } +.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_list_field_handle { + color: transparent; +} +.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_readonly { + padding: 4px 6px 3px; + text-align: left; +} .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field textarea { height: 27px; -moz-border-radius: 0; @@ -2846,9 +2853,14 @@ .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field textarea, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field select { min-width: 0; } -.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_float input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_view_integer input { +.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_float.oe_readonly, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_view_integer.oe_readonly { + padding: 6px 0px 0px; text-align: right; + max-width: 100px; +} +.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_float input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_view_integer input { width: 100% !important; + text-align: right; } .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_datetime input.oe_datepicker_master, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_date input.oe_datepicker_master { width: 100% !important; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 1c02018da9d..bdb358af6a0 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2218,7 +2218,7 @@ $sheet-padding: 16px .oe_list_editable .oe_list_content td.oe_list_field_cell padding: 4px 6px 3px .oe_list.oe_list_editable.oe_editing - .oe_edition .oe_list_field_cell:not(.oe_readonly) + .oe_edition .oe_list_field_cell * visibility: hidden color: transparent @@ -2230,6 +2230,11 @@ $sheet-padding: 16px .oe_input_icon margin-top: 5px .oe_form_field + &.oe_list_field_handle + color: transparent + &.oe_readonly + padding: 4px 6px 3px + text-align: left min-width: 0 max-width: none input, textarea @@ -2240,9 +2245,13 @@ $sheet-padding: 16px input, textarea, select min-width: 0 &.oe_form_field_float,&.oe_form_view_integer - input + &.oe_readonly + padding: 6px 0px 0px text-align: right + max-width: 100px + input width: 100% !important + text-align: right &.oe_form_field_datetime,&.oe_form_field_date input.oe_datepicker_master width: 100% !important diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index fec7ce10607..cbaf9e6f11e 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2600,7 +2600,9 @@ instance.web.form.FieldDatetime = instance.web.form.AbstractField.extend(instanc }, set_dimensions: function (height, width) { this._super(height, width); - this.datewidget.$input.css('height', height); + if (!this.get("effective_readonly")) { + this.datewidget.$input.css('height', height); + } } }); @@ -3395,7 +3397,8 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc }, set_dimensions: function (height, width) { this._super(height, width); - this.$input.css('height', height); + if (!this.get("effective_readonly") && this.$input) + this.$input.css('height', height); } }); diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index 7d2e44263ce..f3ee5dbb7ad 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -282,9 +282,7 @@ openerp.web.list_editable = function (instance) { if (!this.editor.is_editing()) { return; } for(var i=0, len=this.fields_for_resize.length; i Date: Fri, 20 Jun 2014 14:21:05 +0200 Subject: [PATCH 07/10] [REM] Old .bzrignore file --- addons/.bzrignore | 1 - 1 file changed, 1 deletion(-) delete mode 100644 addons/.bzrignore diff --git a/addons/.bzrignore b/addons/.bzrignore deleted file mode 100644 index 8d98f9debde..00000000000 --- a/addons/.bzrignore +++ /dev/null @@ -1 +0,0 @@ -.* From 86c24265551920dd837703a7f058970676e62c24 Mon Sep 17 00:00:00 2001 From: Ruchir Shukla Date: Fri, 20 Jun 2014 17:36:26 +0200 Subject: [PATCH 08/10] [IMP] module: warning when uninstalling modules When a module is uninstalled, this will also uninstall modules depending of it. To avoid unexpected loss of data, this patch list the modules that will get impacted during the installation. This also affects the configuration pages with on change warnings. --- openerp/addons/base/module/module.py | 1 + openerp/addons/base/module/module_view.xml | 3 +- .../base/module/wizard/base_module_upgrade.py | 14 +++++++ .../wizard/base_module_upgrade_view.xml | 9 +++-- openerp/addons/base/res/res_config.py | 38 +++++++++++++++++++ 5 files changed, 59 insertions(+), 6 deletions(-) diff --git a/openerp/addons/base/module/module.py b/openerp/addons/base/module/module.py index 6d64abc455b..89285bdbf4f 100644 --- a/openerp/addons/base/module/module.py +++ b/openerp/addons/base/module/module.py @@ -485,6 +485,7 @@ class module(osv.osv): 'params': {'menu_id': menu_ids and menu_ids[0] or False} } + #TODO remove me in master, not called anymore def button_immediate_uninstall(self, cr, uid, ids, context=None): """ Uninstall the selected module(s) immediately and fully, diff --git a/openerp/addons/base/module/module_view.xml b/openerp/addons/base/module/module_view.xml index 3923c9de3bd..fb4295cda68 100644 --- a/openerp/addons/base/module/module_view.xml +++ b/openerp/addons/base/module/module_view.xml @@ -78,8 +78,7 @@