Skip to content
Open
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
18 changes: 9 additions & 9 deletions account_check_deposit/models/account_check_deposit.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,22 +242,22 @@ def _prepare_move_vals(self):
total_debit = self.company_id.currency_id.round(total_debit)
total_amount_currency = self.currency_id.round(total_amount_currency)

counterpart_account_id = False
counterpart_account = False
for line in self.bank_journal_id.inbound_payment_method_line_ids:
if line.payment_method_id.code == "manual" and line.payment_account_id:
counterpart_account_id = line.payment_account_id.id
counterpart_account = line.payment_account_id
break
# inspired by _get_outstanding_account() on account.payment
if not counterpart_account_id:
if not counterpart_account:
chart_template = self.with_context(
allowed_company_ids=self.company_id.root_id.ids
).env["account.chart.template"]
counterpart_account_id = chart_template.ref(
counterpart_account = chart_template.ref(
"account_journal_payment_debit_account_id", raise_if_not_found=False
).id
if not counterpart_account_id:
counterpart_account_id = self.company_id.transfer_account_id.id
if not counterpart_account_id:
)
if not counterpart_account:
counterpart_account = self.company_id.transfer_account_id
if not counterpart_account:
raise UserError(
_("Missing 'Internal Transfer' account on the company '%s'.")
% self.company_id.display_name
Expand All @@ -284,7 +284,7 @@ def _prepare_move_vals(self):
0,
0,
{
"account_id": counterpart_account_id,
"account_id": counterpart_account.id,
"partner_id": False,
"debit": total_debit,
"currency_id": self.currency_id.id,
Expand Down