[FIX] pos: remove unused key use in move lines grouping
The key 'tax_code_id' does not exist anymore, therefore the condition
line.get('tax_code_id') == values.get('tax_code_id')
was equivalent to
None == None
which is of course always True.
To make this code more readable and avoid misunderstandings, a clearer
loop implementation avoids checking for this key.
This commit is contained in:
@@ -238,18 +238,10 @@ class PosOrder(models.Model):
|
||||
if not grouped_data[key]:
|
||||
grouped_data[key].append(values)
|
||||
else:
|
||||
for line in grouped_data[key]:
|
||||
if line.get('tax_code_id') == values.get('tax_code_id'):
|
||||
current_value = line
|
||||
current_value['quantity'] = current_value.get(
|
||||
'quantity', 0.0) + values.get('quantity', 0.0)
|
||||
current_value['credit'] = current_value.get(
|
||||
'credit', 0.0) + values.get('credit', 0.0)
|
||||
current_value['debit'] = current_value.get(
|
||||
'debit', 0.0) + values.get('debit', 0.0)
|
||||
break
|
||||
else:
|
||||
grouped_data[key].append(values)
|
||||
current_value = grouped_data[key][0]
|
||||
current_value['quantity'] = current_value.get('quantity', 0.0) + values.get('quantity', 0.0)
|
||||
current_value['credit'] = current_value.get('credit', 0.0) + values.get('credit', 0.0)
|
||||
current_value['debit'] = current_value.get('debit', 0.0) + values.get('debit', 0.0)
|
||||
else:
|
||||
grouped_data[key].append(values)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user