Skip to Content
Menu
This question has been flagged
1 Reply
17205 Views



I added buttons in lines on wizard of payment ('pos.make.payment')

In xml code, I added the 'payment_ids tree' in 'pos.make.payment' model(POS module)

 When clicking on button, I want to delete the payment, but I got this error:

"Record does not exist or has been deleted .
(Record: pos.payment(100,), User: 2) "

What's wrong please ? Any help?

class PosPayment(models.Model):
_inherit = 'pos.payment'

def delete_payment(self):
self.unlink()
return {
       'context': self.env.context,
       'view_type': 'form',
       'view_mode': 'form',
       'res_model': 'pos.make.payment',
       'res_id': self.id,
       'view_id': False,
       'type': 'ir.actions.act_window',
       'target': 'new',
}

Thanks.

Avatar
Discard
Best Answer

I see that you delete the record using 

self.unlink()

it should remove the record

but then you use the deleted record id in 

'res_id': self.id, 

it will throw error because the record already deleted

Avatar
Discard
Related Posts Replies Views Activity
0
Sep 23
41
4
Mar 23
15291
2
Jul 22
2452
0
May 22
1137
2
Oct 21
6172