跳至內容
選單
此問題已被標幟
1 回覆
18540 瀏覽次數



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
17043
2
7月 22
3874
0
5月 22
2170
2
10月 21
7670