Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- working:
- categories_string = fields.Function(fields.Char('Categories'), 'get_categories_string', searcher='search_categories_string')
- def get_categories_string(self, ids, name):
- if not ids:
- return []
- res = {}
- for party in self.browse(ids):
- res[party.id] = ', '.join(sorted(cat.rec_name for cat in party.categories))
- return res
- development (and not working):
- def search_categories_string(self, name, clause):
- res = []
- value = clause[3]
- for cat, _ in self.categories:
- if isinstance(value, basestring) \
- and cat.rec_name \
- and value.upper() in cat.rec_name.upper():
- res.append(('categories', '=', cat.rec_name))
- value = value[len(cat.rec_name):]
- break
- res.append(('categories', clause[1], value))
- return res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement