跳至内容
菜单
此问题已终结
1 回复
18485 查看



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.

形象
丢弃
最佳答案

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

形象
丢弃
相关帖文 回复 查看 活动
0
9月 23
41
4
3月 23
16979
2
7月 22
3816
0
5月 22
2111
2
10月 21
7545