Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][IMP] account_statement_import_camt54 add the parameter to the view #607

Open
wants to merge 2 commits into
base: 14.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions account_statement_import_camt54/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"author": "camptocamp, " "Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"data": ["views/account_journal_view.xml"],
"depends": ["account_statement_import_camt"],
}
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
14 changes: 14 additions & 0 deletions account_statement_import_camt54/views/account_journal_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="account_journal_statement_import_param_view" model="ir.ui.view">
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.view_account_journal_form" />
<field name="arch" type="xml">
<xpath expr="//page[@name='advanced_settings']/group" position="inside">
<group string="Statement">
<field name="transfer_line" />
</group>
</xpath>
</field>
</record>
</odoo>
Loading