I can’t understand why this code doesn’t work properly:
range_zip_codes = [] # List of some ZIP codes that constrains search
range_zip_codes.append('10001') # Initial constrain
installers = fields.Many2Many('sale.sale-installers.party.party', 'sale', 'installer',
string = 'Installer at the Sale Order',
help = 'Select installers in this sale order',
domain=[
('categories.installer', '=', True),
('addresses.zip', 'in', Eval('range_zip_codes')) # THIS CONSTRAIN I WANT TO BE FLEXIBLE
],
depends=['range_zip_codes', 'addresses.zip']
)
I have a special function that populates self.range_zip_codes
list in different conditions with various ZIP codes. I want to constrain the installers
filter by addresses.zip
codes only within range_zip_codes
list.
But the beheivour of the function is very strange:
('addresses.zip', 'in', Eval('range_zip_codes')) #— ALWAYS filter out: an empty search tree
in case of
('addresses.zip', 'in', range_zip_codes) #— Works like range_zip_codes list is just a constant ['10001']
That is a sample value: range_zip_codes = ['10001', '10475']
or there are many other ZIP codes in this list
But that doesn’t work with Eval().
What I do wrong??
Constantine.