Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2684 Weergaven

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!

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
jan. 24
1889
1
aug. 23
23454
3
sep. 17
7840
3
jul. 15
33108
1
mrt. 15
5674