콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2968 화면

Scenario:

class Model1(models.Model):

_name = "model1"

_description = "Model 1"


custom_field = fields.One2many(
        'model2',
        'registration',
    )




class Model2(models.Model):

_name = "model2"

_description = "Model 2"


field_name = fields.Char(
        'Field Name',
        required=True,
    )

field_value = fields.Char(
        'Field Value',
        required=True,
    )

registration = fields.Many2one(
        'model1',
        required=True,
    )


Required Output:

filter records of model1 in odoo tree view based on the field_value where field_name="amount". field_value should be taken input by user. amount is a float stored as str.


Current filter (static):

domain="['&',('custom_field.field_name','=','amount'),('custom_field.field_value','>','100.0')]"/>


Current output:

records of model1 having amount='20' get filtered in above situation.(string comparison '20'>'100.0'). This 100.0 is to be input by user in interface.


Solution tried:

https://www.odoo.com/forum/help-1/how-to-use-dynamic-values-in-domain-filter-17289

Output: 

Uncaught TypeError: Cannot read property 'fields' of null


Please help! Thank you for your time!

아바타
취소
관련 게시물 답글 화면 활동
1
1월 24
2177
1
8월 23
23800
3
9월 17
7840
3
7월 15
33407
1
3월 15
5919