From 8bb6704b4b60c669990112b42adbee744d6e38af Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 30 Mar 2016 12:06:18 +0200 Subject: [PATCH 1/6] [FIX] rating: rating as public If the user is not connected with his portal account, but has the right token to rate, he should be able to. opw-673231 --- addons/rating/models/rating.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/rating/models/rating.py b/addons/rating/models/rating.py index 44d446b4b0c..a17f2e17e5a 100644 --- a/addons/rating/models/rating.py +++ b/addons/rating/models/rating.py @@ -45,6 +45,8 @@ class Rating(models.Model): domain = [('access_token', '=', token)] if token else [('res_model', '=', res_model), ('res_id', '=', res_id)] rating = self.search(domain, limit=1) if rating: + if token: + rating = rating.sudo() rating.write({'rating' : rate}) if hasattr(self.env[rating.res_model], 'message_post'): record = self.env[rating.res_model].sudo().browse(rating.res_id) From 6e07ae5a5c4d97e9931a513e1c1df70cd610efca Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 30 Mar 2016 16:01:48 +0200 Subject: [PATCH 2/6] [FIX] google_drive: Generate Google Authorization Code URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When checking `Attach Google documents to any record` in the general settings, if you are not redirected to a module, but, instead, the current page is refreshed (the wizard is reloaded instead of creating a new configuration wizard), the default value for `google_drive_uri` was not correctly loaded, the `client_id` in the URL remained `False` because the wizard was not being re-created, but reloaded, and therefore `default_get` hasn't been re-called, and the `client_id` changed (it was added to the system parameters after the installation of the module) Therefore, the link did not include the correct `client_id`, and it leaded to the inabibility to use the URL: 401. That’s an error. The OAuth client was not found. Replacing the simple char fields by a function field, with the correct store trigger, force the URL value to be reloaded when the system parameter is inserted. opw-673274 --- addons/google_drive/google_drive.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/addons/google_drive/google_drive.py b/addons/google_drive/google_drive.py index 3976d561c40..90d13584fad 100644 --- a/addons/google_drive/google_drive.py +++ b/addons/google_drive/google_drive.py @@ -241,9 +241,25 @@ class config(osv.Model): class base_config_settings(osv.TransientModel): _inherit = "base.config.settings" + def _get_drive_uri(self, cr, uid, ids, field_name, arg, context=None): + return { + wizard_id: self.default_get(cr, uid, ['google_drive_uri']).get('google_drive_uri') + for wizard_id in ids + } + + def _get_wizard_ids(self, cr, uid, ids, context=None): + result = [] + if any(rec.key in ['google_drive_client_id', 'google_redirect_uri'] for rec in self.browse(cr, uid, ids, context=context)): + result.extend(self.pool['base.config.settings'].search(cr, uid, [], context=context)) + return result + _columns = { 'google_drive_authorization_code': fields.char('Authorization Code'), - 'google_drive_uri': fields.char('URI', readonly=True, help="The URL to generate the authorization code from Google"), + 'google_drive_uri': fields.function(_get_drive_uri, string='URI', help="The URL to generate the authorization code from Google", type="char", store={ + 'ir.config_parameter': (_get_wizard_ids, None, 20), + }), # TODO: 1. in master, remove the store, there is no reason for this field to be stored. It's just a dynamic link. + # TODO: 2. when converted to the new API, the code to get the default value can be moved to the compute method directly, and the default value can be removed + # the only reason the default value is defined is because function fields are not computed in draft mode in the old API. } _defaults = { 'google_drive_uri': lambda s, cr, uid, c: s.pool['google.service']._get_google_token_uri(cr, uid, 'drive', scope=s.pool['google.drive.config'].get_google_scope(), context=c), From bbb317c5474a460383ed3a3f7ff1f23b5f10a0b0 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 30 Mar 2016 14:16:00 +0200 Subject: [PATCH 3/6] [FIX] crm: merge partner It is not allowed to merge a partner with one of his parent. opw:673104 --- addons/crm/base_partner_merge.py | 6 ++++++ addons/crm/i18n/crm.pot | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/addons/crm/base_partner_merge.py b/addons/crm/base_partner_merge.py index 84038986396..560de0ecc51 100644 --- a/addons/crm/base_partner_merge.py +++ b/addons/crm/base_partner_merge.py @@ -300,6 +300,12 @@ class MergePartnerAutomatic(osv.TransientModel): if len(partner_ids) > 3: raise osv.except_osv(_('Error'), _("For safety reasons, you cannot merge more than 3 contacts together. You can re-open the wizard several times if needed.")) + child_ids = set() + for partner_id in partner_ids: + child_ids = child_ids.union(set(proxy.search(cr, uid, [('id', 'child_of', [partner_id])])) - set([partner_id])) + if set(partner_ids).intersection(child_ids): + raise osv.except_osv(_('Error'), _("You cannot merge a contact with one of his parent.")) + if openerp.SUPERUSER_ID != uid and len(set(partner.email for partner in proxy.browse(cr, uid, partner_ids, context=context))) > 1: raise osv.except_osv(_('Error'), _("All contacts must have the same email. Only the Administrator can merge contacts with different emails.")) diff --git a/addons/crm/i18n/crm.pot b/addons/crm/i18n/crm.pot index 310f7e5f9ef..40e330490f0 100644 --- a/addons/crm/i18n/crm.pot +++ b/addons/crm/i18n/crm.pot @@ -3056,6 +3056,12 @@ msgid "You are already at the top level of your sales-team category.\n" "Therefore you cannot escalate furthermore." msgstr "" +#. module: crm +#: code:addons/crm/base_partner_merge.py:310 +#, python-format +msgid "You cannot merge a contact with one of his parent." +msgstr "" + #. module: crm #: code:addons/crm/base_partner_merge.py:446 #, python-format From d3557de74604536aac4a4529dae424b07800f11c Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 30 Mar 2016 16:06:09 +0200 Subject: [PATCH 4/6] [FIX] ir.qweb: branding breaks editing/inheritance Could not edit t-field content if modified by inherit xpath, and could not inherit qweb views with non "xpath" nodes with `position="attributes"`. Examples: Can't edit: `
` Inherit doesn't work: `

tata

` Closes #11561 Closes #11547 --- openerp/addons/base/ir/ir_ui_view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/addons/base/ir/ir_ui_view.py b/openerp/addons/base/ir/ir_ui_view.py index 27294f3de21..a7ee9942ae4 100644 --- a/openerp/addons/base/ir/ir_ui_view.py +++ b/openerp/addons/base/ir/ir_ui_view.py @@ -398,7 +398,7 @@ class view(osv.osv): def inherit_branding(self, specs_tree, view_id, root_id): for node in specs_tree.iterchildren(tag=etree.Element): xpath = node.getroottree().getpath(node) - if node.tag == 'data' or node.tag == 'xpath': + if node.tag == 'data' or node.tag == 'xpath' or node.get('position') or node.get('t-field'): self.inherit_branding(node, view_id, root_id) else: node.set('data-oe-id', str(view_id)) From 1d0b9da3f0cc5a639b4997d19f31d8abf765db0c Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 1 Apr 2016 11:12:39 +0200 Subject: [PATCH 5/6] [FIX] project_issue: partner email When a new issue is created, the partner email is not pre-filled. Fixes #11395 opw-672380 --- addons/project_issue/project_issue.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index a20343590e4..948a60439cb 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -193,7 +193,7 @@ class project_issue(osv.Model): if project_id: project = self.pool.get('project.project').browse(cr, uid, project_id, context=context) if project and project.partner_id: - return {'value': {'partner_id': project.partner_id.id}} + return {'value': {'partner_id': project.partner_id.id, 'email_from': project.partner_id.email}} return {} def _get_issue_task(self, cr, uid, ids, context=None): From de11d8415a486f28eae0ec3420148aa42348a0fd Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 1 Apr 2016 18:32:32 +0200 Subject: [PATCH 6/6] Revert "[FIX] ir.qweb: can't edit t-field content if modified by inherit xpath" This reverts commit 5ab43773cb7c9d45556d407d6598a1111723ce15. This commit is not needed anymore since d3557de74604536aac4a4529dae424b07800f11c. --- openerp/addons/base/ir/ir_qweb.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/openerp/addons/base/ir/ir_qweb.py b/openerp/addons/base/ir/ir_qweb.py index 467d839a6cb..e7776161737 100644 --- a/openerp/addons/base/ir/ir_qweb.py +++ b/openerp/addons/base/ir/ir_qweb.py @@ -264,13 +264,6 @@ class QWeb(orm.AbstractModel): else: _logger.warning("@t-debug in template '%s' is only available in --dev mode" % qwebcontext['__template__']) - # remove branding attributes from inherit - if element.attrib.get('data-oe-id') and [key for key in element.attrib.keys() if key.startswith("t-")]: - element.attrib.pop("data-oe-id", False) - element.attrib.pop("data-oe-xpath", False) - element.attrib.pop("data-oe-model", False) - element.attrib.pop("data-oe-field", False) - for (attribute_name, attribute_value) in element.attrib.iteritems(): attribute_name = unicode(attribute_name) if attribute_name == "groups":