Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
5577 Visualizzazioni

aml = self.env['account.move.line'].search([])             

for record in aml:

if record.payment_id == self.id

self.env['account.move.line'].create({'number_id':self.number_id}) 

 I have piece of code. I want get payment_id from account_move_line but when i print it. it will account.payment(21,)
I can't compare with any other id. Help me, please. Thanks

Avatar
Abbandona

Read more about Odoo Customization Tips: https://goo.gl/8HgnCF

Risposta migliore

The right way to compare is as follows

if record.payment_id and record.payment_id.id == self.id:

Please checkout Odoo's documentation on ORM API to know how to work with recordsets
https://www.odoo.com/documentation/12.0/reference/orm.html#recordsets




 


Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
mar 25
1525
4
apr 24
174393
0
dic 23
2295
1
set 23
2217
5
lug 25
228569