Skip to content

Commit

Permalink
Merge PR #140 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by andhit-r
  • Loading branch information
ssi-bot committed Aug 19, 2024
2 parents 240966b + e05983d commit 0c77700
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions ssi_voucher_mixin/models/voucher_line_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,15 @@ def _compute_amount(self):
def _get_debit_credit(self):
self.ensure_one()
debit = credit = 0.0
if self.move_line_id:
amount = self.amount_company_currency_move_date
else:
amount = self.amount_company_currency_voucher_date

# TODO:
# if self.move_line_id:
# amount = self.amount_company_currency_move_date
# else:
# amount = self.amount_company_currency_voucher_date

amount = self.amount_company_currency_voucher_date

if self.type == "dr":
if amount > 0:
debit = abs(amount)
Expand All @@ -194,18 +199,32 @@ def _get_currency_exchange_information(self):
debit = credit = 0.0
amount = self.amount_diff_in_company_currency
company = self.env.user.company_id
if (self.type == "dr" and amount > 0.0) or (self.type == "cr" and amount < 0.0):
if self.type == "dr" and amount > 0.0:
credit = abs(amount)
account_id = (
company.expense_currency_exchange_account_id
and company.expense_currency_exchange_account_id.id
or False
)
elif self.type == "dr" and amount < 0.0:
debit = abs(amount)
account_id = (
company.expense_currency_exchange_account_id
and company.expense_currency_exchange_account_id.id
or False
)
else:
elif self.type == "cr" and amount < 0.0:
credit = abs(amount)
account_id = (
company.income_currency_exchange_account_id
and company.income_currency_exchange_account_id.id
company.expense_currency_exchange_account_id
and company.expense_currency_exchange_account_id.id
or False
)
elif self.type == "cr" and amount > 0.0:
debit = abs(amount)
account_id = (
company.expense_currency_exchange_account_id
and company.expense_currency_exchange_account_id.id
or False
)
return (debit, credit, account_id)
Expand Down

0 comments on commit 0c77700

Please sign in to comment.