Merge pull request #3706 from expsa/fix_bug-ensan

fixing context active_id
This commit is contained in:
ahmed-nouri051 2025-06-30 12:39:44 +02:00 committed by GitHub
commit f4d2cc20d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 5 deletions

View File

@ -114,16 +114,19 @@ class AccountRegisterPayment(models.TransientModel):
for payment in payments:
if payment.move_id: # Ensure the payment has a move_id
payment.move_id.takaful_sponsorship_id = self.takaful_sponsorship_id.id
move_id = payments[0].move_id.id if payments and payments[0].move_id else False
ctx = self.env.context.copy()
# You can update it as needed
ctx.update({
'create': False,
})
# Prepare the action for redirection
action = {
'name': _('Payments'),
'type': 'ir.actions.act_window',
'res_model': 'account.payment',
'context': {
'create': False,
'active_id': move_id,
},
'context': ctx,
}
if len(payments) == 1:
action.update({