summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/crm/base_partner_merge.py6
-rw-r--r--addons/crm/i18n/crm.pot6
-rw-r--r--addons/google_drive/google_drive.py18
-rw-r--r--addons/project_issue/project_issue.py2
-rw-r--r--addons/rating/models/rating.py2
-rw-r--r--openerp/addons/base/ir/ir_qweb.py7
-rw-r--r--openerp/addons/base/ir/ir_ui_view.py2
7 files changed, 33 insertions, 10 deletions
diff --git a/addons/crm/base_partner_merge.py b/addons/crm/base_partner_merge.py
index 2c203affb6b..8baf69a5a7a 100644
--- a/addons/crm/base_partner_merge.py
+++ b/addons/crm/base_partner_merge.py
@@ -302,6 +302,12 @@ class MergePartnerAutomatic(osv.TransientModel):
if len(partner_ids) > 3:
raise UserError(_("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 UserError(_("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 16d54791d9f..ab7b2ae7015 100644
--- a/addons/crm/i18n/crm.pot
+++ b/addons/crm/i18n/crm.pot
@@ -3776,6 +3776,12 @@ msgid "You can also combine several rules into a sequence.<br/>\n"
msgstr ""
#. module: crm
+#: code:addons/crm/base_partner_merge.py:309
+#, python-format
+msgid "You cannot merge a contact with one of his parent."
+msgstr ""
+
+#. module: crm
#: model:ir.ui.view,arch_db:crm.crm_planner
msgid "You can change the pricing method at anytime. We\n"
" recommend you to select the easiest option that\n"
diff --git a/addons/google_drive/google_drive.py b/addons/google_drive/google_drive.py
index dd723c4f10d..3cd7da3612d 100644
--- a/addons/google_drive/google_drive.py
+++ b/addons/google_drive/google_drive.py
@@ -223,9 +223,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),
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py
index 2699625bd79..c7c253f2074 100644
--- a/addons/project_issue/project_issue.py
+++ b/addons/project_issue/project_issue.py
@@ -124,7 +124,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 {}
_columns = {
diff --git a/addons/rating/models/rating.py b/addons/rating/models/rating.py
index 2c379172f56..beff19da27c 100644
--- a/addons/rating/models/rating.py
+++ b/addons/rating/models/rating.py
@@ -47,6 +47,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)
diff --git a/openerp/addons/base/ir/ir_qweb.py b/openerp/addons/base/ir/ir_qweb.py
index 084b7c1d325..19bfa05ffe8 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":
diff --git a/openerp/addons/base/ir/ir_ui_view.py b/openerp/addons/base/ir/ir_ui_view.py
index 7493f132139..409c132f535 100644
--- a/openerp/addons/base/ir/ir_ui_view.py
+++ b/openerp/addons/base/ir/ir_ui_view.py
@@ -499,7 +499,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))