[account_financial_report] adds the following features to Trial Balance:
- Adds 'Period balance' column - Renames the option 'Hide accounts at 0'. Means no initial, no debit, credit or ending balance for the period. - Fixes logic to remove lines with 0 activity for the period. - improve the calculation in the Trial Balance of undistributed profits/losses account, and provide a footer note to the user explaining why will the ending balances will not be zero, but the period's total profit and loss. - add an extra line for P&L application so that the trial balance zeroes in the balance, and total debits = total credits - refactoring of the unaffected earnings reporting in the general ledger and trial balance.pull/939/head
parent
199e416687
commit
5e70ed14f5
|
@ -109,10 +109,15 @@ msgstr ""
|
||||||
msgid "Account Type"
|
msgid "Account Type"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: account_financial_report
|
||||||
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:108
|
||||||
|
#, python-format
|
||||||
|
msgid "Account at 0 filter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. module: account_financial_report
|
#. module: account_financial_report
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:76
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:76
|
||||||
#: code:addons/account_financial_report/report/open_items_xlsx.py:61
|
#: code:addons/account_financial_report/report/open_items_xlsx.py:61
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:100
|
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_open_items_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_open_items_filters
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_trial_balance_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_trial_balance_filters
|
||||||
|
@ -257,7 +262,7 @@ msgstr ""
|
||||||
#: code:addons/account_financial_report/report/aged_partner_balance_xlsx.py:124
|
#: code:addons/account_financial_report/report/aged_partner_balance_xlsx.py:124
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:74
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:74
|
||||||
#: code:addons/account_financial_report/report/open_items_xlsx.py:59
|
#: code:addons/account_financial_report/report/open_items_xlsx.py:59
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:98
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:106
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_aged_partner_balance_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_aged_partner_balance_filters
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_open_items_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_open_items_filters
|
||||||
|
@ -270,7 +275,7 @@ msgstr ""
|
||||||
#: code:addons/account_financial_report/report/aged_partner_balance_xlsx.py:124
|
#: code:addons/account_financial_report/report/aged_partner_balance_xlsx.py:124
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:74
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:74
|
||||||
#: code:addons/account_financial_report/report/open_items_xlsx.py:59
|
#: code:addons/account_financial_report/report/open_items_xlsx.py:59
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:98
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:106
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_aged_partner_balance_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_aged_partner_balance_filters
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_open_items_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_open_items_filters
|
||||||
|
@ -462,6 +467,18 @@ msgstr ""
|
||||||
msgid "Computed Accounts"
|
msgid "Computed Accounts"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: account_financial_report
|
||||||
|
#: model:ir.model.fields,help:account_financial_report.field_report_trial_balance_hierarchy_on
|
||||||
|
#: model:ir.model.fields,help:account_financial_report.field_trial_balance_report_wizard_hierarchy_on
|
||||||
|
msgid "Computed Accounts: Use when the account group have codes\n"
|
||||||
|
" that represent prefixes of the actual accounts.\n"
|
||||||
|
"\n"
|
||||||
|
" Child Accounts: Use when your account groups are hierarchical.\n"
|
||||||
|
"\n"
|
||||||
|
" No hierarchy: Use to display just the accounts, without any grouping.\n"
|
||||||
|
" "
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. module: account_financial_report
|
#. module: account_financial_report
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_lines
|
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_lines
|
||||||
msgid "Cost\n"
|
msgid "Cost\n"
|
||||||
|
@ -553,7 +570,7 @@ msgstr ""
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:38
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:38
|
||||||
#: code:addons/account_financial_report/report/journal_ledger_xlsx.py:65
|
#: code:addons/account_financial_report/report/journal_ledger_xlsx.py:65
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:29
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:29
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:66
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:70
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_report_general_ledger_move_line_credit
|
#: model:ir.model.fields,field_description:account_financial_report.field_report_general_ledger_move_line_credit
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_report_journal_ledger_journal_credit
|
#: model:ir.model.fields,field_description:account_financial_report.field_report_journal_ledger_journal_credit
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_report_journal_ledger_move_line_credit
|
#: model:ir.model.fields,field_description:account_financial_report.field_report_journal_ledger_move_line_credit
|
||||||
|
@ -618,8 +635,8 @@ msgstr ""
|
||||||
#. module: account_financial_report
|
#. module: account_financial_report
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:53
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:53
|
||||||
#: code:addons/account_financial_report/report/open_items_xlsx.py:36
|
#: code:addons/account_financial_report/report/open_items_xlsx.py:36
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:40
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:44
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:77
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:85
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_lines
|
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_lines
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_journal_ledger_journal_table_header
|
#: model:ir.ui.view,arch_db:account_financial_report.report_journal_ledger_journal_table_header
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_open_items_lines
|
#: model:ir.ui.view,arch_db:account_financial_report.report_open_items_lines
|
||||||
|
@ -753,7 +770,7 @@ msgstr ""
|
||||||
#. module: account_financial_report
|
#. module: account_financial_report
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:71
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:71
|
||||||
#: code:addons/account_financial_report/report/journal_ledger_xlsx.py:168
|
#: code:addons/account_financial_report/report/journal_ledger_xlsx.py:168
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:95
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:103
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_trial_balance_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_trial_balance_filters
|
||||||
#, python-format
|
#, python-format
|
||||||
|
@ -770,7 +787,7 @@ msgstr ""
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:32
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:32
|
||||||
#: code:addons/account_financial_report/report/journal_ledger_xlsx.py:59
|
#: code:addons/account_financial_report/report/journal_ledger_xlsx.py:59
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:25
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:25
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:62
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:66
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_report_general_ledger_move_line_debit
|
#: model:ir.model.fields,field_description:account_financial_report.field_report_general_ledger_move_line_debit
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_report_journal_ledger_journal_debit
|
#: model:ir.model.fields,field_description:account_financial_report.field_report_journal_ledger_journal_debit
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_report_journal_ledger_move_line_debit
|
#: model:ir.model.fields,field_description:account_financial_report.field_report_journal_ledger_move_line_debit
|
||||||
|
@ -881,10 +898,10 @@ msgstr ""
|
||||||
#. module: account_financial_report
|
#. module: account_financial_report
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:162
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:162
|
||||||
#: code:addons/account_financial_report/report/open_items_xlsx.py:117
|
#: code:addons/account_financial_report/report/open_items_xlsx.py:117
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:33
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:37
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:48
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:52
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:70
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:78
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:85
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:93
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_ending_cumul
|
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_ending_cumul
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_trial_balance_lines_header
|
#: model:ir.ui.view,arch_db:account_financial_report.report_trial_balance_lines_header
|
||||||
#, python-format
|
#, python-format
|
||||||
|
@ -1068,7 +1085,7 @@ msgstr ""
|
||||||
#. module: account_financial_report
|
#. module: account_financial_report
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:72
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:72
|
||||||
#: code:addons/account_financial_report/report/journal_ledger_xlsx.py:169
|
#: code:addons/account_financial_report/report/journal_ledger_xlsx.py:169
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:96
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:104
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "From: %s To: %s"
|
msgid "From: %s To: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -1122,7 +1139,7 @@ msgstr ""
|
||||||
#. module: account_financial_report
|
#. module: account_financial_report
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:77
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:77
|
||||||
#: code:addons/account_financial_report/report/open_items_xlsx.py:62
|
#: code:addons/account_financial_report/report/open_items_xlsx.py:62
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:101
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:109
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_open_items_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_open_items_filters
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_trial_balance_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_trial_balance_filters
|
||||||
|
@ -1130,20 +1147,28 @@ msgstr ""
|
||||||
msgid "Hide"
|
msgid "Hide"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: account_financial_report
|
||||||
|
#: model:ir.model.fields,field_description:account_financial_report.field_report_trial_balance_hide_account_at_0
|
||||||
|
msgid "Hide Account At 0"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. module: account_financial_report
|
#. module: account_financial_report
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_report_general_ledger_hide_account_balance_at_0
|
#: model:ir.model.fields,field_description:account_financial_report.field_report_general_ledger_hide_account_balance_at_0
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_report_open_items_hide_account_balance_at_0
|
#: model:ir.model.fields,field_description:account_financial_report.field_report_open_items_hide_account_balance_at_0
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_report_trial_balance_hide_account_balance_at_0
|
|
||||||
msgid "Hide Account Balance At 0"
|
msgid "Hide Account Balance At 0"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: account_financial_report
|
#. module: account_financial_report
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard_hide_account_balance_at_0
|
#: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard_hide_account_balance_at_0
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_open_items_report_wizard_hide_account_balance_at_0
|
#: model:ir.model.fields,field_description:account_financial_report.field_open_items_report_wizard_hide_account_balance_at_0
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_trial_balance_report_wizard_hide_account_balance_at_0
|
|
||||||
msgid "Hide account ending balance at 0"
|
msgid "Hide account ending balance at 0"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: account_financial_report
|
||||||
|
#: model:ir.model.fields,field_description:account_financial_report.field_trial_balance_report_wizard_hide_account_at_0
|
||||||
|
msgid "Hide accounts at 0"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. module: account_financial_report
|
#. module: account_financial_report
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_report_trial_balance_hierarchy_on
|
#: model:ir.model.fields,field_description:account_financial_report.field_report_trial_balance_hierarchy_on
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_trial_balance_report_wizard_hierarchy_on
|
#: model:ir.model.fields,field_description:account_financial_report.field_trial_balance_report_wizard_hierarchy_on
|
||||||
|
@ -1235,9 +1260,9 @@ msgstr ""
|
||||||
#. module: account_financial_report
|
#. module: account_financial_report
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:150
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:150
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:21
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:21
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:44
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:48
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:58
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:62
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:81
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:89
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_lines
|
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_lines
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Initial balance"
|
msgid "Initial balance"
|
||||||
|
@ -1501,7 +1526,7 @@ msgstr ""
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:79
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:79
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:81
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:81
|
||||||
#: code:addons/account_financial_report/report/open_items_xlsx.py:64
|
#: code:addons/account_financial_report/report/open_items_xlsx.py:64
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:103
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:111
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "No"
|
msgid "No"
|
||||||
|
@ -1513,6 +1538,12 @@ msgstr ""
|
||||||
msgid "No group"
|
msgid "No group"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: account_financial_report
|
||||||
|
#: selection:report_trial_balance,hierarchy_on:0
|
||||||
|
#: selection:trial.balance.report.wizard,hierarchy_on:0
|
||||||
|
msgid "No hierarchy"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. module: account_financial_report
|
#. module: account_financial_report
|
||||||
#: code:addons/account_financial_report/report/general_ledger.py:688
|
#: code:addons/account_financial_report/report/general_ledger.py:688
|
||||||
#: code:addons/account_financial_report/report/general_ledger.py:985
|
#: code:addons/account_financial_report/report/general_ledger.py:985
|
||||||
|
@ -1608,7 +1639,7 @@ msgstr ""
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:26
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:26
|
||||||
#: code:addons/account_financial_report/report/journal_ledger_xlsx.py:44
|
#: code:addons/account_financial_report/report/journal_ledger_xlsx.py:44
|
||||||
#: code:addons/account_financial_report/report/open_items_xlsx.py:21
|
#: code:addons/account_financial_report/report/open_items_xlsx.py:21
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:57
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:61
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_report_aged_partner_balance_account_partner_ids
|
#: model:ir.model.fields,field_description:account_financial_report.field_report_aged_partner_balance_account_partner_ids
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_report_aged_partner_balance_line_partner
|
#: model:ir.model.fields,field_description:account_financial_report.field_report_aged_partner_balance_line_partner
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_report_aged_partner_balance_move_line_partner
|
#: model:ir.model.fields,field_description:account_financial_report.field_report_aged_partner_balance_move_line_partner
|
||||||
|
@ -1706,6 +1737,20 @@ msgstr ""
|
||||||
msgid "Percents"
|
msgid "Percents"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: account_financial_report
|
||||||
|
#: model:ir.model.fields,field_description:account_financial_report.field_report_trial_balance_account_period_balance
|
||||||
|
#: model:ir.model.fields,field_description:account_financial_report.field_report_trial_balance_partner_period_balance
|
||||||
|
msgid "Period Balance"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: account_financial_report
|
||||||
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:33
|
||||||
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:74
|
||||||
|
#: model:ir.ui.view,arch_db:account_financial_report.report_trial_balance_lines_header
|
||||||
|
#, python-format
|
||||||
|
msgid "Period balance"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. module: account_financial_report
|
#. module: account_financial_report
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.journal_ledger_wizard
|
#: model:ir.ui.view,arch_db:account_financial_report.journal_ledger_wizard
|
||||||
msgid "Periods"
|
msgid "Periods"
|
||||||
|
@ -1837,7 +1882,7 @@ msgstr ""
|
||||||
#. module: account_financial_report
|
#. module: account_financial_report
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:77
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:77
|
||||||
#: code:addons/account_financial_report/report/open_items_xlsx.py:62
|
#: code:addons/account_financial_report/report/open_items_xlsx.py:62
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:101
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:109
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_open_items_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_open_items_filters
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_trial_balance_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_trial_balance_filters
|
||||||
|
@ -1865,7 +1910,7 @@ msgstr ""
|
||||||
#. module: account_financial_report
|
#. module: account_financial_report
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:80
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:80
|
||||||
#: code:addons/account_financial_report/report/open_items_xlsx.py:63
|
#: code:addons/account_financial_report/report/open_items_xlsx.py:63
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:102
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:110
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard_foreign_currency
|
#: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard_foreign_currency
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_open_items_report_wizard_foreign_currency
|
#: model:ir.model.fields,field_description:account_financial_report.field_open_items_report_wizard_foreign_currency
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_trial_balance_report_wizard_foreign_currency
|
#: model:ir.model.fields,field_description:account_financial_report.field_trial_balance_report_wizard_foreign_currency
|
||||||
|
@ -1906,7 +1951,7 @@ msgstr ""
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:73
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:73
|
||||||
#: code:addons/account_financial_report/report/journal_ledger_xlsx.py:172
|
#: code:addons/account_financial_report/report/journal_ledger_xlsx.py:172
|
||||||
#: code:addons/account_financial_report/report/open_items_xlsx.py:58
|
#: code:addons/account_financial_report/report/open_items_xlsx.py:58
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:97
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:105
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_aged_partner_balance_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_aged_partner_balance_filters
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_open_items_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_open_items_filters
|
||||||
|
@ -2067,7 +2112,6 @@ msgstr ""
|
||||||
#. module: account_financial_report
|
#. module: account_financial_report
|
||||||
#: model:ir.model.fields,help:account_financial_report.field_general_ledger_report_wizard_hide_account_balance_at_0
|
#: model:ir.model.fields,help:account_financial_report.field_general_ledger_report_wizard_hide_account_balance_at_0
|
||||||
#: model:ir.model.fields,help:account_financial_report.field_open_items_report_wizard_hide_account_balance_at_0
|
#: model:ir.model.fields,help:account_financial_report.field_open_items_report_wizard_hide_account_balance_at_0
|
||||||
#: model:ir.model.fields,help:account_financial_report.field_trial_balance_report_wizard_hide_account_balance_at_0
|
|
||||||
msgid "Use this filter to hide an account or a partner with an ending balance at 0. If partners are filtered, debits and credits totals will not match the trial balance."
|
msgid "Use this filter to hide an account or a partner with an ending balance at 0. If partners are filtered, debits and credits totals will not match the trial balance."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -2103,6 +2147,11 @@ msgstr ""
|
||||||
msgid "View"
|
msgid "View"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: account_financial_report
|
||||||
|
#: model:ir.model.fields,help:account_financial_report.field_trial_balance_report_wizard_hide_account_at_0
|
||||||
|
msgid "When this option is enabled, the trial balance will not display accounts that have initial balance = debit = credit = end balance = 0"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. module: account_financial_report
|
#. module: account_financial_report
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard_with_account_name
|
#: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard_with_account_name
|
||||||
#: model:ir.model.fields,field_description:account_financial_report.field_report_journal_ledger_with_account_name
|
#: model:ir.model.fields,field_description:account_financial_report.field_report_journal_ledger_with_account_name
|
||||||
|
@ -2113,7 +2162,7 @@ msgstr ""
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:79
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:79
|
||||||
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:81
|
#: code:addons/account_financial_report/report/general_ledger_xlsx.py:81
|
||||||
#: code:addons/account_financial_report/report/open_items_xlsx.py:64
|
#: code:addons/account_financial_report/report/open_items_xlsx.py:64
|
||||||
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:103
|
#: code:addons/account_financial_report/report/trial_balance_xlsx.py:111
|
||||||
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
#: model:ir.ui.view,arch_db:account_financial_report.report_general_ledger_filters
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Yes"
|
msgid "Yes"
|
||||||
|
|
|
@ -21,6 +21,7 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
|
|
||||||
# Formats
|
# Formats
|
||||||
self.format_right = None
|
self.format_right = None
|
||||||
|
self.format_left = None
|
||||||
self.format_right_bold_italic = None
|
self.format_right_bold_italic = None
|
||||||
self.format_bold = None
|
self.format_bold = None
|
||||||
self.format_header_left = None
|
self.format_header_left = None
|
||||||
|
@ -41,6 +42,7 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
self._define_formats(workbook)
|
self._define_formats(workbook)
|
||||||
|
|
||||||
report_name = self._get_report_name()
|
report_name = self._get_report_name()
|
||||||
|
report_footer = self._get_report_footer()
|
||||||
filters = self._get_report_filters(report)
|
filters = self._get_report_filters(report)
|
||||||
self.columns = self._get_report_columns(report)
|
self.columns = self._get_report_columns(report)
|
||||||
self.workbook = workbook
|
self.workbook = workbook
|
||||||
|
@ -54,6 +56,8 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
|
|
||||||
self._generate_report_content(workbook, report)
|
self._generate_report_content(workbook, report)
|
||||||
|
|
||||||
|
self._write_report_footer(report_footer)
|
||||||
|
|
||||||
def _define_formats(self, workbook):
|
def _define_formats(self, workbook):
|
||||||
""" Add cell formats to current workbook.
|
""" Add cell formats to current workbook.
|
||||||
Those formats can be used on all cell.
|
Those formats can be used on all cell.
|
||||||
|
@ -71,6 +75,7 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
"""
|
"""
|
||||||
self.format_bold = workbook.add_format({'bold': True})
|
self.format_bold = workbook.add_format({'bold': True})
|
||||||
self.format_right = workbook.add_format({'align': 'right'})
|
self.format_right = workbook.add_format({'align': 'right'})
|
||||||
|
self.format_left = workbook.add_format({'align': 'left'})
|
||||||
self.format_right_bold_italic = workbook.add_format(
|
self.format_right_bold_italic = workbook.add_format(
|
||||||
{'align': 'right', 'bold': True, 'italic': True}
|
{'align': 'right', 'bold': True, 'italic': True}
|
||||||
)
|
)
|
||||||
|
@ -120,6 +125,18 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
)
|
)
|
||||||
self.row_pos += 3
|
self.row_pos += 3
|
||||||
|
|
||||||
|
def _write_report_footer(self, footer):
|
||||||
|
"""Write report footer .
|
||||||
|
Columns are defined with `_get_report_columns` method.
|
||||||
|
"""
|
||||||
|
if footer:
|
||||||
|
self.row_pos += 1
|
||||||
|
self.sheet.merge_range(
|
||||||
|
self.row_pos, 0, self.row_pos, len(self.columns) - 1,
|
||||||
|
footer, self.format_left
|
||||||
|
)
|
||||||
|
self.row_pos += 1
|
||||||
|
|
||||||
def _write_filters(self, filters):
|
def _write_filters(self, filters):
|
||||||
"""Write one line per filters on starting on current line.
|
"""Write one line per filters on starting on current line.
|
||||||
Columns number for filter name is defined
|
Columns number for filter name is defined
|
||||||
|
@ -322,6 +339,13 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
def _get_report_footer(self):
|
||||||
|
"""
|
||||||
|
Allow to define the report footer.
|
||||||
|
:return: the report footer
|
||||||
|
"""
|
||||||
|
return False
|
||||||
|
|
||||||
def _get_report_columns(self, report):
|
def _get_report_columns(self, report):
|
||||||
"""
|
"""
|
||||||
Allow to define the report columns
|
Allow to define the report columns
|
||||||
|
|
|
@ -1287,173 +1287,9 @@ ORDER BY
|
||||||
query_inject_move_line_centralized_params
|
query_inject_move_line_centralized_params
|
||||||
)
|
)
|
||||||
|
|
||||||
def _get_unaffected_earnings_account_sub_subquery_sum_initial(
|
|
||||||
self
|
|
||||||
):
|
|
||||||
""" Return subquery used to compute sum amounts on
|
|
||||||
unaffected earnings accounts """
|
|
||||||
sub_subquery_sum_amounts = """
|
|
||||||
SELECT
|
|
||||||
SUM(ml.balance) AS initial_balance,
|
|
||||||
0.0 AS final_balance
|
|
||||||
FROM
|
|
||||||
account_account a
|
|
||||||
INNER JOIN
|
|
||||||
account_account_type at ON a.user_type_id = at.id
|
|
||||||
INNER JOIN
|
|
||||||
account_move_line ml
|
|
||||||
ON a.id = ml.account_id
|
|
||||||
AND ml.date < %(date_from)s
|
|
||||||
"""
|
|
||||||
if self.only_posted_moves:
|
|
||||||
sub_subquery_sum_amounts += """
|
|
||||||
INNER JOIN
|
|
||||||
account_move m ON ml.move_id = m.id AND m.state = 'posted'
|
|
||||||
"""
|
|
||||||
if self.filter_cost_center_ids:
|
|
||||||
sub_subquery_sum_amounts += """
|
|
||||||
INNER JOIN
|
|
||||||
account_analytic_account aa
|
|
||||||
ON
|
|
||||||
ml.analytic_account_id = aa.id
|
|
||||||
AND aa.id IN %(cost_center_ids)s
|
|
||||||
"""
|
|
||||||
sub_subquery_sum_amounts += """
|
|
||||||
WHERE
|
|
||||||
a.company_id = %(company_id)s
|
|
||||||
AND
|
|
||||||
a.id IN %(unaffected_earnings_account_ids)s
|
|
||||||
"""
|
|
||||||
if self.filter_journal_ids:
|
|
||||||
sub_subquery_sum_amounts += """
|
|
||||||
AND
|
|
||||||
ml.journal_id in %(filter_journal_ids)s
|
|
||||||
"""
|
|
||||||
return sub_subquery_sum_amounts
|
|
||||||
|
|
||||||
def _get_unaffected_earnings_account_sub_subquery_sum_final(self):
|
|
||||||
""" Return subquery used to compute sum amounts on
|
|
||||||
unaffected earnings accounts """
|
|
||||||
|
|
||||||
sub_subquery_sum_amounts = """
|
|
||||||
SELECT
|
|
||||||
0.0 AS initial_balance,
|
|
||||||
SUM(ml.balance) AS final_balance
|
|
||||||
"""
|
|
||||||
sub_subquery_sum_amounts += """
|
|
||||||
FROM
|
|
||||||
account_account a
|
|
||||||
INNER JOIN
|
|
||||||
account_account_type at ON a.user_type_id = at.id
|
|
||||||
INNER JOIN
|
|
||||||
account_move_line ml
|
|
||||||
ON a.id = ml.account_id
|
|
||||||
AND ml.date <= %(date_to)s
|
|
||||||
"""
|
|
||||||
if self.only_posted_moves:
|
|
||||||
sub_subquery_sum_amounts += """
|
|
||||||
INNER JOIN
|
|
||||||
account_move m ON ml.move_id = m.id AND m.state = 'posted'
|
|
||||||
"""
|
|
||||||
if self.filter_cost_center_ids:
|
|
||||||
sub_subquery_sum_amounts += """
|
|
||||||
INNER JOIN
|
|
||||||
account_analytic_account aa
|
|
||||||
ON
|
|
||||||
ml.analytic_account_id = aa.id
|
|
||||||
AND aa.id IN %(cost_center_ids)s
|
|
||||||
"""
|
|
||||||
sub_subquery_sum_amounts += """
|
|
||||||
WHERE
|
|
||||||
a.company_id = %(company_id)s
|
|
||||||
AND
|
|
||||||
a.id IN %(unaffected_earnings_account_ids)s
|
|
||||||
"""
|
|
||||||
if self.filter_journal_ids:
|
|
||||||
sub_subquery_sum_amounts += """
|
|
||||||
AND
|
|
||||||
ml.journal_id in %(filter_journal_ids)s
|
|
||||||
"""
|
|
||||||
return sub_subquery_sum_amounts
|
|
||||||
|
|
||||||
def _inject_unaffected_earnings_account_values(self):
|
def _inject_unaffected_earnings_account_values(self):
|
||||||
"""Inject the report values of the unaffected earnings account
|
"""Inject the report values of the unaffected earnings account
|
||||||
for report_general_ledger_account."""
|
for report_general_ledger_account."""
|
||||||
subquery_sum_amounts = """
|
|
||||||
SELECT
|
|
||||||
SUM(COALESCE(sub.initial_balance, 0.0)) AS initial_balance,
|
|
||||||
SUM(COALESCE(sub.final_balance, 0.0)) AS final_balance
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
"""
|
|
||||||
# Initial balances
|
|
||||||
subquery_sum_amounts += \
|
|
||||||
self._get_unaffected_earnings_account_sub_subquery_sum_initial()
|
|
||||||
subquery_sum_amounts += """
|
|
||||||
UNION
|
|
||||||
"""
|
|
||||||
subquery_sum_amounts += \
|
|
||||||
self._get_unaffected_earnings_account_sub_subquery_sum_final()
|
|
||||||
subquery_sum_amounts += """
|
|
||||||
) sub
|
|
||||||
"""
|
|
||||||
|
|
||||||
# pylint: disable=sql-injection
|
|
||||||
query_inject_account = """
|
|
||||||
WITH
|
|
||||||
sum_amounts AS ( """ + subquery_sum_amounts + """ )
|
|
||||||
INSERT INTO
|
|
||||||
report_general_ledger_account
|
|
||||||
(
|
|
||||||
report_id,
|
|
||||||
create_uid,
|
|
||||||
create_date,
|
|
||||||
account_id,
|
|
||||||
code,
|
|
||||||
name,
|
|
||||||
is_partner_account,
|
|
||||||
initial_balance,
|
|
||||||
final_balance,
|
|
||||||
currency_id
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
%(report_id)s AS report_id,
|
|
||||||
%(user_id)s AS create_uid,
|
|
||||||
NOW() AS create_date,
|
|
||||||
a.id AS account_id,
|
|
||||||
a.code,
|
|
||||||
a.name,
|
|
||||||
False AS is_partner_account,
|
|
||||||
COALESCE(i.initial_balance, 0.0) AS initial_balance,
|
|
||||||
COALESCE(i.final_balance, 0.0) AS final_balance,
|
|
||||||
c.id as currency_id
|
|
||||||
FROM
|
|
||||||
account_account a
|
|
||||||
LEFT JOIN
|
|
||||||
res_currency c ON c.id = a.currency_id,
|
|
||||||
sum_amounts i
|
|
||||||
WHERE
|
|
||||||
a.company_id = %(company_id)s
|
|
||||||
AND a.id = %(unaffected_earnings_account_id)s
|
|
||||||
"""
|
|
||||||
query_inject_account_params = {
|
|
||||||
'date_from': self.date_from,
|
|
||||||
'date_to': self.date_to,
|
|
||||||
'fy_start_date': self.fy_start_date,
|
|
||||||
}
|
|
||||||
if self.filter_cost_center_ids:
|
|
||||||
query_inject_account_params['cost_center_ids'] = \
|
|
||||||
tuple(self.filter_cost_center_ids.ids)
|
|
||||||
query_inject_account_params['company_id'] = self.company_id.id
|
|
||||||
query_inject_account_params['unaffected_earnings_account_id'] = \
|
|
||||||
self.unaffected_earnings_account.id
|
|
||||||
query_inject_account_params['report_id'] = self.id
|
|
||||||
query_inject_account_params['user_id'] = self.env.uid
|
|
||||||
|
|
||||||
if self.filter_journal_ids:
|
|
||||||
query_inject_account_params['filter_journal_ids'] = (tuple(
|
|
||||||
self.filter_journal_ids.ids,
|
|
||||||
),)
|
|
||||||
# Fetch the profit and loss accounts
|
# Fetch the profit and loss accounts
|
||||||
query_unaffected_earnings_account_ids = """
|
query_unaffected_earnings_account_ids = """
|
||||||
SELECT a.id
|
SELECT a.id
|
||||||
|
@ -1464,7 +1300,155 @@ ORDER BY
|
||||||
"""
|
"""
|
||||||
self.env.cr.execute(query_unaffected_earnings_account_ids)
|
self.env.cr.execute(query_unaffected_earnings_account_ids)
|
||||||
pl_account_ids = [r[0] for r in self.env.cr.fetchall()]
|
pl_account_ids = [r[0] for r in self.env.cr.fetchall()]
|
||||||
query_inject_account_params['unaffected_earnings_account_ids'] = \
|
unaffected_earnings_account_ids = \
|
||||||
tuple(pl_account_ids + [self.unaffected_earnings_account.id])
|
pl_account_ids + [self.unaffected_earnings_account.id]
|
||||||
|
# Fetch the current fiscal year start date
|
||||||
|
date = fields.Datetime.from_string(self.date_from)
|
||||||
|
res = self.company_id.compute_fiscalyear_dates(date)
|
||||||
|
fy_start_date = res['date_from']
|
||||||
|
query_select_previous_fy_unaffected_earnings_params = {
|
||||||
|
'date_to': fy_start_date,
|
||||||
|
'company_id': self.company_id.id,
|
||||||
|
'account_ids': tuple(unaffected_earnings_account_ids),
|
||||||
|
}
|
||||||
|
query_select_previous_fy_unaffected_earnings = """
|
||||||
|
SELECT sum(aml.balance) as balance
|
||||||
|
FROM account_move_line as aml
|
||||||
|
INNER JOIN account_move as am
|
||||||
|
ON am.id = aml.move_id
|
||||||
|
INNER JOIN account_journal j
|
||||||
|
ON am.journal_id = j.id
|
||||||
|
"""
|
||||||
|
if self.filter_cost_center_ids:
|
||||||
|
query_select_previous_fy_unaffected_earnings += """
|
||||||
|
INNER JOIN account_analytic_account aa
|
||||||
|
ON aml.analytic_account_id = aa.id
|
||||||
|
AND aa.id IN %(cost_center_ids)s
|
||||||
|
"""
|
||||||
|
query_select_previous_fy_unaffected_earnings_params[
|
||||||
|
'cost_center_ids'] = tuple(self.filter_cost_center_ids.ids)
|
||||||
|
|
||||||
|
query_select_previous_fy_unaffected_earnings += """
|
||||||
|
WHERE aml.date < %(date_to)s
|
||||||
|
AND aml.company_id = %(company_id)s
|
||||||
|
AND aml.account_id IN %(account_ids)s
|
||||||
|
"""
|
||||||
|
if self.filter_journal_ids:
|
||||||
|
query_select_previous_fy_unaffected_earnings += """
|
||||||
|
AND j.id IN %(journal_ids)s
|
||||||
|
"""
|
||||||
|
query_select_previous_fy_unaffected_earnings_params[
|
||||||
|
'journal_ids'] = tuple(self.filter_journal_ids.ids)
|
||||||
|
if self.only_posted_moves:
|
||||||
|
query_select_previous_fy_unaffected_earnings += """
|
||||||
|
AND am.state = 'posted'
|
||||||
|
"""
|
||||||
|
self.env.cr.execute(
|
||||||
|
query_select_previous_fy_unaffected_earnings,
|
||||||
|
query_select_previous_fy_unaffected_earnings_params)
|
||||||
|
res = self.env.cr.fetchone()
|
||||||
|
unaffected_earnings_initial_balance = res[0] or 0.0
|
||||||
|
# Now select the current period unaffected earnings,
|
||||||
|
# excluding the current period P&L.
|
||||||
|
query_select_period_unaffected_earnings_params = {
|
||||||
|
'date_from': self.date_from,
|
||||||
|
'date_to': self.date_to,
|
||||||
|
'company_id': self.company_id.id,
|
||||||
|
'unaffected_earnings_id': self.unaffected_earnings_account.id,
|
||||||
|
}
|
||||||
|
query_select_period_unaffected_earnings = """
|
||||||
|
SELECT
|
||||||
|
sum(aml.debit) as sum_debit,
|
||||||
|
sum(aml.credit) as sum_credit,
|
||||||
|
sum(aml.balance) as balance
|
||||||
|
FROM account_move_line as aml
|
||||||
|
INNER JOIN account_move as am
|
||||||
|
ON am.id = aml.move_id
|
||||||
|
INNER JOIN account_journal j
|
||||||
|
ON am.journal_id = j.id
|
||||||
|
"""
|
||||||
|
if self.filter_cost_center_ids:
|
||||||
|
query_select_period_unaffected_earnings += """
|
||||||
|
INNER JOIN account_analytic_account aa
|
||||||
|
ON aml.analytic_account_id = aa.id
|
||||||
|
AND aa.id IN %(cost_center_ids)s
|
||||||
|
"""
|
||||||
|
query_select_period_unaffected_earnings_params[
|
||||||
|
'cost_center_ids'] = tuple(self.filter_cost_center_ids.ids)
|
||||||
|
query_select_period_unaffected_earnings += """
|
||||||
|
WHERE am.date >= %(date_from)s
|
||||||
|
AND aml.date <= %(date_to)s
|
||||||
|
AND aml.company_id = %(company_id)s
|
||||||
|
AND aml.account_id = %(unaffected_earnings_id)s
|
||||||
|
"""
|
||||||
|
if self.filter_journal_ids:
|
||||||
|
query_select_period_unaffected_earnings += """
|
||||||
|
AND j.id IN %(journal_ids)s
|
||||||
|
"""
|
||||||
|
query_select_period_unaffected_earnings_params[
|
||||||
|
'journal_ids'] = tuple(self.filter_journal_ids.ids)
|
||||||
|
if self.only_posted_moves:
|
||||||
|
query_select_period_unaffected_earnings += """
|
||||||
|
AND am.state = 'posted'
|
||||||
|
"""
|
||||||
|
self.env.cr.execute(query_select_period_unaffected_earnings,
|
||||||
|
query_select_period_unaffected_earnings_params)
|
||||||
|
res = self.env.cr.fetchone()
|
||||||
|
unaffected_earnings_period_debit = res[0] or 0.0
|
||||||
|
unaffected_earnings_period_credit = res[1] or 0.0
|
||||||
|
unaffected_earnings_period_balance = res[2] or 0.0
|
||||||
|
# pylint: disable=sql-injection
|
||||||
|
query_inject_account = """
|
||||||
|
INSERT INTO
|
||||||
|
report_general_ledger_account (
|
||||||
|
report_id,
|
||||||
|
create_uid,
|
||||||
|
create_date,
|
||||||
|
account_id,
|
||||||
|
code,
|
||||||
|
name,
|
||||||
|
is_partner_account,
|
||||||
|
initial_debit,
|
||||||
|
initial_credit,
|
||||||
|
initial_balance,
|
||||||
|
final_debit,
|
||||||
|
final_credit,
|
||||||
|
final_balance
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
%(report_id)s,
|
||||||
|
%(user_id)s,
|
||||||
|
NOW(),
|
||||||
|
%(account_id)s,
|
||||||
|
%(code)s,
|
||||||
|
%(name)s,
|
||||||
|
False,
|
||||||
|
%(initial_debit)s,
|
||||||
|
%(initial_credit)s,
|
||||||
|
%(initial_balance)s,
|
||||||
|
%(final_debit)s,
|
||||||
|
%(final_credit)s,
|
||||||
|
%(final_balance)s
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
initial_debit = unaffected_earnings_initial_balance >= 0 and \
|
||||||
|
unaffected_earnings_initial_balance or 0
|
||||||
|
initial_credit = unaffected_earnings_initial_balance < 0 and \
|
||||||
|
-1 * unaffected_earnings_initial_balance or 0
|
||||||
|
final_balance = unaffected_earnings_initial_balance + \
|
||||||
|
unaffected_earnings_period_balance
|
||||||
|
query_inject_account_params = {
|
||||||
|
'report_id': self.id,
|
||||||
|
'user_id': self.env.uid,
|
||||||
|
'account_id': self.unaffected_earnings_account.id,
|
||||||
|
'code': self.unaffected_earnings_account.code,
|
||||||
|
'name': self.unaffected_earnings_account.name,
|
||||||
|
'initial_debit': initial_debit,
|
||||||
|
'initial_credit': initial_credit,
|
||||||
|
'initial_balance': unaffected_earnings_initial_balance,
|
||||||
|
'final_debit': initial_debit + unaffected_earnings_period_debit,
|
||||||
|
'final_credit': initial_credit + unaffected_earnings_period_credit,
|
||||||
|
'final_balance': final_balance,
|
||||||
|
}
|
||||||
self.env.cr.execute(query_inject_account,
|
self.env.cr.execute(query_inject_account,
|
||||||
query_inject_account_params)
|
query_inject_account_params)
|
||||||
|
|
|
@ -35,7 +35,12 @@
|
||||||
<!-- Adapt -->
|
<!-- Adapt -->
|
||||||
<t t-set="style" t-value="'font-size:8px;'"/>
|
<t t-set="style" t-value="'font-size:8px;'"/>
|
||||||
<t t-set="padding" t-value="line.level * 4"/>
|
<t t-set="padding" t-value="line.level * 4"/>
|
||||||
<t t-set="style" t-value="'font-size: ' + str(14 - line.level) + 'px; margin-left: ' + str(line.level * 4) + 'px;'"/>
|
<t t-if="o.hide_account_at_0">
|
||||||
|
<t t-set="style" t-value="'font-size: 14px;'"/>
|
||||||
|
</t>
|
||||||
|
<t t-if="not o.hide_account_at_0">
|
||||||
|
<t t-set="style" t-value="'font-size: ' + str(14 - line.level) + 'px; margin-left: ' + str(line.level * 4) + 'px;'"/>
|
||||||
|
</t>
|
||||||
<t t-if="line.account_group_id">
|
<t t-if="line.account_group_id">
|
||||||
<t t-set="style" t-value="style + 'font-weight: bold; color: blue;'"/>
|
<t t-set="style" t-value="style + 'font-weight: bold; color: blue;'"/>
|
||||||
</t>
|
</t>
|
||||||
|
@ -96,7 +101,6 @@
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_trial_balance_filters">
|
<template id="account_financial_report.report_trial_balance_filters">
|
||||||
<div class="act_as_table data_table" style="width: 100%;">
|
<div class="act_as_table data_table" style="width: 100%;">
|
||||||
<div class="act_as_row labels">
|
<div class="act_as_row labels">
|
||||||
|
@ -113,8 +117,8 @@
|
||||||
<t t-if="not o.only_posted_moves">All entries</t>
|
<t t-if="not o.only_posted_moves">All entries</t>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell">
|
<div class="act_as_cell">
|
||||||
<t t-if="o.hide_account_balance_at_0">Hide</t>
|
<t t-if="o.hide_account_at_0">Hide</t>
|
||||||
<t t-if="not o.hide_account_balance_at_0">Show</t>
|
<t t-if="not o.hide_account_at_0">Show</t>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -143,6 +147,8 @@
|
||||||
<div class="act_as_cell" style="width: 9.64%;">Debit</div>
|
<div class="act_as_cell" style="width: 9.64%;">Debit</div>
|
||||||
<!--## Credit-->
|
<!--## Credit-->
|
||||||
<div class="act_as_cell" style="width: 9.64%;">Credit</div>
|
<div class="act_as_cell" style="width: 9.64%;">Credit</div>
|
||||||
|
<!--## Period balance-->
|
||||||
|
<div class="act_as_cell" style="width: 9.64%;">Period balance</div>
|
||||||
<!--## Ending balance-->
|
<!--## Ending balance-->
|
||||||
<div class="act_as_cell" style="width: 9.64%;">Ending balance</div>
|
<div class="act_as_cell" style="width: 9.64%;">Ending balance</div>
|
||||||
<t t-if="foreign_currency">
|
<t t-if="foreign_currency">
|
||||||
|
@ -359,6 +365,38 @@
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
|
<!--## Period balance-->
|
||||||
|
<div class="act_as_cell amount">
|
||||||
|
<t t-if="type == 'account_type'">
|
||||||
|
<t t-if="line.account_id">
|
||||||
|
<t t-set="domain"
|
||||||
|
t-value="[('account_id', '=', line.account_id.id),
|
||||||
|
('date', '>=', line.report_id.date_from),
|
||||||
|
('date', '<=', line.report_id.date_to)]"/>
|
||||||
|
<span>
|
||||||
|
<a t-att-data-domain="domain"
|
||||||
|
t-att-data-res-model="'account.move.line'"
|
||||||
|
class="o_account_financial_reports_web_action_monetary_multi"
|
||||||
|
t-att-style="style">
|
||||||
|
<t t-att-style="style" t-raw="line.period_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
|
||||||
|
</span>
|
||||||
|
</t>
|
||||||
|
</t>
|
||||||
|
<t t-if="type == 'partner_type'">
|
||||||
|
<t t-set="domain"
|
||||||
|
t-value="[('account_id', '=', line.report_account_id.account_id.id),
|
||||||
|
('partner_id', '=', line.partner_id.id),
|
||||||
|
('date', '>=', line.report_account_id.report_id.date_from),
|
||||||
|
('date', '<=', line.report_account_id.report_id.date_to)]"/>
|
||||||
|
<span>
|
||||||
|
<a t-att-data-domain="domain"
|
||||||
|
t-att-data-res-model="'account.move.line'"
|
||||||
|
class="o_account_financial_reports_web_action_monetary_multi"
|
||||||
|
t-att-style="style">
|
||||||
|
<t t-att-style="style" t-raw="line.period_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
|
||||||
|
</span>
|
||||||
|
</t>
|
||||||
|
</div>
|
||||||
<!--## Ending balance-->
|
<!--## Ending balance-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<t t-if="type == 'account_type'">
|
<t t-if="type == 'account_type'">
|
||||||
|
@ -551,6 +589,21 @@
|
||||||
<t t-att-style="style" t-raw="account.credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
|
<t t-att-style="style" t-raw="account.credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<!--## Period Balance -->
|
||||||
|
<div class="act_as_cell amount" style="width: 9.64%;">
|
||||||
|
<t t-set="domain"
|
||||||
|
t-value="[('account_id', '=', account.account_id.id),
|
||||||
|
('date', '>=', account.report_id.date_from),
|
||||||
|
('date', '<=', account.report_id.date_to),
|
||||||
|
('period_balance', '<>', 0)]"/>
|
||||||
|
<span>
|
||||||
|
<a t-att-data-domain="domain"
|
||||||
|
t-att-data-res-model="'account.move.line'"
|
||||||
|
class="o_account_financial_reports_web_action_monetary_multi"
|
||||||
|
t-att-style="style">
|
||||||
|
<t t-att-style="style" t-raw="account.period_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<!--## Ending balance-->
|
<!--## Ending balance-->
|
||||||
<div class="act_as_cell amount" style="width: 9.64%;">
|
<div class="act_as_cell amount" style="width: 9.64%;">
|
||||||
<t t-set="domain"
|
<t t-set="domain"
|
||||||
|
|
|
@ -24,18 +24,26 @@ class TrialBalanceReport(models.TransientModel):
|
||||||
date_to = fields.Date()
|
date_to = fields.Date()
|
||||||
fy_start_date = fields.Date()
|
fy_start_date = fields.Date()
|
||||||
only_posted_moves = fields.Boolean()
|
only_posted_moves = fields.Boolean()
|
||||||
hide_account_balance_at_0 = fields.Boolean()
|
hide_account_at_0 = fields.Boolean()
|
||||||
foreign_currency = fields.Boolean()
|
foreign_currency = fields.Boolean()
|
||||||
company_id = fields.Many2one(comodel_name='res.company')
|
company_id = fields.Many2one(comodel_name='res.company')
|
||||||
filter_account_ids = fields.Many2many(comodel_name='account.account')
|
filter_account_ids = fields.Many2many(comodel_name='account.account')
|
||||||
filter_partner_ids = fields.Many2many(comodel_name='res.partner')
|
filter_partner_ids = fields.Many2many(comodel_name='res.partner')
|
||||||
filter_journal_ids = fields.Many2many(comodel_name='account.journal')
|
filter_journal_ids = fields.Many2many(comodel_name='account.journal')
|
||||||
show_partner_details = fields.Boolean()
|
show_partner_details = fields.Boolean()
|
||||||
hierarchy_on = fields.Selection([('computed', 'Computed Accounts'),
|
hierarchy_on = fields.Selection(
|
||||||
('relation', 'Child Accounts')],
|
[('computed', 'Computed Accounts'),
|
||||||
string='Hierarchy On',
|
('relation', 'Child Accounts'),
|
||||||
required=True,
|
('none', 'No hierarchy')],
|
||||||
default='computed')
|
string='Hierarchy On',
|
||||||
|
required=True,
|
||||||
|
default='computed',
|
||||||
|
help="""Computed Accounts: Use when the account group have codes
|
||||||
|
that represent prefixes of the actual accounts.\n
|
||||||
|
Child Accounts: Use when your account groups are hierarchical.\n
|
||||||
|
No hierarchy: Use to display just the accounts, without any grouping.
|
||||||
|
""",
|
||||||
|
)
|
||||||
|
|
||||||
# General Ledger Report Data fields,
|
# General Ledger Report Data fields,
|
||||||
# used as base for compute the data reports
|
# used as base for compute the data reports
|
||||||
|
@ -94,6 +102,7 @@ class TrialBalanceReportAccount(models.TransientModel):
|
||||||
initial_balance_foreign_currency = fields.Float(digits=(16, 2))
|
initial_balance_foreign_currency = fields.Float(digits=(16, 2))
|
||||||
debit = fields.Float(digits=(16, 2))
|
debit = fields.Float(digits=(16, 2))
|
||||||
credit = fields.Float(digits=(16, 2))
|
credit = fields.Float(digits=(16, 2))
|
||||||
|
period_balance = fields.Float(digits=(16, 2))
|
||||||
final_balance = fields.Float(digits=(16, 2))
|
final_balance = fields.Float(digits=(16, 2))
|
||||||
final_balance_foreign_currency = fields.Float(digits=(16, 2))
|
final_balance_foreign_currency = fields.Float(digits=(16, 2))
|
||||||
|
|
||||||
|
@ -128,6 +137,7 @@ class TrialBalanceReportPartner(models.TransientModel):
|
||||||
initial_balance_foreign_currency = fields.Float(digits=(16, 2))
|
initial_balance_foreign_currency = fields.Float(digits=(16, 2))
|
||||||
debit = fields.Float(digits=(16, 2))
|
debit = fields.Float(digits=(16, 2))
|
||||||
credit = fields.Float(digits=(16, 2))
|
credit = fields.Float(digits=(16, 2))
|
||||||
|
period_balance = fields.Float(digits=(16, 2))
|
||||||
final_balance = fields.Float(digits=(16, 2))
|
final_balance = fields.Float(digits=(16, 2))
|
||||||
final_balance_foreign_currency = fields.Float(digits=(16, 2))
|
final_balance_foreign_currency = fields.Float(digits=(16, 2))
|
||||||
|
|
||||||
|
@ -186,7 +196,7 @@ class TrialBalanceReportCompute(models.TransientModel):
|
||||||
'date_from': self.date_from,
|
'date_from': self.date_from,
|
||||||
'date_to': self.date_to,
|
'date_to': self.date_to,
|
||||||
'only_posted_moves': self.only_posted_moves,
|
'only_posted_moves': self.only_posted_moves,
|
||||||
'hide_account_balance_at_0': self.hide_account_balance_at_0,
|
'hide_account_at_0': self.hide_account_at_0,
|
||||||
'foreign_currency': self.foreign_currency,
|
'foreign_currency': self.foreign_currency,
|
||||||
'company_id': self.company_id.id,
|
'company_id': self.company_id.id,
|
||||||
'filter_account_ids': [(6, 0, account_ids.ids)],
|
'filter_account_ids': [(6, 0, account_ids.ids)],
|
||||||
|
@ -220,18 +230,28 @@ class TrialBalanceReportCompute(models.TransientModel):
|
||||||
self._inject_partner_values()
|
self._inject_partner_values()
|
||||||
if not self.filter_account_ids:
|
if not self.filter_account_ids:
|
||||||
self._inject_account_group_values()
|
self._inject_account_group_values()
|
||||||
if self.hierarchy_on == 'computed':
|
if self.hierarchy_on != 'none':
|
||||||
self._update_account_group_computed_values()
|
if self.hierarchy_on == 'computed':
|
||||||
else:
|
self._update_account_group_computed_values()
|
||||||
self._update_account_group_child_values()
|
else:
|
||||||
self._update_account_sequence()
|
self._update_account_group_child_values()
|
||||||
self._add_account_group_account_values()
|
self._update_account_sequence()
|
||||||
|
self._add_account_group_account_values()
|
||||||
self.refresh()
|
self.refresh()
|
||||||
if not self.filter_account_ids:
|
if not self.filter_account_ids and self.hierarchy_on != 'none':
|
||||||
self._compute_group_accounts()
|
self._compute_group_accounts()
|
||||||
else:
|
else:
|
||||||
for line in self.account_ids:
|
for line in self.account_ids:
|
||||||
line.write({'level': 0})
|
line.write({'level': 0})
|
||||||
|
if self.hide_account_at_0:
|
||||||
|
self.env.cr.execute("""
|
||||||
|
DELETE FROM report_trial_balance_account
|
||||||
|
WHERE report_id=%s
|
||||||
|
AND (initial_balance IS NULL OR initial_balance = 0)
|
||||||
|
AND (debit IS NULL OR debit = 0)
|
||||||
|
AND (credit IS NULL OR credit = 0)
|
||||||
|
AND (final_balance IS NULL OR final_balance = 0)
|
||||||
|
""", [self.id])
|
||||||
|
|
||||||
def _inject_account_values(self, account_ids):
|
def _inject_account_values(self, account_ids):
|
||||||
"""Inject report values for report_trial_balance_account"""
|
"""Inject report values for report_trial_balance_account"""
|
||||||
|
@ -249,6 +269,7 @@ INSERT INTO
|
||||||
initial_balance,
|
initial_balance,
|
||||||
debit,
|
debit,
|
||||||
credit,
|
credit,
|
||||||
|
period_balance,
|
||||||
final_balance,
|
final_balance,
|
||||||
currency_id,
|
currency_id,
|
||||||
initial_balance_foreign_currency,
|
initial_balance_foreign_currency,
|
||||||
|
@ -265,6 +286,7 @@ SELECT
|
||||||
coalesce(rag.initial_balance, 0) AS initial_balance,
|
coalesce(rag.initial_balance, 0) AS initial_balance,
|
||||||
coalesce(rag.final_debit - rag.initial_debit, 0) AS debit,
|
coalesce(rag.final_debit - rag.initial_debit, 0) AS debit,
|
||||||
coalesce(rag.final_credit - rag.initial_credit, 0) AS credit,
|
coalesce(rag.final_credit - rag.initial_credit, 0) AS credit,
|
||||||
|
coalesce(rag.final_balance - rag.initial_balance, 0) AS period_balance,
|
||||||
coalesce(rag.final_balance, 0) AS final_balance,
|
coalesce(rag.final_balance, 0) AS final_balance,
|
||||||
rag.currency_id AS currency_id,
|
rag.currency_id AS currency_id,
|
||||||
coalesce(rag.initial_balance_foreign_currency, 0)
|
coalesce(rag.initial_balance_foreign_currency, 0)
|
||||||
|
@ -278,9 +300,6 @@ FROM
|
||||||
WHERE
|
WHERE
|
||||||
acc.id in %s
|
acc.id in %s
|
||||||
"""
|
"""
|
||||||
if self.hide_account_balance_at_0:
|
|
||||||
query_inject_account += """ AND
|
|
||||||
final_balance IS NOT NULL AND final_balance != 0"""
|
|
||||||
query_inject_account_params = (
|
query_inject_account_params = (
|
||||||
self.id,
|
self.id,
|
||||||
self.env.uid,
|
self.env.uid,
|
||||||
|
@ -304,6 +323,7 @@ INSERT INTO
|
||||||
initial_balance_foreign_currency,
|
initial_balance_foreign_currency,
|
||||||
debit,
|
debit,
|
||||||
credit,
|
credit,
|
||||||
|
period_balance,
|
||||||
final_balance,
|
final_balance,
|
||||||
final_balance_foreign_currency
|
final_balance_foreign_currency
|
||||||
)
|
)
|
||||||
|
@ -317,6 +337,7 @@ SELECT
|
||||||
rpg.initial_balance_foreign_currency AS initial_balance_foreign_currency,
|
rpg.initial_balance_foreign_currency AS initial_balance_foreign_currency,
|
||||||
rpg.final_debit - rpg.initial_debit AS debit,
|
rpg.final_debit - rpg.initial_debit AS debit,
|
||||||
rpg.final_credit - rpg.initial_credit AS credit,
|
rpg.final_credit - rpg.initial_credit AS credit,
|
||||||
|
rpg.final_balance - rpg.initial_balance AS period_balance,
|
||||||
rpg.final_balance AS final_balance,
|
rpg.final_balance AS final_balance,
|
||||||
rpg.final_balance_foreign_currency AS final_balance_foreign_currency
|
rpg.final_balance_foreign_currency AS final_balance_foreign_currency
|
||||||
FROM
|
FROM
|
||||||
|
|
|
@ -30,22 +30,26 @@ class TrialBalanceXslx(models.AbstractModel):
|
||||||
'field': 'credit',
|
'field': 'credit',
|
||||||
'type': 'amount',
|
'type': 'amount',
|
||||||
'width': 14},
|
'width': 14},
|
||||||
5: {'header': _('Ending balance'),
|
5: {'header': _('Period balance'),
|
||||||
|
'field': 'period_balance',
|
||||||
|
'type': 'amount',
|
||||||
|
'width': 14},
|
||||||
|
6: {'header': _('Ending balance'),
|
||||||
'field': 'final_balance',
|
'field': 'final_balance',
|
||||||
'type': 'amount',
|
'type': 'amount',
|
||||||
'width': 14},
|
'width': 14},
|
||||||
}
|
}
|
||||||
if report.foreign_currency:
|
if report.foreign_currency:
|
||||||
foreign_currency = {
|
foreign_currency = {
|
||||||
6: {'header': _('Cur.'),
|
7: {'header': _('Cur.'),
|
||||||
'field': 'currency_id',
|
'field': 'currency_id',
|
||||||
'field_currency_balance': 'currency_id',
|
'field_currency_balance': 'currency_id',
|
||||||
'type': 'many2one', 'width': 7},
|
'type': 'many2one', 'width': 7},
|
||||||
7: {'header': _('Initial balance'),
|
8: {'header': _('Initial balance'),
|
||||||
'field': 'initial_balance_foreign_currency',
|
'field': 'initial_balance_foreign_currency',
|
||||||
'type': 'amount_currency',
|
'type': 'amount_currency',
|
||||||
'width': 14},
|
'width': 14},
|
||||||
8: {'header': _('Ending balance'),
|
9: {'header': _('Ending balance'),
|
||||||
'field': 'final_balance_foreign_currency',
|
'field': 'final_balance_foreign_currency',
|
||||||
'type': 'amount_currency',
|
'type': 'amount_currency',
|
||||||
'width': 14},
|
'width': 14},
|
||||||
|
@ -67,7 +71,11 @@ class TrialBalanceXslx(models.AbstractModel):
|
||||||
'field': 'credit',
|
'field': 'credit',
|
||||||
'type': 'amount',
|
'type': 'amount',
|
||||||
'width': 14},
|
'width': 14},
|
||||||
4: {'header': _('Ending balance'),
|
4: {'header': _('Period balance'),
|
||||||
|
'field': 'period_balance',
|
||||||
|
'type': 'amount',
|
||||||
|
'width': 14},
|
||||||
|
5: {'header': _('Ending balance'),
|
||||||
'field': 'final_balance',
|
'field': 'final_balance',
|
||||||
'type': 'amount',
|
'type': 'amount',
|
||||||
'width': 14},
|
'width': 14},
|
||||||
|
@ -97,8 +105,8 @@ class TrialBalanceXslx(models.AbstractModel):
|
||||||
[_('Target moves filter'),
|
[_('Target moves filter'),
|
||||||
_('All posted entries') if report.only_posted_moves else _(
|
_('All posted entries') if report.only_posted_moves else _(
|
||||||
'All entries')],
|
'All entries')],
|
||||||
[_('Account balance at 0 filter'),
|
[_('Account at 0 filter'),
|
||||||
_('Hide') if report.hide_account_balance_at_0 else _('Show')],
|
_('Hide') if report.hide_account_at_0 else _('Show')],
|
||||||
[_('Show foreign currency'),
|
[_('Show foreign currency'),
|
||||||
_('Yes') if report.foreign_currency else _('No')],
|
_('Yes') if report.foreign_currency else _('No')],
|
||||||
]
|
]
|
||||||
|
|
|
@ -54,8 +54,6 @@ class TestGeneralLedger(a_t_f_c.AbstractTestForeignCurrency):
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@common.at_install(False)
|
|
||||||
@common.post_install(True)
|
|
||||||
class TestGeneralLedgerReport(common.TransactionCase):
|
class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -344,10 +342,10 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
self.assertEqual(lines['unaffected'].initial_debit, 0)
|
self.assertEqual(lines['unaffected'].initial_debit, 0)
|
||||||
self.assertEqual(lines['unaffected'].initial_credit, 0)
|
self.assertEqual(lines['unaffected'].initial_credit, 1000)
|
||||||
self.assertEqual(lines['unaffected'].initial_balance, -1000)
|
self.assertEqual(lines['unaffected'].initial_balance, -1000)
|
||||||
self.assertEqual(lines['unaffected'].final_debit, -0)
|
self.assertEqual(lines['unaffected'].final_debit, 0)
|
||||||
self.assertEqual(lines['unaffected'].final_credit, 0)
|
self.assertEqual(lines['unaffected'].final_credit, 1000)
|
||||||
self.assertEqual(lines['unaffected'].final_balance, -1000)
|
self.assertEqual(lines['unaffected'].final_balance, -1000)
|
||||||
|
|
||||||
# Add reversale move of the initial move the first day of fiscal year
|
# Add reversale move of the initial move the first day of fiscal year
|
||||||
|
@ -369,11 +367,11 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
self.assertEqual(lines['unaffected'].initial_debit, 0)
|
self.assertEqual(lines['unaffected'].initial_debit, 0)
|
||||||
self.assertEqual(lines['unaffected'].initial_credit, 0)
|
self.assertEqual(lines['unaffected'].initial_credit, 1000)
|
||||||
self.assertEqual(lines['unaffected'].initial_balance, -1000)
|
self.assertEqual(lines['unaffected'].initial_balance, -1000)
|
||||||
self.assertEqual(lines['unaffected'].final_debit, 0)
|
self.assertEqual(lines['unaffected'].final_debit, 1000)
|
||||||
self.assertEqual(lines['unaffected'].final_credit, 0)
|
self.assertEqual(lines['unaffected'].final_credit, 1000)
|
||||||
self.assertEqual(lines['unaffected'].final_balance, -1000)
|
self.assertEqual(lines['unaffected'].final_balance, 0)
|
||||||
|
|
||||||
# Add another move at the end day of fiscal year
|
# Add another move at the end day of fiscal year
|
||||||
# to check that it correctly used on report
|
# to check that it correctly used on report
|
||||||
|
@ -393,11 +391,11 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
self.assertEqual(lines['unaffected'].initial_debit, 0)
|
self.assertEqual(lines['unaffected'].initial_debit, 0)
|
||||||
self.assertEqual(lines['unaffected'].initial_credit, 0)
|
self.assertEqual(lines['unaffected'].initial_credit, 1000)
|
||||||
self.assertEqual(lines['unaffected'].initial_balance, -1000)
|
self.assertEqual(lines['unaffected'].initial_balance, -1000)
|
||||||
self.assertEqual(lines['unaffected'].final_debit, 0)
|
self.assertEqual(lines['unaffected'].final_debit, 1000)
|
||||||
self.assertEqual(lines['unaffected'].final_credit, 0)
|
self.assertEqual(lines['unaffected'].final_credit, 4000)
|
||||||
self.assertEqual(lines['unaffected'].final_balance, -4000)
|
self.assertEqual(lines['unaffected'].final_balance, -3000)
|
||||||
|
|
||||||
def test_04_unaffected_account_balance_2_years(self):
|
def test_04_unaffected_account_balance_2_years(self):
|
||||||
# Generate the general ledger line
|
# Generate the general ledger line
|
||||||
|
@ -427,10 +425,10 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
self.assertEqual(len(lines['unaffected']), 1)
|
self.assertEqual(len(lines['unaffected']), 1)
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
self.assertEqual(lines['unaffected'].initial_debit, 0)
|
self.assertEqual(lines['unaffected'].initial_debit, 1000)
|
||||||
self.assertEqual(lines['unaffected'].initial_credit, 0)
|
self.assertEqual(lines['unaffected'].initial_credit, 0)
|
||||||
self.assertEqual(lines['unaffected'].initial_balance, 1000)
|
self.assertEqual(lines['unaffected'].initial_balance, 1000)
|
||||||
self.assertEqual(lines['unaffected'].final_debit, 0)
|
self.assertEqual(lines['unaffected'].final_debit, 1000)
|
||||||
self.assertEqual(lines['unaffected'].final_credit, 0)
|
self.assertEqual(lines['unaffected'].final_credit, 0)
|
||||||
self.assertEqual(lines['unaffected'].final_balance, 1000)
|
self.assertEqual(lines['unaffected'].final_balance, 1000)
|
||||||
|
|
||||||
|
@ -460,9 +458,9 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
self.assertEqual(len(lines['unaffected']), 1)
|
self.assertEqual(len(lines['unaffected']), 1)
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
self.assertEqual(lines['unaffected'].initial_debit, 0)
|
self.assertEqual(lines['unaffected'].initial_debit, 500)
|
||||||
self.assertEqual(lines['unaffected'].initial_credit, 0)
|
self.assertEqual(lines['unaffected'].initial_credit, 0)
|
||||||
self.assertEqual(lines['unaffected'].initial_balance, 500)
|
self.assertEqual(lines['unaffected'].initial_balance, 500)
|
||||||
self.assertEqual(lines['unaffected'].final_debit, 0)
|
self.assertEqual(lines['unaffected'].final_debit, 500)
|
||||||
self.assertEqual(lines['unaffected'].final_credit, 0)
|
self.assertEqual(lines['unaffected'].final_credit, 0)
|
||||||
self.assertEqual(lines['unaffected'].final_balance, 500)
|
self.assertEqual(lines['unaffected'].final_balance, 500)
|
||||||
|
|
|
@ -63,8 +63,6 @@ class TestTrialBalance(a_t_f_c.AbstractTestForeignCurrency):
|
||||||
return 'show_partner_details' in filters
|
return 'show_partner_details' in filters
|
||||||
|
|
||||||
|
|
||||||
@common.at_install(False)
|
|
||||||
@common.post_install(True)
|
|
||||||
class TestTrialBalanceReport(common.TransactionCase):
|
class TestTrialBalanceReport(common.TransactionCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -500,3 +498,143 @@ class TestTrialBalanceReport(common.TransactionCase):
|
||||||
self.assertEqual(lines['partner_receivable'].debit, 0)
|
self.assertEqual(lines['partner_receivable'].debit, 0)
|
||||||
self.assertEqual(lines['partner_receivable'].credit, 2000)
|
self.assertEqual(lines['partner_receivable'].credit, 2000)
|
||||||
self.assertEqual(lines['partner_receivable'].final_balance, -1000)
|
self.assertEqual(lines['partner_receivable'].final_balance, -1000)
|
||||||
|
|
||||||
|
def test_04_undistributed_pl(self):
|
||||||
|
# Add a P&L Move in the previous FY
|
||||||
|
move_name = 'current year pl move'
|
||||||
|
journal = self.env['account.journal'].search([], limit=1)
|
||||||
|
move_vals = {
|
||||||
|
'journal_id': journal.id,
|
||||||
|
'name': move_name,
|
||||||
|
'date': self.previous_fy_date_end,
|
||||||
|
'line_ids': [
|
||||||
|
(0, 0, {
|
||||||
|
'name': move_name,
|
||||||
|
'debit': 0.0,
|
||||||
|
'credit': 1000.0,
|
||||||
|
'account_id': self.account300.id}),
|
||||||
|
(0, 0, {
|
||||||
|
'name': move_name,
|
||||||
|
'debit': 1000.0,
|
||||||
|
'credit': 0.0,
|
||||||
|
'account_id': self.account100.id})
|
||||||
|
]}
|
||||||
|
move = self.env['account.move'].create(move_vals)
|
||||||
|
move.post()
|
||||||
|
# Generate the trial balance line
|
||||||
|
report_account_model = self.env['report_trial_balance_account']
|
||||||
|
company = self.env.ref('base.main_company')
|
||||||
|
trial_balance = self.env['report_trial_balance'].create({
|
||||||
|
'date_from': self.date_start,
|
||||||
|
'date_to': self.date_end,
|
||||||
|
'only_posted_moves': True,
|
||||||
|
'hide_account_balance_at_0': False,
|
||||||
|
'hierarchy_on': 'none',
|
||||||
|
'company_id': company.id,
|
||||||
|
'fy_start_date': self.fy_date_start,
|
||||||
|
})
|
||||||
|
trial_balance.compute_data_for_report()
|
||||||
|
|
||||||
|
unaffected_balance_lines = report_account_model.search([
|
||||||
|
('report_id', '=', trial_balance.id),
|
||||||
|
('account_id', '=', self.account110.id),
|
||||||
|
])
|
||||||
|
self.assertEqual(len(unaffected_balance_lines), 1)
|
||||||
|
self.assertEqual(unaffected_balance_lines[0].initial_balance, -1000)
|
||||||
|
self.assertEqual(unaffected_balance_lines[0].debit, 0)
|
||||||
|
self.assertEqual(unaffected_balance_lines[0].credit, 0)
|
||||||
|
self.assertEqual(unaffected_balance_lines[0].final_balance, -1000)
|
||||||
|
# Add a P&L Move to the current FY
|
||||||
|
move_name = 'current year pl move'
|
||||||
|
journal = self.env['account.journal'].search([], limit=1)
|
||||||
|
move_vals = {
|
||||||
|
'journal_id': journal.id,
|
||||||
|
'name': move_name,
|
||||||
|
'date': self.date_start,
|
||||||
|
'line_ids': [
|
||||||
|
(0, 0, {
|
||||||
|
'name': move_name,
|
||||||
|
'debit': 0.0,
|
||||||
|
'credit': 1000.0,
|
||||||
|
'account_id': self.account300.id}),
|
||||||
|
(0, 0, {
|
||||||
|
'name': move_name,
|
||||||
|
'debit': 1000.0,
|
||||||
|
'credit': 0.0,
|
||||||
|
'account_id': self.account100.id})
|
||||||
|
]}
|
||||||
|
move = self.env['account.move'].create(move_vals)
|
||||||
|
move.post()
|
||||||
|
# Re Generate the trial balance line
|
||||||
|
trial_balance = self.env['report_trial_balance'].create({
|
||||||
|
'date_from': self.date_start,
|
||||||
|
'date_to': self.date_end,
|
||||||
|
'only_posted_moves': True,
|
||||||
|
'hide_account_balance_at_0': False,
|
||||||
|
'hierarchy_on': 'none',
|
||||||
|
'company_id': company.id,
|
||||||
|
'fy_start_date': self.fy_date_start,
|
||||||
|
})
|
||||||
|
trial_balance.compute_data_for_report()
|
||||||
|
unaffected_balance_lines = report_account_model.search([
|
||||||
|
('report_id', '=', trial_balance.id),
|
||||||
|
('account_id', '=', self.account110.id),
|
||||||
|
])
|
||||||
|
# The unaffected earnings account is not affected by a journal entry
|
||||||
|
# made to the P&L in the current fiscal year.
|
||||||
|
self.assertEqual(len(unaffected_balance_lines), 1)
|
||||||
|
self.assertEqual(unaffected_balance_lines[0].initial_balance, -1000)
|
||||||
|
self.assertEqual(unaffected_balance_lines[0].debit, 0)
|
||||||
|
self.assertEqual(unaffected_balance_lines[0].credit, 0)
|
||||||
|
self.assertEqual(unaffected_balance_lines[0].final_balance, -1000)
|
||||||
|
# Add a Move including Unaffected Earnings to the current FY
|
||||||
|
move_name = 'current year unaffected earnings move'
|
||||||
|
journal = self.env['account.journal'].search([], limit=1)
|
||||||
|
move_vals = {
|
||||||
|
'journal_id': journal.id,
|
||||||
|
'name': move_name,
|
||||||
|
'date': self.date_start,
|
||||||
|
'line_ids': [
|
||||||
|
(0, 0, {
|
||||||
|
'name': move_name,
|
||||||
|
'debit': 0.0,
|
||||||
|
'credit': 1000.0,
|
||||||
|
'account_id': self.account110.id}),
|
||||||
|
(0, 0, {
|
||||||
|
'name': move_name,
|
||||||
|
'debit': 1000.0,
|
||||||
|
'credit': 0.0,
|
||||||
|
'account_id': self.account100.id})
|
||||||
|
]}
|
||||||
|
move = self.env['account.move'].create(move_vals)
|
||||||
|
move.post()
|
||||||
|
# Re Generate the trial balance line
|
||||||
|
trial_balance = self.env['report_trial_balance'].create({
|
||||||
|
'date_from': self.date_start,
|
||||||
|
'date_to': self.date_end,
|
||||||
|
'only_posted_moves': True,
|
||||||
|
'hide_account_balance_at_0': False,
|
||||||
|
'hierarchy_on': 'none',
|
||||||
|
'company_id': company.id,
|
||||||
|
'fy_start_date': self.fy_date_start,
|
||||||
|
})
|
||||||
|
trial_balance.compute_data_for_report()
|
||||||
|
# The unaffected earnings account affected by a journal entry
|
||||||
|
# made to the unaffected earnings in the current fiscal year.
|
||||||
|
unaffected_balance_lines = report_account_model.search([
|
||||||
|
('report_id', '=', trial_balance.id),
|
||||||
|
('account_id', '=', self.account110.id),
|
||||||
|
])
|
||||||
|
self.assertEqual(len(unaffected_balance_lines), 1)
|
||||||
|
self.assertEqual(unaffected_balance_lines[0].initial_balance, -1000)
|
||||||
|
self.assertEqual(unaffected_balance_lines[0].debit, 0)
|
||||||
|
self.assertEqual(unaffected_balance_lines[0].credit, 1000)
|
||||||
|
self.assertEqual(unaffected_balance_lines[0].final_balance, -2000)
|
||||||
|
# The totals for the Trial Balance are zero
|
||||||
|
all_lines = report_account_model.search([
|
||||||
|
('report_id', '=', trial_balance.id),
|
||||||
|
])
|
||||||
|
self.assertEqual(sum(all_lines.mapped('initial_balance')), 0)
|
||||||
|
self.assertEqual(sum(all_lines.mapped('final_balance')), 0)
|
||||||
|
self.assertEqual(sum(all_lines.mapped('debit')),
|
||||||
|
sum(all_lines.mapped('credit')))
|
||||||
|
|
|
@ -31,21 +31,28 @@ class TrialBalanceReportWizard(models.TransientModel):
|
||||||
string='Target Moves',
|
string='Target Moves',
|
||||||
required=True,
|
required=True,
|
||||||
default='all')
|
default='all')
|
||||||
hierarchy_on = fields.Selection([('computed', 'Computed Accounts'),
|
hierarchy_on = fields.Selection(
|
||||||
('relation', 'Child Accounts')],
|
[('computed', 'Computed Accounts'),
|
||||||
string='Hierarchy On',
|
('relation', 'Child Accounts'),
|
||||||
required=True,
|
('none', 'No hierarchy')],
|
||||||
default='computed')
|
string='Hierarchy On',
|
||||||
|
required=True,
|
||||||
|
default='computed',
|
||||||
|
help="""Computed Accounts: Use when the account group have codes
|
||||||
|
that represent prefixes of the actual accounts.\n
|
||||||
|
Child Accounts: Use when your account groups are hierarchical.\n
|
||||||
|
No hierarchy: Use to display just the accounts, without any grouping.
|
||||||
|
""",
|
||||||
|
)
|
||||||
account_ids = fields.Many2many(
|
account_ids = fields.Many2many(
|
||||||
comodel_name='account.account',
|
comodel_name='account.account',
|
||||||
string='Filter accounts',
|
string='Filter accounts',
|
||||||
)
|
)
|
||||||
hide_account_balance_at_0 = fields.Boolean(
|
hide_account_at_0 = fields.Boolean(
|
||||||
string='Hide account ending balance at 0',
|
string='Hide accounts at 0', default=True,
|
||||||
help='Use this filter to hide an account or a partner '
|
help='When this option is enabled, the trial balance will '
|
||||||
'with an ending balance at 0. '
|
'not display accounts that have initial balance = '
|
||||||
'If partners are filtered, '
|
'debit = credit = end balance = 0',
|
||||||
'debits and credits totals will not match the trial balance.'
|
|
||||||
)
|
)
|
||||||
receivable_accounts_only = fields.Boolean()
|
receivable_accounts_only = fields.Boolean()
|
||||||
payable_accounts_only = fields.Boolean()
|
payable_accounts_only = fields.Boolean()
|
||||||
|
@ -114,10 +121,8 @@ class TrialBalanceReportWizard(models.TransientModel):
|
||||||
"""Handle partners change."""
|
"""Handle partners change."""
|
||||||
if self.show_partner_details:
|
if self.show_partner_details:
|
||||||
self.receivable_accounts_only = self.payable_accounts_only = True
|
self.receivable_accounts_only = self.payable_accounts_only = True
|
||||||
self.hide_account_balance_at_0 = True
|
|
||||||
else:
|
else:
|
||||||
self.receivable_accounts_only = self.payable_accounts_only = False
|
self.receivable_accounts_only = self.payable_accounts_only = False
|
||||||
self.hide_account_balance_at_0 = False
|
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_html(self):
|
def button_export_html(self):
|
||||||
|
@ -155,7 +160,7 @@ class TrialBalanceReportWizard(models.TransientModel):
|
||||||
'date_from': self.date_from,
|
'date_from': self.date_from,
|
||||||
'date_to': self.date_to,
|
'date_to': self.date_to,
|
||||||
'only_posted_moves': self.target_move == 'posted',
|
'only_posted_moves': self.target_move == 'posted',
|
||||||
'hide_account_balance_at_0': self.hide_account_balance_at_0,
|
'hide_account_at_0': self.hide_account_at_0,
|
||||||
'foreign_currency': self.foreign_currency,
|
'foreign_currency': self.foreign_currency,
|
||||||
'company_id': self.company_id.id,
|
'company_id': self.company_id.id,
|
||||||
'filter_account_ids': [(6, 0, self.account_ids.ids)],
|
'filter_account_ids': [(6, 0, self.account_ids.ids)],
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
</group>
|
</group>
|
||||||
<group name="other_filters">
|
<group name="other_filters">
|
||||||
<field name="target_move" widget="radio"/>
|
<field name="target_move" widget="radio"/>
|
||||||
<field name="hide_account_balance_at_0"/>
|
<field name="hide_account_at_0"/>
|
||||||
<field name="show_partner_details"/>
|
<field name="show_partner_details"/>
|
||||||
<field name="hierarchy_on" widget="radio" attrs="{'invisible':[('show_partner_details','=',True)]}"/>
|
<field name="hierarchy_on" widget="radio" attrs="{'invisible':[('show_partner_details','=',True)]}"/>
|
||||||
<field name="foreign_currency"/>
|
<field name="foreign_currency"/>
|
||||||
|
|
Loading…
Reference in New Issue