[MERGE] forward port of branch saas-7 up to 1e404b7
This commit is contained in:
@@ -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."))
|
||||
|
||||
|
||||
@@ -3775,6 +3775,12 @@ msgid "You can also combine several rules into a sequence.<br/>\n"
|
||||
" Example: additional 10% discount during summer sales"
|
||||
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"
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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":
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user