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

I have a problem when i use domain to compare two integer fields ?


_name = 'y'
'field1': fields.integer('Field1'),
'field2': fields.integer('Field2'),


_name = 'x'

'y_id': fields.many2one('y', 'Y', domain="[('field1','>','field2')]"),


=> ValueError: invalid literal for int() with base 10: 'field2'

頭像
捨棄
最佳答案

Hi,

In domain filter you have to give the value in right side of the operator. In domain we have to follow the syntax like : [('field_of_model','operator','any_value_according_to_field_and_operator')]

In your domain 'field2' is text and system is going to convert it into "int" thats why system is giving an error message "like invalid literal for int() with base 10:"

頭像
捨棄
作者 最佳答案

ok but now how i compare field1 and field2 in domaine ?

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
1月 23
26722
4
6月 21
39675
1
12月 20
2821
1
4月 18
7943
3
9月 15
9790