Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2686 Widoki

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!

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
sty 24
1891
1
sie 23
23455
3
wrz 17
7840
3
lip 15
33108
1
mar 15
5674