Fix on group_by dict based reimplemenattion
This commit is contained in:
parent
5fa54adf24
commit
22f47d4fcd
|
@ -313,7 +313,7 @@ class OrderQuerySet(models.QuerySet):
|
||||||
commit = options.get('commit', True)
|
commit = options.get('commit', True)
|
||||||
for account, services in qs.group_by('account', 'service').iteritems():
|
for account, services in qs.group_by('account', 'service').iteritems():
|
||||||
bill_lines = []
|
bill_lines = []
|
||||||
for service, orders in services:
|
for service, orders in services.iteritems():
|
||||||
lines = service.handler.generate_bill_lines(orders, account, **options)
|
lines = service.handler.generate_bill_lines(orders, account, **options)
|
||||||
bill_lines.extend(lines)
|
bill_lines.extend(lines)
|
||||||
if commit:
|
if commit:
|
||||||
|
|
|
@ -21,6 +21,7 @@ def group_by(qset, *fields):
|
||||||
group = group[current]
|
group = group[current]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
group[current] = OrderedDict()
|
group[current] = OrderedDict()
|
||||||
|
group = group[current]
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
group[current].append(obj)
|
group[current].append(obj)
|
||||||
|
|
Loading…
Reference in New Issue