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 group item in collection

By
gpkarthick
on 6/4/13, 4:01 AM 678 views

Value is <1.0 0.125 VAT-12.5%,,,,500.0 75.0 Sale Tax-15%,,,,400.0 40.0 VAT-10%,,,,1.0 0.125 VAT-12.5%,,,,1.0 0.1 VAT-10%,,,,1.0 0.125 VAT-12.5%,,,,1.0 0.125 VAT-12.5%,,,,1000.0 150.0 Sale Tax-15%,,,,500.0 50.0 VAT-10% >

import collections b_items = collections.defaultdict(lambda:0) for item in res: a,b,c = item['total'], item['name'], item['base'] print type(c),c,a,b,"total name and base value and its type" upto this line working fine Here I can get the c value(base amount group by tax name) after 2 lines i need to group the item how to do that b_items[b] += a result = [{'name':b,'total': a,'sequence':0} for b,a in b_items.items()]

-------------I need to add the base amount in c with group by output result is [{'total': 0.5, 'name': u'VAT-12.5%', 'sequence': 0}, {'total': 90.1, 'name': u'VAT-10%', 'sequence': 0}, {'total': 225.0, 'name': u'Sale Tax-15%', 'sequence': 0}]

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: 6/4/13, 4:01 AM
Seen: 678 times
Last updated: 3/16/15, 8:10 AM