跳至内容
菜单
此问题已终结
506 查看

Hello!

Have a selection field taking values from a method:

selection_rig = fields.Selection(selection='get_selection_options', string='Rig Selection')


Here is the method code:

def get_selection_options(self):

​ domain = []

 

​ if self.compt == "Canopy":

​ domain = [('canopy_id', '=', False)]

​ elif self.compt == "Container":

​ domain = [('container_id', '=', False)]

​ elif self.compt == "Reserve":

​ domain = [('reserve_id', '=', False)]

​ else:

​ domain = [('aad_id', '=', False)]

​ rigs = self.env['rigging.rigs'].search(domain)

​ return [(rig.name, rig.name) for rig in rigs]


The problem is that the object dasn´t show any record but in the form yes. When i print the fields values on the debuger is showing only False or empty list. For example if i use print(self) there is no records is an empty list []. In this case the if statement in not taking action and is going directly to the else.

Can somebody explain me what is happen please

Thanks!

形象
丢弃

I also have this problem and don't know how to solve it. Can you help me?