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

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

形象
丢弃

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

最佳答案

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




 


形象
丢弃
相关帖文 回复 查看 活动
0
3月 25
1444
4
4月 24
174326
0
12月 23
2202
1
9月 23
2162
5
7月 25
228260