Skip to content

Commit

Permalink
[FIX] crm: allow to unlink multiple records
Browse files Browse the repository at this point in the history
Closes odoo#22647
  • Loading branch information
mart-e committed Feb 6, 2018
1 parent a98beb1 commit 34d2765
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions addons/crm/models/crm_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ def create(self, values):

@api.multi
def unlink(self):
activities = self.search([('subtype_id', '=', self.subtype_id.id)])
# to ensure that the subtype is only linked the current activity
if len(activities) == 1:
self.subtype_id.unlink()
for activity in self:
activities = self.search([('subtype_id', '=', activity.subtype_id.id)])
# to ensure that the subtype is only linked the current activity
if len(activities) == 1:
activity.subtype_id.unlink()
return super(CrmActivity, self).unlink()

0 comments on commit 34d2765

Please sign in to comment.