Merge pull request #3706 from expsa/fix_bug-ensan
fixing context active_id
This commit is contained in:
commit
f4d2cc20d6
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Reference in New Issue