Browse Source

Merge pull request #85 from yelizariev/10.0-mail_move_message-port

[FIX] don't override keyword args in calling *_one methods + [FIX] correct checking for infinitive looping
pull/86/head
ILMIR 8 years ago
committed by GitHub
parent
commit
6a8b7aa41f
  1. 9
      mail_move_message/mail_move_message_models.py

9
mail_move_message/mail_move_message_models.py

@ -274,7 +274,7 @@ class MailMessage(models.Model):
@api.multi @api.multi
def _get_all_childs(self, include_myself=True): def _get_all_childs(self, include_myself=True):
for r in self: for r in self:
r._get_all_childs_one(include_myself=True)
r._get_all_childs_one(include_myself=include_myself)
@api.multi @api.multi
def _get_all_childs_one(self, include_myself=True): def _get_all_childs_one(self, include_myself=True):
@ -303,12 +303,15 @@ class MailMessage(models.Model):
@api.multi @api.multi
def move(self, parent_id, res_id, model, move_back, move_followers=False): def move(self, parent_id, res_id, model, move_back, move_followers=False):
for r in self: for r in self:
r.move_one(parent_id, res_id, model, move_back, move_followers=False)
r.move_one(parent_id, res_id, model, move_back, move_followers=move_followers)
@api.multi @api.multi
def move_one(self, parent_id, res_id, model, move_back, move_followers=False): def move_one(self, parent_id, res_id, model, move_back, move_followers=False):
self.ensure_one() self.ensure_one()
if parent_id == res_id:
if parent_id == self.id:
# if for any reason method is called to move message with parent
# equal to oneself, we need stop to prevent infinitive loop in
# building message tree
return return
vals = {} vals = {}
if move_back: if move_back:

Loading…
Cancel
Save