Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

how to remove join and use csv as separate values?

By
evon_dun
on 5/21/13, 4:02 AM 622 views
def name_get(self, cr, user, ids, context=None):
        if context is None:
            context = {}
        if not len(ids):
            return []
        res = []
        for r in self.read(cr, user, ids, ['reference_name','category']):
            if context.get('category_display', 'type')=='reference' and r['reference_id']:
                res.append((r['id'], r['reference_id'][1]))
            else:
                # make a comma-separated list with the following non-empty elements
                elems = [r['reference_name'], r['category']]
                categ = ', '.join(filter(bool, elems))
                if (context.get('category_display', 'type')=='category') and r['reference_id']:
                    res.append((r['id'], "%s: %s" % (r['reference_id']categ or '/')))
                else:
                    res.append((r['id'], categ or '/'))
        return res

This is my small function the values are coming in reference_id as csv format but i want to use them separately. Kindly help.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 5/21/13, 4:02 AM
Seen: 622 times
Last updated: 3/16/15, 8:10 AM