Browse Source

Add missing unaffected earnings account into reports

pull/211/head
jcoux 8 years ago
parent
commit
c3f2dda9c9
  1. 61
      account_financial_report_qweb/i18n/account_financial_report_qweb.pot
  2. 42
      account_financial_report_qweb/i18n/fr.po
  3. 170
      account_financial_report_qweb/report/general_ledger.py
  4. 16
      account_financial_report_qweb/wizard/general_ledger_wizard.py
  5. 69
      account_financial_report_qweb/wizard/general_ledger_wizard_view.xml
  6. 16
      account_financial_report_qweb/wizard/trial_balance_wizard.py
  7. 63
      account_financial_report_qweb/wizard/trial_balance_wizard_view.xml

61
account_financial_report_qweb/i18n/account_financial_report_qweb.pot

@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n" "Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-29 07:38+0000\n"
"PO-Revision-Date: 2016-07-29 07:38+0000\n"
"POT-Creation-Date: 2016-08-12 12:17+0000\n"
"PO-Revision-Date: 2016-08-12 12:17+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -262,6 +262,22 @@ msgstr ""
msgid "Code" msgid "Code"
msgstr "" msgstr ""
#. module: account_financial_report_qweb
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_aged_partner_balance_wizard_company_id
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_general_ledger_report_wizard_company_id
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_open_items_report_wizard_company_id
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_trial_balance_report_wizard_company_id
msgid "Company"
msgstr ""
#. module: account_financial_report_qweb
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_aged_partner_balance_qweb_company_id
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_general_ledger_qweb_company_id
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_open_items_qweb_company_id
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_trial_balance_qweb_company_id
msgid "Company id"
msgstr ""
#. module: account_financial_report_qweb #. module: account_financial_report_qweb
#: code:addons/account_financial_report_qweb/report/general_ledger_xlsx.py:30 #: code:addons/account_financial_report_qweb/report/general_ledger_xlsx.py:30
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_general_ledger_qweb_move_line_cost_center #: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_general_ledger_qweb_move_line_cost_center
@ -463,6 +479,12 @@ msgstr ""
msgid "Date from" msgid "Date from"
msgstr "" msgstr ""
#. module: account_financial_report_qweb
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_general_ledger_report_wizard_date_range_id
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_trial_balance_report_wizard_date_range_id
msgid "Date range"
msgstr ""
#. module: account_financial_report_qweb #. module: account_financial_report_qweb
#: code:addons/account_financial_report_qweb/report/general_ledger_xlsx.py:61 #: code:addons/account_financial_report_qweb/report/general_ledger_xlsx.py:61
#: code:addons/account_financial_report_qweb/report/trial_balance_xlsx.py:66 #: code:addons/account_financial_report_qweb/report/trial_balance_xlsx.py:66
@ -472,12 +494,6 @@ msgstr ""
msgid "Date range filter" msgid "Date range filter"
msgstr "" msgstr ""
#. module: account_financial_report_qweb
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_general_ledger_report_wizard_date_range_id
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_trial_balance_report_wizard_date_range_id
msgid "Date range id"
msgstr ""
#. module: account_financial_report_qweb #. module: account_financial_report_qweb
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_general_ledger_report_wizard_date_to #: model:ir.model.fields,field_description:account_financial_report_qweb.field_general_ledger_report_wizard_date_to
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_general_ledger_qweb_date_to #: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_general_ledger_qweb_date_to
@ -683,6 +699,11 @@ msgstr ""
msgid "General Ledger XLSX" msgid "General Ledger XLSX"
msgstr "" msgstr ""
#. module: account_financial_report_qweb
#: model:ir.ui.view,arch_db:account_financial_report_qweb.general_ledger_wizard
msgid "General Ledger can be computed only if selected company have only one unaffected earnings account."
msgstr ""
#. module: account_financial_report_qweb #. module: account_financial_report_qweb
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_trial_balance_qweb_general_ledger_id #: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_trial_balance_qweb_general_ledger_id
msgid "General ledger id" msgid "General ledger id"
@ -918,14 +939,20 @@ msgid "No"
msgstr "" msgstr ""
#. module: account_financial_report_qweb #. module: account_financial_report_qweb
#: code:addons/account_financial_report_qweb/report/general_ledger.py:457
#: code:addons/account_financial_report_qweb/report/general_ledger.py:673
#: code:addons/account_financial_report_qweb/report/open_items.py:275
#: code:addons/account_financial_report_qweb/report/open_items.py:491
#: code:addons/account_financial_report_qweb/report/general_ledger.py:491
#: code:addons/account_financial_report_qweb/report/general_ledger.py:707
#: code:addons/account_financial_report_qweb/report/open_items.py:277
#: code:addons/account_financial_report_qweb/report/open_items.py:493
#, python-format #, python-format
msgid "No partner allocated" msgid "No partner allocated"
msgstr "" msgstr ""
#. module: account_financial_report_qweb
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_general_ledger_report_wizard_not_only_one_unaffected_earnings_account
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_trial_balance_report_wizard_not_only_one_unaffected_earnings_account
msgid "Not only one unaffected earnings account"
msgstr ""
#. module: account_financial_report_qweb #. module: account_financial_report_qweb
#: model:ir.ui.menu,name:account_financial_report_qweb.menu_oca_reports #: model:ir.ui.menu,name:account_financial_report_qweb.menu_oca_reports
msgid "OCA accounting reports" msgid "OCA accounting reports"
@ -1224,6 +1251,16 @@ msgstr ""
msgid "Trial Balance XLSX" msgid "Trial Balance XLSX"
msgstr "" msgstr ""
#. module: account_financial_report_qweb
#: model:ir.ui.view,arch_db:account_financial_report_qweb.trial_balance_wizard
msgid "Trial Balance can be computed only if selected company have only one unaffected earnings account."
msgstr ""
#. module: account_financial_report_qweb
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_general_ledger_qweb_unaffected_earnings_account
msgid "Unaffected earnings account"
msgstr ""
#. module: account_financial_report_qweb #. module: account_financial_report_qweb
#: model:ir.model.fields,help:account_financial_report_qweb.field_general_ledger_report_wizard_hide_account_balance_at_0 #: model:ir.model.fields,help:account_financial_report_qweb.field_general_ledger_report_wizard_hide_account_balance_at_0
#: model:ir.model.fields,help:account_financial_report_qweb.field_open_items_report_wizard_hide_account_balance_at_0 #: model:ir.model.fields,help:account_financial_report_qweb.field_open_items_report_wizard_hide_account_balance_at_0

42
account_financial_report_qweb/i18n/fr.po

@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n" "Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-11 09:11+0000\n"
"PO-Revision-Date: 2016-08-11 09:11+0000\n"
"POT-Creation-Date: 2016-08-12 12:18+0000\n"
"PO-Revision-Date: 2016-08-12 12:18+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -246,7 +246,7 @@ msgid "Centralized"
msgstr "Centralisé" msgstr "Centralisé"
#. module: account_financial_report_qweb #. module: account_financial_report_qweb
#: code:addons/account_financial_report_qweb/report/general_ledger.py:901
#: code:addons/account_financial_report_qweb/report/general_ledger.py:933
#, python-format #, python-format
msgid "Centralized Entries" msgid "Centralized Entries"
msgstr "Écritures centralisées" msgstr "Écritures centralisées"
@ -270,6 +270,14 @@ msgstr "Code"
msgid "Company" msgid "Company"
msgstr "Société" msgstr "Société"
#. module: account_financial_report_qweb
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_aged_partner_balance_qweb_company_id
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_general_ledger_qweb_company_id
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_open_items_qweb_company_id
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_trial_balance_qweb_company_id
msgid "Company id"
msgstr "Société"
#. module: account_financial_report_qweb #. module: account_financial_report_qweb
#: code:addons/account_financial_report_qweb/report/general_ledger_xlsx.py:30 #: code:addons/account_financial_report_qweb/report/general_ledger_xlsx.py:30
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_general_ledger_qweb_move_line_cost_center #: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_general_ledger_qweb_move_line_cost_center
@ -529,7 +537,7 @@ msgstr "Débit"
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_trial_balance_qweb_partner_display_name #: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_trial_balance_qweb_partner_display_name
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_trial_balance_report_wizard_display_name #: model:ir.model.fields,field_description:account_financial_report_qweb.field_trial_balance_report_wizard_display_name
msgid "Display Name" msgid "Display Name"
msgstr "Afficher le nom"
msgstr "Nom affiché"
#. module: account_financial_report_qweb #. module: account_financial_report_qweb
#: code:addons/account_financial_report_qweb/report/aged_partner_balance_xlsx.py:75 #: code:addons/account_financial_report_qweb/report/aged_partner_balance_xlsx.py:75
@ -691,6 +699,11 @@ msgstr "General Ledger Report Wizard"
msgid "General Ledger XLSX" msgid "General Ledger XLSX"
msgstr "Grand livre en XLSX" msgstr "Grand livre en XLSX"
#. module: account_financial_report_qweb
#: model:ir.ui.view,arch_db:account_financial_report_qweb.general_ledger_wizard
msgid "General Ledger can be computed only if selected company have only one unaffected earnings account."
msgstr "Le Grand Livre ne peut être calculé que si la société sélectionnée a un seul compte de résultat non affecté."
#. module: account_financial_report_qweb #. module: account_financial_report_qweb
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_trial_balance_qweb_general_ledger_id #: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_trial_balance_qweb_general_ledger_id
msgid "General ledger id" msgid "General ledger id"
@ -926,14 +939,20 @@ msgid "No"
msgstr "Non" msgstr "Non"
#. module: account_financial_report_qweb #. module: account_financial_report_qweb
#: code:addons/account_financial_report_qweb/report/general_ledger.py:459
#: code:addons/account_financial_report_qweb/report/general_ledger.py:675
#: code:addons/account_financial_report_qweb/report/general_ledger.py:491
#: code:addons/account_financial_report_qweb/report/general_ledger.py:707
#: code:addons/account_financial_report_qweb/report/open_items.py:277 #: code:addons/account_financial_report_qweb/report/open_items.py:277
#: code:addons/account_financial_report_qweb/report/open_items.py:493 #: code:addons/account_financial_report_qweb/report/open_items.py:493
#, python-format #, python-format
msgid "No partner allocated" msgid "No partner allocated"
msgstr "Écritures sans partenaire" msgstr "Écritures sans partenaire"
#. module: account_financial_report_qweb
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_general_ledger_report_wizard_not_only_one_unaffected_earnings_account
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_trial_balance_report_wizard_not_only_one_unaffected_earnings_account
msgid "Not only one unaffected earnings account"
msgstr "Pas un seul compte de résultat non affecté"
#. module: account_financial_report_qweb #. module: account_financial_report_qweb
#: model:ir.ui.menu,name:account_financial_report_qweb.menu_oca_reports #: model:ir.ui.menu,name:account_financial_report_qweb.menu_oca_reports
msgid "OCA accounting reports" msgid "OCA accounting reports"
@ -1232,6 +1251,16 @@ msgstr "Trial Balance Report Wizard"
msgid "Trial Balance XLSX" msgid "Trial Balance XLSX"
msgstr "Balance générale XLSX" msgstr "Balance générale XLSX"
#. module: account_financial_report_qweb
#: model:ir.ui.view,arch_db:account_financial_report_qweb.trial_balance_wizard
msgid "Trial Balance can be computed only if selected company have only one unaffected earnings account."
msgstr "La Balance Générale ne peut être calculée que si la société sélectionnée a un seul compte de résultat non affecté."
#. module: account_financial_report_qweb
#: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_general_ledger_qweb_unaffected_earnings_account
msgid "Unaffected earnings account"
msgstr "Compte de résultat non affecté"
#. module: account_financial_report_qweb #. module: account_financial_report_qweb
#: model:ir.model.fields,help:account_financial_report_qweb.field_general_ledger_report_wizard_hide_account_balance_at_0 #: model:ir.model.fields,help:account_financial_report_qweb.field_general_ledger_report_wizard_hide_account_balance_at_0
#: model:ir.model.fields,help:account_financial_report_qweb.field_open_items_report_wizard_hide_account_balance_at_0 #: model:ir.model.fields,help:account_financial_report_qweb.field_open_items_report_wizard_hide_account_balance_at_0
@ -1333,3 +1362,4 @@ msgstr "report_trial_balance_qweb_account"
#: model:ir.model,name:account_financial_report_qweb.model_report_trial_balance_qweb_partner #: model:ir.model,name:account_financial_report_qweb.model_report_trial_balance_qweb_partner
msgid "report_trial_balance_qweb_partner" msgid "report_trial_balance_qweb_partner"
msgstr "report_trial_balance_qweb_partner" msgstr "report_trial_balance_qweb_partner"

170
account_financial_report_qweb/report/general_ledger.py

@ -51,6 +51,22 @@ class GeneralLedgerReport(models.TransientModel):
inverse_name='report_id' inverse_name='report_id'
) )
# Compute of unaffected earnings account
@api.depends('company_id')
def _compute_unaffected_earnings_account(self):
account_type = self.env.ref('account.data_unaffected_earnings')
self.unaffected_earnings_account = self.env['account.account'].search(
[
('user_type_id', '=', account_type.id),
('company_id', '=', self.company_id.id)
])
unaffected_earnings_account = fields.Many2one(
comodel_name='account.account',
compute='_compute_unaffected_earnings_account',
store=True
)
class GeneralLedgerReportAccount(models.TransientModel): class GeneralLedgerReportAccount(models.TransientModel):
@ -198,6 +214,13 @@ class GeneralLedgerReportCompute(models.TransientModel):
# Compute report data # Compute report data
self._inject_account_values() self._inject_account_values()
self._inject_partner_values() self._inject_partner_values()
# Add unaffected earnings account
if (not self.filter_account_ids or
self.unaffected_earnings_account.id in
self.filter_account_ids.ids):
self._inject_unaffected_earnings_account_values()
self._inject_line_not_centralized_values() self._inject_line_not_centralized_values()
self._inject_line_not_centralized_values(is_account_line=False, self._inject_line_not_centralized_values(is_account_line=False,
is_partner_line=True) is_partner_line=True)
@ -206,6 +229,13 @@ class GeneralLedgerReportCompute(models.TransientModel):
only_empty_partner_line=True) only_empty_partner_line=True)
if self.centralize: if self.centralize:
self._inject_line_centralized_values() self._inject_line_centralized_values()
# Complete unaffected earnings account
if (not self.filter_account_ids or
self.unaffected_earnings_account.id in
self.filter_account_ids.ids):
self._complete_unaffected_earnings_account_values()
# Compute display flag # Compute display flag
self._compute_has_second_currency() self._compute_has_second_currency()
# Refresh cache because all data are computed with SQL requests # Refresh cache because all data are computed with SQL requests
@ -285,6 +315,7 @@ WITH
query_inject_account += """ query_inject_account += """
WHERE WHERE
a.company_id = %s a.company_id = %s
AND a.id != %s
""" """
if self.filter_account_ids: if self.filter_account_ids:
query_inject_account += """ query_inject_account += """
@ -364,6 +395,7 @@ AND
) )
query_inject_account_params += ( query_inject_account_params += (
self.company_id.id, self.company_id.id,
self.unaffected_earnings_account.id,
) )
if self.filter_account_ids: if self.filter_account_ids:
query_inject_account_params += ( query_inject_account_params += (
@ -979,3 +1011,141 @@ WHERE id = %s
""" """
params = (self.id,) * 3 params = (self.id,) * 3
self.env.cr.execute(query_update_has_second_currency, params) self.env.cr.execute(query_update_has_second_currency, params)
def _inject_unaffected_earnings_account_values(self):
"""Inject the report values of the unaffected earnings account
for report_general_ledger_qweb_account."""
subquery_sum_amounts = """
SELECT
SUM(ml.balance) AS 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 <= %s
AND
NOT(
at.include_initial_balance != TRUE AND ml.date >= %s
OR at.include_initial_balance = TRUE
)
"""
if self.only_posted_moves:
subquery_sum_amounts += """
INNER JOIN
account_move m ON ml.move_id = m.id AND m.state = 'posted'
"""
if self.filter_cost_center_ids:
subquery_sum_amounts += """
INNER JOIN
account_analytic_account aa
ON
ml.analytic_account_id = aa.id
AND aa.id IN %s
"""
subquery_sum_amounts += """
WHERE
a.company_id =%s
AND a.id != %s
"""
query_inject_account = """
WITH
initial_sum_amounts AS ( """ + subquery_sum_amounts + """ )
INSERT INTO
report_general_ledger_qweb_account
(
report_id,
create_uid,
create_date,
account_id,
code,
name,
is_partner_account,
initial_balance
)
SELECT
%s AS report_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.balance, 0.0) AS initial_balance
FROM
account_account a,
initial_sum_amounts i
WHERE
a.company_id = %s
AND a.id = %s
"""
query_inject_account_params = (
self.date_from,
self.fy_start_date,
)
if self.filter_cost_center_ids:
query_inject_account_params += (
tuple(self.filter_cost_center_ids.ids),
)
query_inject_account_params += (
self.company_id.id,
self.unaffected_earnings_account.id,
self.id,
self.env.uid,
self.company_id.id,
self.unaffected_earnings_account.id,
)
self.env.cr.execute(query_inject_account,
query_inject_account_params)
def _complete_unaffected_earnings_account_values(self):
"""Complete the report values of the unaffected earnings account
for report_general_ledger_qweb_account."""
query_update_unaffected_earnings_account_values = """
WITH
sum_amounts AS
(
SELECT
SUM(COALESCE(rml.debit, 0.0)) AS debit,
SUM(COALESCE(rml.credit, 0.0)) AS credit,
SUM(
COALESCE(rml.debit, 0.0) -
COALESCE(rml.credit, 0.0)
) + ra.initial_balance AS balance
FROM
report_general_ledger_qweb_account ra
LEFT JOIN
report_general_ledger_qweb_move_line rml
ON ra.id = rml.report_account_id
WHERE
ra.report_id = %s
AND ra.account_id = %s
GROUP BY
ra.id
)
UPDATE
report_general_ledger_qweb_account ra
SET
initial_debit = 0.0,
initial_credit = 0.0,
final_debit = sum_amounts.debit,
final_credit = sum_amounts.credit,
final_balance = sum_amounts.balance
FROM
sum_amounts
WHERE
ra.report_id = %s
AND ra.account_id = %s
"""
params = (
self.id,
self.unaffected_earnings_account.id,
self.id,
self.unaffected_earnings_account.id,
)
self.env.cr.execute(
query_update_unaffected_earnings_account_values,
params
)

16
account_financial_report_qweb/wizard/general_ledger_wizard.py

@ -55,6 +55,22 @@ class GeneralLedgerReportWizard(models.TransientModel):
string='Filter cost centers', string='Filter cost centers',
) )
not_only_one_unaffected_earnings_account = fields.Boolean(
readonly=True,
string='Not only one unaffected earnings account'
)
@api.onchange('company_id')
def onchange_company_id(self):
"""Handle company change."""
account_type = self.env.ref('account.data_unaffected_earnings')
count = self.env['account.account'].search_count(
[
('user_type_id', '=', account_type.id),
('company_id', '=', self.company_id.id)
])
self.not_only_one_unaffected_earnings_account = count != 1
@api.onchange('date_range_id') @api.onchange('date_range_id')
def onchange_date_range_id(self): def onchange_date_range_id(self):
"""Handle date range change.""" """Handle date range change."""

69
account_financial_report_qweb/wizard/general_ledger_wizard_view.xml

@ -10,37 +10,50 @@
<group name="main_info"> <group name="main_info">
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/> <field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
</group> </group>
<group name="filters">
<group name="date_range">
<field name="date_range_id" domain="[('company_id','=',company_id)]"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="fy_start_date" invisible="1"/>
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}">
<group name="filters">
<group name="date_range">
<field name="date_range_id" domain="[('company_id','=',company_id)]"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="fy_start_date" invisible="1"/>
</group>
<group name="other_filters">
<field name="target_move" widget="radio"/>
<field name="centralize"/>
<field name="hide_account_balance_at_0"/>
</group>
</group> </group>
<group name="other_filters">
<field name="target_move" widget="radio"/>
<field name="centralize"/>
<field name="hide_account_balance_at_0"/>
<label for="cost_center_ids" groups="analytic.group_analytic_accounting"/>
<field name="cost_center_ids" nolabel="1" options="{'no_create': True}" groups="analytic.group_analytic_accounting"/>
<group/>
<label for="partner_ids"/>
<field name="partner_ids" nolabel="1" options="{'no_create': True}"/>
<group/>
<label for="account_ids"/>
<group col="4">
<field name="receivable_accounts_only"/>
<field name="payable_accounts_only"/>
</group> </group>
</group>
<label for="cost_center_ids" groups="analytic.group_analytic_accounting"/>
<field name="cost_center_ids" nolabel="1" options="{'no_create': True}" groups="analytic.group_analytic_accounting"/>
<group/>
<label for="partner_ids"/>
<field name="partner_ids" nolabel="1" options="{'no_create': True}"/>
<group/>
<label for="account_ids"/>
<group col="4">
<field name="receivable_accounts_only"/>
<field name="payable_accounts_only"/>
</group>
<field name="account_ids" nolabel="1" options="{'no_create': True}"/>
<field name="account_ids" nolabel="1" options="{'no_create': True}"/>
</div>
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}">
<field name="not_only_one_unaffected_earnings_account" invisible="1"/>
<group/>
<h4>General Ledger can be computed only if selected company have only one unaffected earnings account.</h4>
<group/>
</div>
<footer> <footer>
<button name="button_export_pdf" string="Export PDF" type="object" default_focus="1" class="oe_highlight"/>
or
<button name="button_export_xlsx" string="Export XLSX" type="object"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}">
<button name="button_export_pdf" string="Export PDF" type="object" default_focus="1" class="oe_highlight"/>
or
<button name="button_export_xlsx" string="Export XLSX" type="object"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</div>
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}">
<button string="Cancel" class="oe_link" special="cancel" />
</div>
</footer> </footer>
</form> </form>
</field> </field>

16
account_financial_report_qweb/wizard/trial_balance_wizard.py

@ -49,6 +49,22 @@ class TrialBalanceReportWizard(models.TransientModel):
string='Filter partners', string='Filter partners',
) )
not_only_one_unaffected_earnings_account = fields.Boolean(
readonly=True,
string='Not only one unaffected earnings account'
)
@api.onchange('company_id')
def onchange_company_id(self):
"""Handle company change."""
account_type = self.env.ref('account.data_unaffected_earnings')
count = self.env['account.account'].search_count(
[
('user_type_id', '=', account_type.id),
('company_id', '=', self.company_id.id)
])
self.not_only_one_unaffected_earnings_account = count != 1
@api.onchange('date_range_id') @api.onchange('date_range_id')
def onchange_date_range_id(self): def onchange_date_range_id(self):
"""Handle date range change.""" """Handle date range change."""

63
account_financial_report_qweb/wizard/trial_balance_wizard_view.xml

@ -10,34 +10,47 @@
<group name="main_info"> <group name="main_info">
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/> <field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
</group> </group>
<group name="filters">
<group name="date_range">
<field name="date_range_id" domain="[('company_id','=',company_id)]"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="fy_start_date" invisible="1"/>
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}">
<group name="filters">
<group name="date_range">
<field name="date_range_id" domain="[('company_id','=',company_id)]"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="fy_start_date" invisible="1"/>
</group>
<group name="other_filters">
<field name="target_move" widget="radio"/>
<field name="hide_account_balance_at_0"/>
<field name="show_partner_details"/>
</group>
</group> </group>
<group name="other_filters">
<field name="target_move" widget="radio"/>
<field name="hide_account_balance_at_0"/>
<field name="show_partner_details"/>
<label for="partner_ids" attrs="{'invisible':[('show_partner_details','!=',True)]}"/>
<field name="partner_ids" nolabel="1" options="{'no_create': True}" attrs="{'invisible':[('show_partner_details','!=',True)]}"/>
<group attrs="{'invisible':[('show_partner_details','!=',True)]}"/>
<label for="account_ids"/>
<group col="4">
<field name="receivable_accounts_only"/>
<field name="payable_accounts_only"/>
</group> </group>
</group>
<label for="partner_ids" attrs="{'invisible':[('show_partner_details','!=',True)]}"/>
<field name="partner_ids" nolabel="1" options="{'no_create': True}" attrs="{'invisible':[('show_partner_details','!=',True)]}"/>
<group attrs="{'invisible':[('show_partner_details','!=',True)]}"/>
<label for="account_ids"/>
<group col="4">
<field name="receivable_accounts_only"/>
<field name="payable_accounts_only"/>
</group>
<field name="account_ids" nolabel="1" options="{'no_create': True}"/>
<field name="account_ids" nolabel="1" options="{'no_create': True}"/>
</div>
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}">
<field name="not_only_one_unaffected_earnings_account" invisible="1"/>
<group/>
<h4>Trial Balance can be computed only if selected company have only one unaffected earnings account.</h4>
<group/>
</div>
<footer> <footer>
<button name="button_export_pdf" string="Export PDF" type="object" default_focus="1" class="oe_highlight"/>
or
<button name="button_export_xlsx" string="Export XLSX" type="object"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}">
<button name="button_export_pdf" string="Export PDF" type="object" default_focus="1" class="oe_highlight"/>
or
<button name="button_export_xlsx" string="Export XLSX" type="object"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</div>
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}">
<button string="Cancel" class="oe_link" special="cancel" />
</div>
</footer> </footer>
</form> </form>
</field> </field>

Loading…
Cancel
Save