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

Hi,

I have created a module with a tree view and some data inside.

Now i want to add new data each time an invoice is paid (payment_state == "paid").

The problem is that i tried to override the create function, the write, tried the @api.onchange but during all of them i never see the payment_state changing to "paid" (sometimes it is "not_paid" and sometimes it gets "False") and it magically happens i don't know where during the process.

Also @api.onchange never printed out the test print that i put in the function so i assume it wasn't even called ??


If you need more details feel free to ask. thank you.


Note : I am using Odoo 17 community

頭像
捨棄
最佳答案

Hi,
payment_state is a computed function and the value is assigned from the function:  _compute_payment_state, if you see the function you will see the paid is returned/set from this.

if all(x['all_payments_matched'] for x in reconciliation_vals):
new_pmt_state = 'paid'
else:
new_pmt_state = invoice._get_invoice_in_payment_state()



Thanks

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
7
12月 24
7952
0
7月 24
1138
1
5月 25
3315
2
1月 24
2324
2
4月 19
6647