Skip to content
Merged
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_file/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from . import account_journal
from . import account_move
from . import account_bank_statement_line
24 changes: 24 additions & 0 deletions account_statement_import_file/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from odoo import api, models


class AccountMove(models.Model):
_inherit = "account.move"

@api.depends("journal_id", "statement_line_id")
def _compute_currency_id(self):
res = super()._compute_currency_id()
if self.env.context.get("from_stmt_import", False):
for invoice in self:
if (
invoice.statement_line_id.foreign_currency_id
and invoice.statement_line_id.foreign_currency_id
== invoice.journal_id.company_id.currency_id
):
currency = (
invoice.journal_id.currency_id
or invoice.statement_line_id.foreign_currency_id
or invoice.currency_id
or invoice.journal_id.company_id.currency_id
)
invoice.currency_id = currency
return res