Update membership_cancel_request.py

This commit is contained in:
zainab2097 2024-08-14 16:00:35 +03:00 committed by GitHub
parent c210253f06
commit ef0fd246fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -21,9 +21,9 @@ class MembershipCancellationRequest(models.Model):
def action_approve(self): def action_approve(self):
for rec in self: for rec in self:
# Check if the request date is before the membership end date # Check if the request date is before the membership end date
if rec.request_date < rec.membership_id.membership_end_date: if rec.request_date < rec.membership_id.to_date:
# Update the membership end date to the request date # Update the membership end date to the request date
rec.membership_id.membership_end_date = rec.request_date rec.membership_id.to_date = rec.request_date
rec.state = 'approved' rec.state = 'approved'
rec.membership_id.state = 'cancel' rec.membership_id.state = 'cancel'