Update cancel_membership.py

This commit is contained in:
zainab2097 2024-08-04 11:38:56 +03:00 committed by GitHub
parent 64a65ec456
commit 3c70fb98cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -42,8 +42,12 @@ class MembershipRefues(models.TransientModel):
def request_cancel_reason(self):
request_id = self.env.context.get('active_id')
for record in self:
if record.request_id:
record.request_id.cancel_reasone = record.reason_id.id
# Assuming self.env.context contains the ID of the membership
if request_id:
membership = self.env['dev.membership'].browse(request_id)
self.env['membership.cancellation.request'].create({
'member_id': membership.partner_id.id,