From 27405c0c83b05e9239eb76550004732776fc5e6a Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 11 Mar 2014 21:52:20 +0100 Subject: [PATCH 01/19] [FIX] ensure_db() werkzeug.BaseResponse.url usage leads to encoded hashes loss bzr revid: fme@openerp.com-20140311205220-kk0pal10lodurcst --- addons/web/controllers/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index d13226ca731..0074a88ba9c 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -141,7 +141,12 @@ def ensure_db(redirect='/web/database/selector'): # Thus, we redirect the user to the same page but with the session cookie set. # This will force using the database route dispatcher... r = request.httprequest - response = werkzeug.utils.redirect(r.url, 302) + url_redirect = r.base_url + if r.query_string: + # Can't use werkzeug.wrappers.BaseRequest.url with encoded hashes: + # https://github.com/amigrave/werkzeug/commit/b4a62433f2f7678c234cdcac6247a869f90a7eb7 + url_redirect += '?' + r.query_string + response = werkzeug.utils.redirect(url_redirect, 302) request.session.db = db response = r.app.get_response(r, response, explicit_session=False) werkzeug.exceptions.abort(response) From 9684f077358091c0eccf30abb2dfecd83fb0eb4a Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 11 Mar 2014 21:53:37 +0100 Subject: [PATCH 02/19] [FIX] signup_url_for_action(), use `redirect` url parameter and bring back `action` in fragment bzr revid: fme@openerp.com-20140311205337-9vasnqx5cudbk3f3 --- addons/auth_signup/res_users.py | 11 ++++++++--- addons/portal/mail_mail.py | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/addons/auth_signup/res_users.py b/addons/auth_signup/res_users.py index e91af657cc2..32aa22b2744 100644 --- a/addons/auth_signup/res_users.py +++ b/addons/auth_signup/res_users.py @@ -20,8 +20,8 @@ ############################################################################## from datetime import datetime, timedelta import random -from urllib import urlencode from urlparse import urljoin +import werkzeug from openerp.addons.base.ir.ir_mail_server import MailDeliveryException from openerp.osv import osv, fields @@ -53,7 +53,7 @@ class res_partner(osv.Model): (not partner.signup_expiration or dt <= partner.signup_expiration) return res - def _get_signup_url_for_action(self, cr, uid, ids, action='login', view_type=None, menu_id=None, res_id=None, model=None, context=None): + def _get_signup_url_for_action(self, cr, uid, ids, action=None, view_type=None, menu_id=None, res_id=None, model=None, context=None): """ generate a signup url for the given partner ids and action, possibly overriding the url state components (menu_id, id, view_type) """ if context is None: @@ -80,6 +80,8 @@ class res_partner(osv.Model): continue # no signup token, no user, thus no signup url! fragment = dict() + if action: + fragment['action'] = action if view_type: fragment['view_type'] = view_type if menu_id: @@ -89,7 +91,10 @@ class res_partner(osv.Model): if res_id: fragment['id'] = res_id - res[partner.id] = urljoin(base_url, "/web/login?%s#%s" % (urlencode(query), urlencode(fragment))) + if fragment: + query['redirect'] = '/web#' + werkzeug.url_encode(fragment) + + res[partner.id] = urljoin(base_url, "/web/login?%s" % werkzeug.url_encode(query)) return res diff --git a/addons/portal/mail_mail.py b/addons/portal/mail_mail.py index 18eb15361a3..0fe2081fa45 100644 --- a/addons/portal/mail_mail.py +++ b/addons/portal/mail_mail.py @@ -39,7 +39,7 @@ class mail_mail(osv.Model): if partner and not partner.user_ids: contex_signup = dict(context, signup_valid=True) signup_url = partner_obj._get_signup_url_for_action(cr, SUPERUSER_ID, [partner.id], - action='login', model=mail.model, res_id=mail.res_id, + model=mail.model, res_id=mail.res_id, context=contex_signup)[partner.id] return _("""Access your messages and documents through our Customer Portal""") % signup_url else: From cf68961f668b058952b205b5ba7991ea8c5f6b8b Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 12 Mar 2014 11:32:39 +0100 Subject: [PATCH 03/19] [IMP] /web/login redirects if already logged in bzr revid: fme@openerp.com-20140312103239-deyoc7t00g8kusd1 --- addons/web/controllers/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 0074a88ba9c..c30cd052bd6 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -663,6 +663,9 @@ class Home(http.Controller): def web_login(self, redirect=None, **kw): ensure_db() + if request.httprequest.method == 'GET' and redirect and request.session.uid: + return http.redirect_with_hash(redirect) + values = request.params.copy() if not redirect: redirect = '/web?' + request.httprequest.query_string From 2ed053642abfbf20678c02955b8b0bb575cf8d30 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 12 Mar 2014 12:21:41 +0100 Subject: [PATCH 04/19] [IMP] oaut & signup, redirect if already logged in bzr revid: fme@openerp.com-20140312112141-uvo89w4ovmzq5ozq --- addons/auth_oauth/controllers/main.py | 3 +++ addons/auth_signup/controllers/main.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/addons/auth_oauth/controllers/main.py b/addons/auth_oauth/controllers/main.py index 53a6ffd5462..a338927c3a1 100644 --- a/addons/auth_oauth/controllers/main.py +++ b/addons/auth_oauth/controllers/main.py @@ -68,6 +68,9 @@ class OAuthLogin(openerp.addons.web.controllers.main.Home): @http.route() def web_login(self, *args, **kw): + if request.httprequest.method == 'GET' and request.session.uid and request.params.get('redirect'): + # Redirect if already logged in and redirect param is present + return http.redirect_with_hash(request.params.get('redirect')) providers = self.list_providers() response = super(OAuthLogin, self).web_login(*args, **kw) diff --git a/addons/auth_signup/controllers/main.py b/addons/auth_signup/controllers/main.py index 08b67108c3f..92ae6364954 100644 --- a/addons/auth_signup/controllers/main.py +++ b/addons/auth_signup/controllers/main.py @@ -37,6 +37,9 @@ class AuthSignup(openerp.addons.web.controllers.main.Home): mode = request.params.get('mode') qcontext = request.params.copy() super_response = None + if request.httprequest.method == 'GET' and request.session.uid and request.params.get('redirect'): + # Redirect if already logged in and redirect param is present + return http.redirect_with_hash(request.params.get('redirect')) if request.httprequest.method != 'POST' or mode not in ('reset', 'signup'): # Default behavior is to try to login, which in reset or signup mode in a non-sense. super_response = super(AuthSignup, self).web_login(*args, **kw) From e50b3bf7fffd61a632f757970bd23f28417d4bd3 Mon Sep 17 00:00:00 2001 From: Kersten Jeremy Date: Tue, 18 Mar 2014 17:56:22 +0100 Subject: [PATCH 05/19] [FIX] Only set table-row for kanban view (for drag and drop), Else the switch between eg view Calendar and view form (without pass by another view (on IE)) does not work properly. lp bug: https://launchpad.net/bugs/1294059 fixed lp bug: https://launchpad.net/bugs/1097219 fixed bzr revid: jke@openerp.com-20140318165622-kb4j5zz899lciz8v --- addons/web/static/src/css/base.css | 4 +++- addons/web/static/src/css/base.sass | 4 +++- addons/web/static/src/js/views.js | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 6a20442ed41..8c2da02d969 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1248,12 +1248,14 @@ width: 100%; } .openerp .oe_view_manager .oe_view_manager_body { - display: table-row; height: inherit; } .openerp .oe_view_manager .oe_view_manager_view_kanban:not(:empty) { height: inherit; } +.openerp .oe_view_manager[data-view-type=kanban] .oe_view_manager_body { + display: table-row; +} .openerp .oe_view_manager table.oe_view_manager_header { border-collapse: separate; width: 100%; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 38a47eed1c5..b18e4fc65d8 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1037,10 +1037,12 @@ $sheet-padding: 16px height: inherit width: 100% .oe_view_manager_body - display: table-row height: inherit .oe_view_manager_view_kanban:not(:empty) height: inherit + &[data-view-type=kanban] + .oe_view_manager_body + display: table-row table.oe_view_manager_header border-collapse: separate diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 23390df4bb4..5f85b581cea 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -644,7 +644,7 @@ instance.web.ViewManager = instance.web.Widget.extend({ this.$el .find('.oe_view_manager_switch a').filter('[data-view-type="' + view_type + '"]') .parent().addClass('active'); - + this.$el.attr("data-view-type", view_type); return $.when(view_promise).done(function () { _.each(_.keys(self.views), function(view_name) { var controller = self.views[view_name].controller; From 66918d6e3266a8cc87d83f44a06b88103584976b Mon Sep 17 00:00:00 2001 From: Kersten Jeremy Date: Tue, 18 Mar 2014 18:44:45 +0100 Subject: [PATCH 06/19] [FIX] Force recompute the size of column for calendar, else on small screen, the size of columns for the last day is not the same that others. lp bug: https://launchpad.net/bugs/1290942 fixed bzr revid: jke@openerp.com-20140318174445-rjv3xq2rcxr3n5y9 --- addons/web_calendar/static/src/js/web_calendar.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web_calendar/static/src/js/web_calendar.js b/addons/web_calendar/static/src/js/web_calendar.js index 4c5473a2ed1..6db2d97cfeb 100644 --- a/addons/web_calendar/static/src/js/web_calendar.js +++ b/addons/web_calendar/static/src/js/web_calendar.js @@ -217,6 +217,7 @@ openerp.web_calendar = function(instance) { .then(function (create_right) { self.create_right = create_right; self.init_calendar().then(function() { + $(window).trigger('resize'); self.trigger('calendar_view_loaded', fv); self.ready.resolve(); }); From 758d467982a6cff85f6f7567292e2e345ca0abf6 Mon Sep 17 00:00:00 2001 From: Kersten Jeremy Date: Tue, 18 Mar 2014 21:30:51 +0100 Subject: [PATCH 07/19] [FIX] In mail text2Html, replace url (http or ftp) before the replacement of return line, else some return line was sometimes considered as the link. Eg : http://www.google.com


Puis
bzr revid: jke@openerp.com-20140318203051-lk92fjgwltkwbk68 --- addons/mail/static/src/js/mail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index b8bf703f604..17dd4b57cd0 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -76,8 +76,8 @@ openerp.mail = function (session) { */ get_text2html: function (text) { return text - .replace(/[\n\r]/g,'
') .replace(/((?:https?|ftp):\/\/[\S]+)/g,'$1 ') + .replace(/[\n\r]/g,'
') }, /* Returns the complete domain with "&" From 0b237def4d95d40f739cd512beec1e761c0a1255 Mon Sep 17 00:00:00 2001 From: Kersten Jeremy Date: Wed, 19 Mar 2014 12:50:57 +0100 Subject: [PATCH 08/19] [FIX] Add tack_visibility on field 'name' from model : project. That's allow to know which Project is concerned by the subtype. bzr revid: jke@openerp.com-20140319115057-55h9fh7y7x2nu9ik --- addons/project/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/project.py b/addons/project/project.py index e5dcf5de2cf..f6bd55c2fb6 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -745,7 +745,7 @@ class task(osv.osv): _columns = { 'active': fields.function(_is_template, store=True, string='Not a Template Task', type='boolean', help="This field is computed automatically and have the same behavior than the boolean 'active' field: if the task is linked to a template or unactivated project, it will be hidden unless specifically asked."), - 'name': fields.char('Task Summary', size=128, required=True, select=True), + 'name': fields.char('Task Summary', track_visibility='onchange', size=128, required=True, select=True), 'description': fields.text('Description'), 'priority': fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Important'), ('0','Very important')], 'Priority', select=True), 'sequence': fields.integer('Sequence', select=True, help="Gives the sequence order when displaying a list of tasks."), From b245af63b5e62198af3ce1f67b908bb8cc169dd3 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 19 Mar 2014 15:11:30 +0100 Subject: [PATCH 09/19] [FIX] website_sale: do not display product categories with no products bzr revid: dle@openerp.com-20140319141130-dease119j9b2l2fh --- addons/website_sale/controllers/main.py | 16 ++++++++++++---- addons/website_sale/views/website_sale.xml | 2 ++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 3aaabb596f1..b345b810e32 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -226,7 +226,8 @@ class Ecommerce(http.Controller): def shop(self, category=None, page=0, filters='', search='', **post): cr, uid, context = request.cr, request.uid, request.context product_obj = request.registry.get('product.template') - domain = request.registry.get('website').ecommerce_get_product_domain() + base_domain = request.registry.get('website').ecommerce_get_product_domain() + domain = list(base_domain) if search: domain += ['|', ('name', 'ilike', search), @@ -265,9 +266,15 @@ class Ecommerce(http.Controller): pass category_obj = request.registry.get('product.public.category') - category_ids = category_obj.search(cr, uid, [], context=context) + category_ids = [product['public_categ_id'][0] for product in product_obj.read_group(cr, uid, base_domain, ['public_categ_id'], ['public_categ_id'], context=context) if product['public_categ_id']] categories = category_obj.browse(cr, uid, category_ids, context=context) - categs = filter(lambda x: not x.parent_id, categories) + all_categories = set(categories) + for cat in categories: + parent = cat.parent_id + while parent: + all_categories.add(parent) + parent = parent.parent_id + categories = list(all_categories) values = { 'products': products, @@ -282,7 +289,8 @@ class Ecommerce(http.Controller): 'pager': pager, 'styles': styles, 'category': category, - 'categories': categs, + 'categories': filter(lambda x: not x.parent_id, categories), + 'all_categories': categories, 'Ecommerce': self, # TODO fp: Should be removed 'style_in_product': lambda style, product: style.id in [s.id for s in product.website_style_ids], } diff --git a/addons/website_sale/views/website_sale.xml b/addons/website_sale/views/website_sale.xml index 247c9127222..264eab5c36b 100644 --- a/addons/website_sale/views/website_sale.xml +++ b/addons/website_sale/views/website_sale.xml @@ -33,12 +33,14 @@ From 310bcc4d689862143c688e53d9c1254f1d81a1ac Mon Sep 17 00:00:00 2001 From: Kersten Jeremy Date: Wed, 19 Mar 2014 15:33:46 +0100 Subject: [PATCH 10/19] [IMP] Aged Partner Balance - Add selection in wizard to allow to choose the target_move. Customer was unable to make an aged balance with all payments move but only with the move validated. bzr revid: jke@openerp.com-20140319143346-h3f4y77d736w5lc1 --- .../account/wizard/account_report_aged_partner_balance_view.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account/wizard/account_report_aged_partner_balance_view.xml b/addons/account/wizard/account_report_aged_partner_balance_view.xml index be1d710c09d..09ae525c595 100644 --- a/addons/account/wizard/account_report_aged_partner_balance_view.xml +++ b/addons/account/wizard/account_report_aged_partner_balance_view.xml @@ -19,6 +19,7 @@ +