Skip to content

Commit

Permalink
[IMP] account_statement_import_camt54: transfer_line feature
Browse files Browse the repository at this point in the history
- Use currency.iz_zero() instead of direct comparison
- Add information about camt54 usage in the help of the field
  • Loading branch information
ecino committed Mar 7, 2024
1 parent 2a37b95 commit 0301ca7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion account_statement_import_camt54/models/account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ class AccountBankStatementImport(models.Model):

transfer_line = fields.Boolean(
string="Add balance Line",
help="Generate balance line on total of bank statement import",
help="For camt54 files, generate balance line on total of bank statement "
"import",
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ def _create_bank_statements(self, stmts_vals, result):
statements = self.env["account.bank.statement"].browse(result["statement_ids"])
for statement in statements:
amount = sum(statement.line_ids.mapped("amount"))
if statement.journal_id.transfer_line:
if amount != 0:
journal = statement.journal_id
if journal.transfer_line:
if not journal.currency_id.is_zero(amount):
amount = -amount
statement.line_ids.create(
{
Expand Down

0 comments on commit 0301ca7

Please sign in to comment.