[MERGE] forward port of branch 8.0 up to 1d0b9da
This commit is contained in:
@@ -302,6 +302,12 @@ class MergePartnerAutomatic(osv.TransientModel):
|
|||||||
if len(partner_ids) > 3:
|
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."))
|
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:
|
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."))
|
raise UserError(_("All contacts must have the same email. Only the Administrator can merge contacts with different emails."))
|
||||||
|
|
||||||
|
|||||||
@@ -3056,6 +3056,12 @@ msgid "You are already at the top level of your sales-team category.\n"
|
|||||||
"Therefore you cannot escalate furthermore."
|
"Therefore you cannot escalate furthermore."
|
||||||
msgstr ""
|
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
|
#. module: crm
|
||||||
#: code:addons/crm/base_partner_merge.py:446
|
#: code:addons/crm/base_partner_merge.py:446
|
||||||
#, python-format
|
#, python-format
|
||||||
|
|||||||
@@ -242,9 +242,25 @@ class config(osv.Model):
|
|||||||
class base_config_settings(osv.TransientModel):
|
class base_config_settings(osv.TransientModel):
|
||||||
_inherit = "base.config.settings"
|
_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 = {
|
_columns = {
|
||||||
'google_drive_authorization_code': fields.char('Authorization Code'),
|
'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 = {
|
_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),
|
'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),
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ class project_issue(osv.Model):
|
|||||||
if project_id:
|
if project_id:
|
||||||
project = self.pool.get('project.project').browse(cr, uid, project_id, context=context)
|
project = self.pool.get('project.project').browse(cr, uid, project_id, context=context)
|
||||||
if project and project.partner_id:
|
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 {}
|
return {}
|
||||||
|
|
||||||
def _get_issue_task(self, cr, uid, ids, context=None):
|
def _get_issue_task(self, cr, uid, ids, context=None):
|
||||||
|
|||||||
@@ -485,7 +485,7 @@ class view(osv.osv):
|
|||||||
def inherit_branding(self, specs_tree, view_id, root_id):
|
def inherit_branding(self, specs_tree, view_id, root_id):
|
||||||
for node in specs_tree.iterchildren(tag=etree.Element):
|
for node in specs_tree.iterchildren(tag=etree.Element):
|
||||||
xpath = node.getroottree().getpath(node)
|
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)
|
self.inherit_branding(node, view_id, root_id)
|
||||||
else:
|
else:
|
||||||
node.set('data-oe-id', str(view_id))
|
node.set('data-oe-id', str(view_id))
|
||||||
|
|||||||
Reference in New Issue
Block a user