Domain Creation

I tried to create a domain and i got this error:

/usr/local/lib/python3.6/dist-packages/tryton-5.0.12-py3.6.egg/tryton/gui/window/view_form/view/form_gtk/char.py:132: Warning: g_value_get_int: assertion ‘G_VALUE_HOLDS_INT (value)’ failed
self.entry.set_text(value)
ERROR:tryton.common.common:FORBIDDEN
403

My Domain is:

preferred_floor = fields.Many2One(
‘dharamshala.floor’, ‘Preferred Floor’,
domain=[
(‘number’, ‘<=’, Eval(‘preferred_dhramshala_categ.num_of_floors’, 5))
],
)

The GTK warning is not linked to the domain.

The FORBIDDEN error is because there is a request to an unauthorized resource. You should increase the verbosity of the client to know which request but I doubt it is linked to a domain.

To correct myself, I am trying to develop a domain which uses a field from a related many2one field in the current model. For example -

class DharamshalaFloors(ModelSQL, ModelView):
   """Dharamshala Floors"""

    _name_ = 'dharamshala.floor'

    name = fields.Char('Name')
    number = fields.Integer('Floor Number')



class DharamshalaCategory(ModelSQL, ModelView):
    'Dharamshala Category'

    _name_ = 'dharamshala.categ'

    name = fields.Char('Dharamshala Name', required=True)
    num_of_floors = fields.Integer('Number of Floors')


class Profile(Workflow, ModelSQL, ModelView):
    'Profile'

    _name_ = 'profile'


    preferred_dhramshala_categ = fields.Many2One(
        'dharamshala.categ',
        'Preferred Dhramshala')
    preferred_floor = fields.Many2One(
        'dharamshala.floor', 'Preferred Floor',
        domain=[
            ('number', '<=', Eval('preferred_dhramshala_categ.num_of_floors', 0))
        ],
    )

I want the user to select a preferred building which has the number of specific floors. And then the list of the preferred floors should come on the basis of the total number of floors in that building.

You can not use dotted notation in Eval. Only direct field can be used.
In order to get your information, you need to create a Function field on the Profile that returns the needed value. You can use an on_change_with getter to ensure that the value is always up to date.