mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[RFR] Don't repeat assignment within loop
This commit is contained in:
@@ -66,11 +66,6 @@ class AccountBankStatement(orm.Model):
|
||||
update_move_line['tax_code_id'] = tax['base_code_id']
|
||||
update_move_line['tax_amount'] = tax['base_sign'] * (
|
||||
computed_taxes.get('total', 0.0))
|
||||
# As the tax is inclusive, we need to correct the amount on the
|
||||
# original move line
|
||||
amount = computed_taxes.get('total', 0.0)
|
||||
update_move_line['credit'] = ((amount < 0) and -amount) or 0.0
|
||||
update_move_line['debit'] = ((amount > 0) and amount) or 0.0
|
||||
|
||||
move_lines.append({
|
||||
'move_id': defaults['move_id'],
|
||||
@@ -87,6 +82,13 @@ class AccountBankStatement(orm.Model):
|
||||
'account_id': tax.get('account_collected_id', defaults['account_id']),
|
||||
})
|
||||
|
||||
if move_lines:
|
||||
# As the tax is inclusive, we need to correct the amount on the
|
||||
# original move line
|
||||
amount = computed_taxes.get('total', 0.0)
|
||||
update_move_line['credit'] = ((amount < 0) and -amount) or 0.0
|
||||
update_move_line['debit'] = ((amount > 0) and amount) or 0.0
|
||||
|
||||
return move_lines, update_move_line
|
||||
|
||||
def _prepare_bank_move_line(
|
||||
|
||||
Reference in New Issue
Block a user