Hello All,
I try to applied domain for many2one type field. But i find following Error:
TypeError: district.district(11,) is not JSON serializable
My Onchange function code is here:
@api.onchange('district_table_case')
def _onchange_district_table(self):
print "A:", self.district_table_case.district_mainn
print "B:", self.district_table_case.district_ss
#print "C:", self.district_table_case.district_ss.district
rec = self.district_table_case.district_ss
res = self.district_table_case.district_mainn
print "res:", res
for vals in rec:
print "C:", vals
print "D:", vals.district
if vals.district:
return {'domain': {'district_table': [('id', 'in', vals)]}}
else:
return {'domain': {'district_table': []}}
district_table_case = fields.Many2one('district.districe.code', change_default=True, default=_onchange_district_table)