Skip to content

Commit

Permalink
Merge pull request #155 from openimis/feature/OP-2065
Browse files Browse the repository at this point in the history
OP-2065: reverting possibility to update insuree basic data
  • Loading branch information
delcroip authored Jan 8, 2025
2 parents 2d10ef9 + 11aff46 commit 397b760
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions insuree/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ def create_or_update(self, data, create_only=False):
raise ValidationError("mutation.insuree.fsp_required")
if not insuree:
insuree = Insuree(**data)
else:
self._update(insuree, data)

return self._create_or_update(
insuree, photo_data,
Expand Down Expand Up @@ -469,6 +471,13 @@ def cancel_policies(self, insuree):
'detail': insuree.uuid}]
}

def _update(self, insuree, data):
insuree.save_history()
# reset the non required fields
# (each update is 'complete', necessary to be able to set 'null')
reset_insuree_before_update(insuree)
[setattr(insuree, key, data[key]) for key in data]


class InsureePolicyService:
def __init__(self, user):
Expand Down

0 comments on commit 397b760

Please sign in to comment.