-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] hr_expense: display expenses amounts to be paid
Steps to reproduce: - create-aprove-post an expense - Go to the accounting dashboard Issue: expenses' amount is 0 Cause: In `_count_results_and_sum_amounts`, since the expense.currency is the same as the company we don't get the correct result: https://github.com/odoo/odoo/blob/d29a622740f6c34d25c52add5367bfdf58bbaf49/addons/account/models/account_journal_dashboard.py#L641-L644 Solution: Get the right columns. We also change the domain to make sure that expenses partially paid are also displayed. Note: For the test we check that even partially paid expenses are displayed. In Master we want the residual amount to be displayed. In master: Use the amount_residual (discussed with po Laura) opw-3849036 closes odoo#162182 Signed-off-by: John Laterre (jol) <jol@odoo.com>
- Loading branch information
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from odoo.tools.misc import format_amount | ||
|
||
from odoo.addons.hr_expense.tests.common import TestExpenseCommon | ||
from odoo.tests import tagged | ||
|
||
|
||
@tagged('post_install', '-at_install') | ||
class TestAccountJournalDashboard(TestExpenseCommon): | ||
|
||
def test_expense_journal_numbers_and_sums(self): | ||
journal = self.company_data['default_journal_purchase'] | ||
company_currency = self.env.company.currency_id | ||
expense_sheet = self.create_expense_report() | ||
expense_sheet.action_submit_sheet() | ||
expense_sheet.action_approve_expense_sheets() | ||
expense_sheet.action_sheet_move_create() | ||
|
||
expense_sheet.flush_recordset() | ||
dashboard_data = journal._get_journal_dashboard_data_batched()[journal.id] | ||
self.assertEqual(dashboard_data['sum_expenses_to_pay'], format_amount(self.env, 1000, company_currency)) | ||
|
||
payment = self.get_new_payment(expense_sheet, 250.0) | ||
expense_sheet.flush_recordset() | ||
payment.flush_recordset() | ||
dashboard_data = journal._get_journal_dashboard_data_batched()[journal.id] | ||
# todo master: have 750 (residual amount will be used) | ||
# we still want to assert a second time in order to make sure that partially paid expenses are displayed | ||
self.assertEqual(dashboard_data['sum_expenses_to_pay'], format_amount(self.env, 1000, company_currency)) |