Odoo Help


how to group item in collection

on 6/4/13, 4:01 AM 1,028 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}]

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 6/4/13, 4:01 AM
Seen: 1028 times
Last updated: 3/16/15, 8:10 AM