|
@ -4,7 +4,7 @@ from openerp.tools import email_split |
|
|
from openerp.tools.translate import _ |
|
|
from openerp.tools.translate import _ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class wizard(models.TransientModel): |
|
|
|
|
|
|
|
|
class Wizard(models.TransientModel): |
|
|
_name = 'mail_move_message.wizard' |
|
|
_name = 'mail_move_message.wizard' |
|
|
|
|
|
|
|
|
def _model_selection(self): |
|
|
def _model_selection(self): |
|
@ -26,7 +26,7 @@ class wizard(models.TransientModel): |
|
|
|
|
|
|
|
|
@api.model |
|
|
@api.model |
|
|
def default_get(self, fields_list): |
|
|
def default_get(self, fields_list): |
|
|
res = super(wizard, self).default_get(fields_list) |
|
|
|
|
|
|
|
|
res = super(Wizard, self).default_get(fields_list) |
|
|
|
|
|
|
|
|
model_fields = self.fields_get() |
|
|
model_fields = self.fields_get() |
|
|
if model_fields['model']['selection']: |
|
|
if model_fields['model']['selection']: |
|
@ -231,7 +231,7 @@ class wizard(models.TransientModel): |
|
|
return {'type': 'ir.actions.act_window_close'} |
|
|
return {'type': 'ir.actions.act_window_close'} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class mail_message(models.Model): |
|
|
|
|
|
|
|
|
class MailMessage(models.Model): |
|
|
_inherit = 'mail.message' |
|
|
_inherit = 'mail.message' |
|
|
|
|
|
|
|
|
is_moved = fields.Boolean('Is moved') |
|
|
is_moved = fields.Boolean('Is moved') |
|
@ -300,7 +300,7 @@ class mail_message(models.Model): |
|
|
r_vals['parent_id'] = r.moved_from_parent_id.id |
|
|
r_vals['parent_id'] = r.moved_from_parent_id.id |
|
|
r_vals['res_id'] = r.moved_from_res_id |
|
|
r_vals['res_id'] = r.moved_from_res_id |
|
|
r_vals['model'] = r.moved_from_model |
|
|
r_vals['model'] = r.moved_from_model |
|
|
print 'update message', r, r_vals |
|
|
|
|
|
|
|
|
# print 'update message', r, r_vals |
|
|
if move_followers: |
|
|
if move_followers: |
|
|
r.sudo().move_followers(r_vals.get('model'), r_vals.get('res_id')) |
|
|
r.sudo().move_followers(r_vals.get('model'), r_vals.get('res_id')) |
|
|
r.sudo().write(r_vals) |
|
|
r.sudo().write(r_vals) |
|
@ -311,7 +311,7 @@ class mail_message(models.Model): |
|
|
|
|
|
|
|
|
def name_get(self, cr, uid, ids, context=None): |
|
|
def name_get(self, cr, uid, ids, context=None): |
|
|
if not (context or {}).get('extended_name'): |
|
|
if not (context or {}).get('extended_name'): |
|
|
return super(mail_message, self).name_get(cr, uid, ids, context=context) |
|
|
|
|
|
|
|
|
return super(MailMessage, self).name_get(cr, uid, ids, context=context) |
|
|
if isinstance(ids, (list, tuple)) and not len(ids): |
|
|
if isinstance(ids, (list, tuple)) and not len(ids): |
|
|
return [] |
|
|
return [] |
|
|
if isinstance(ids, (long, int)): |
|
|
if isinstance(ids, (long, int)): |
|
@ -325,12 +325,12 @@ class mail_message(models.Model): |
|
|
return res |
|
|
return res |
|
|
|
|
|
|
|
|
def _message_read_dict(self, cr, uid, message, parent_id=False, context=None): |
|
|
def _message_read_dict(self, cr, uid, message, parent_id=False, context=None): |
|
|
res = super(mail_message, self)._message_read_dict(cr, uid, message, parent_id, context) |
|
|
|
|
|
|
|
|
res = super(MailMessage, self)._message_read_dict(cr, uid, message, parent_id, context) |
|
|
res['is_moved'] = message.is_moved |
|
|
res['is_moved'] = message.is_moved |
|
|
return res |
|
|
return res |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class mail_move_message_configuration(models.TransientModel): |
|
|
|
|
|
|
|
|
class MailMoveMessageConfiguration(models.TransientModel): |
|
|
_name = 'mail_move_message.config.settings' |
|
|
_name = 'mail_move_message.config.settings' |
|
|
_inherit = 'res.config.settings' |
|
|
_inherit = 'res.config.settings' |
|
|
|
|
|
|
|
@ -361,12 +361,12 @@ class mail_move_message_configuration(models.TransientModel): |
|
|
config_parameters.set_param('mail_relocation_move_followers', record.move_followers or '') |
|
|
config_parameters.set_param('mail_relocation_move_followers', record.move_followers or '') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class res_partner(models.Model): |
|
|
|
|
|
|
|
|
class ResPartner(models.Model): |
|
|
_inherit = 'res.partner' |
|
|
_inherit = 'res.partner' |
|
|
|
|
|
|
|
|
@api.model |
|
|
@api.model |
|
|
def create(self, vals): |
|
|
def create(self, vals): |
|
|
res = super(res_partner, self).create(vals) |
|
|
|
|
|
|
|
|
res = super(ResPartner, self).create(vals) |
|
|
if 'update_message_author' in self.env.context and 'email' in vals: |
|
|
if 'update_message_author' in self.env.context and 'email' in vals: |
|
|
mail_message_obj = self.env['mail.message'] |
|
|
mail_message_obj = self.env['mail.message'] |
|
|
# Escape special SQL characters in email_address to avoid invalid matches |
|
|
# Escape special SQL characters in email_address to avoid invalid matches |
|
|