|
@ -71,7 +71,7 @@ class Wizard(models.TransientModel): |
|
|
parent_id = fields.Many2one('mail.message', string='Search by name', ) |
|
|
parent_id = fields.Many2one('mail.message', string='Search by name', ) |
|
|
model = fields.Selection(_model_selection, string='Model') |
|
|
model = fields.Selection(_model_selection, string='Model') |
|
|
res_id = fields.Integer(string='Record') |
|
|
res_id = fields.Integer(string='Record') |
|
|
can_move = fields.Boolean('Can move', compute='get_can_move') |
|
|
|
|
|
|
|
|
can_move = fields.Boolean('Can move', compute='_compute_can_move') |
|
|
move_back = fields.Boolean('MOVE TO ORIGIN', help='Move message and submessages to original place') |
|
|
move_back = fields.Boolean('MOVE TO ORIGIN', help='Move message and submessages to original place') |
|
|
partner_id = fields.Many2one('res.partner', string='Author') |
|
|
partner_id = fields.Many2one('res.partner', string='Author') |
|
|
filter_by_partner = fields.Boolean('Filter Records by partner') |
|
|
filter_by_partner = fields.Boolean('Filter Records by partner') |
|
@ -88,15 +88,10 @@ class Wizard(models.TransientModel): |
|
|
|
|
|
|
|
|
@api.depends('message_id') |
|
|
@api.depends('message_id') |
|
|
@api.multi |
|
|
@api.multi |
|
|
def get_can_move(self): |
|
|
|
|
|
|
|
|
def _compute_can_move(self): |
|
|
for r in self: |
|
|
for r in self: |
|
|
r.get_can_move_one() |
|
|
|
|
|
|
|
|
|
|
|
@api.multi |
|
|
|
|
|
def get_can_move_one(self): |
|
|
|
|
|
self.ensure_one() |
|
|
|
|
|
# message was not moved before OR message is a top message of previous move |
|
|
# message was not moved before OR message is a top message of previous move |
|
|
self.can_move = not self.message_id.moved_by_message_id or self.message_id.moved_by_message_id.id == self.message_id.id |
|
|
|
|
|
|
|
|
r.can_move = not r.message_id.moved_by_message_id or r.message_id.moved_by_message_id.id == r.message_id.id |
|
|
|
|
|
|
|
|
@api.onchange('move_back') |
|
|
@api.onchange('move_back') |
|
|
def on_change_move_back(self): |
|
|
def on_change_move_back(self): |
|
@ -269,15 +264,15 @@ class MailMessage(models.Model): |
|
|
moved_from_parent_id = fields.Many2one('mail.message', 'Parent Message (Original)', ondelete='set null') |
|
|
moved_from_parent_id = fields.Many2one('mail.message', 'Parent Message (Original)', ondelete='set null') |
|
|
moved_by_message_id = fields.Many2one('mail.message', 'Moved by message', ondelete='set null', help='Top message, that initate moving this message') |
|
|
moved_by_message_id = fields.Many2one('mail.message', 'Moved by message', ondelete='set null', help='Top message, that initate moving this message') |
|
|
moved_by_user_id = fields.Many2one('res.users', 'Moved by user', ondelete='set null') |
|
|
moved_by_user_id = fields.Many2one('res.users', 'Moved by user', ondelete='set null') |
|
|
all_child_ids = fields.One2many('mail.message', string='All childs', compute='_get_all_childs', help='all childs, including subchilds') |
|
|
|
|
|
|
|
|
all_child_ids = fields.One2many('mail.message', string='All childs', compute='_compute_all_childs', help='all childs, including subchilds') |
|
|
|
|
|
|
|
|
@api.multi |
|
|
@api.multi |
|
|
def _get_all_childs(self, include_myself=True): |
|
|
|
|
|
|
|
|
def _compute_all_childs(self, include_myself=True): |
|
|
for r in self: |
|
|
for r in self: |
|
|
r._get_all_childs_one(include_myself=include_myself) |
|
|
|
|
|
|
|
|
r._compute_all_childs_one(include_myself=include_myself) |
|
|
|
|
|
|
|
|
@api.multi |
|
|
@api.multi |
|
|
def _get_all_childs_one(self, include_myself=True): |
|
|
|
|
|
|
|
|
def _compute_all_childs_one(self, include_myself=True): |
|
|
self.ensure_one() |
|
|
self.ensure_one() |
|
|
ids = [] |
|
|
ids = [] |
|
|
if include_myself: |
|
|
if include_myself: |
|
|