Skip to content

Commit

Permalink
[REF] eater: do not raise validation error on parent worker update
Browse files Browse the repository at this point in the history
  • Loading branch information
robinkeunen committed Oct 24, 2023
1 parent eed712a commit 4d6e3b8
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions eater/models/partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,6 @@ def _check_parent_is_worker(self):
% partner.name
)

def write(self, values):
if values.get("parent_eater_id"):
for partner in self:
if (
partner.parent_eater_id
and partner.parent_eater_id.id != values.get("parent_eater_id")
):
raise ValidationError(
_(
"You are trying to assign %(eater)s as an eater to"
" a new partner, but this eater is already"
" assigned to %(old_partner)s. Please remove the link"
" before creating a new one."
)
% {
"eater": partner.name,
"old_partner": partner.parent_eater_id.name,
}
)
return super().write(values)

def _new_eater(self, surname, name, email):
partner_data = {
"lastname": name,
Expand Down

0 comments on commit 4d6e3b8

Please sign in to comment.