Browse Source

Grab improvements from PR #469 (LLN Code sprint)

Use OCA module web_widget_many2many_tags_multi_selection: remove inherit of create() in wizards and restore many2many_tags for account and partner filters
Better layout of columns in Web/PDF report of trial balance
Fix XLSX reports in foreign currency
Update string "Account balance at 0 filter" -> "Account at 0 filter"
Remove onchange on hide_account_at_0 in trial balance wizard
pull/485/head
Alexis de Lattre 6 years ago
committed by Jordi Ballester Alomar
parent
commit
d63c07e15a
  1. 1
      account_financial_report_qweb/__manifest__.py
  2. 3
      account_financial_report_qweb/readme/HISTORY.rst
  3. 6
      account_financial_report_qweb/report/templates/trial_balance.xml
  4. 14
      account_financial_report_qweb/report/trial_balance_xlsx.py
  5. 21
      account_financial_report_qweb/wizard/aged_partner_balance_wizard.py
  6. 13
      account_financial_report_qweb/wizard/aged_partner_balance_wizard_view.xml
  7. 21
      account_financial_report_qweb/wizard/general_ledger_wizard.py
  8. 6
      account_financial_report_qweb/wizard/general_ledger_wizard_view.xml
  9. 21
      account_financial_report_qweb/wizard/open_items_wizard.py
  10. 13
      account_financial_report_qweb/wizard/open_items_wizard_view.xml
  11. 23
      account_financial_report_qweb/wizard/trial_balance_wizard.py
  12. 8
      account_financial_report_qweb/wizard/trial_balance_wizard_view.xml

1
account_financial_report_qweb/__manifest__.py

@ -20,6 +20,7 @@
'date_range',
'report_xlsx',
'report',
'web_widget_many2many_tags_multi_selection',
],
'data': [
'wizard/aged_partner_balance_wizard_view.xml',

3
account_financial_report_qweb/readme/HISTORY.rst

@ -3,4 +3,7 @@
* The Trial Balance now allows to display the hierarchy of accounts
* In the Trial Balance you can apply a filter by hierarchy levels
* The Trial Balance shows the unaffected earnings account computed as:
initial balance: sum of past unaffected earnings + P&L result; debit, credit
and period balance: totals only for the unaffected earnings account.
* In the Journal Ledger the field 'Journal' is now optional

6
account_financial_report_qweb/report/templates/trial_balance.xml

@ -108,7 +108,7 @@
<div class="act_as_row labels">
<div class="act_as_cell">Date range filter</div>
<div class="act_as_cell">Target moves filter</div>
<div class="act_as_cell">Account balance at 0 filter</div>
<div class="act_as_cell">Account at 0 filter</div>
<div class="act_as_cell">Limit hierarchy levels</div>
</div>
<div class="act_as_row">
@ -143,12 +143,12 @@
<!--## Code-->
<div class="act_as_cell" style="width: 8.86%;">Code</div>
<!--## Account-->
<div class="act_as_cell" style="width: 52.58%;">Account
<div class="act_as_cell" style="width: 37.58%;">Account
</div>
</t>
<t t-if="show_partner_details">
<!--## Partner-->
<div class="act_as_cell" style="width: 61.44%;">Partner
<div class="act_as_cell" style="width: 46.44%;">Partner
</div>
</t>
<!--## Initial balance-->

14
account_financial_report_qweb/report/trial_balance_xlsx.py

@ -46,15 +46,15 @@ class TrialBalanceXslx(abstract_report_xlsx.AbstractReportXslx):
}
if report.foreign_currency:
foreign_currency = {
6: {'header': _('Cur.'),
7: {'header': _('Cur.'),
'field': 'currency_id',
'field_currency_balance': 'currency_id',
'type': 'many2one', 'width': 7},
7: {'header': _('Initial balance'),
8: {'header': _('Initial balance'),
'field': 'initial_balance_foreign_currency',
'type': 'amount_currency',
'width': 14},
8: {'header': _('Ending balance'),
9: {'header': _('Ending balance'),
'field': 'final_balance_foreign_currency',
'type': 'amount_currency',
'width': 14},
@ -87,15 +87,15 @@ class TrialBalanceXslx(abstract_report_xlsx.AbstractReportXslx):
}
if report.foreign_currency:
foreign_currency = {
5: {'header': _('Cur.'),
6: {'header': _('Cur.'),
'field': 'currency_id',
'field_currency_balance': 'currency_id',
'type': 'many2one', 'width': 7},
6: {'header': _('Initial balance'),
7: {'header': _('Initial balance'),
'field': 'initial_balance_foreign_currency',
'type': 'amount_currency',
'width': 14},
7: {'header': _('Ending balance'),
8: {'header': _('Ending balance'),
'field': 'final_balance_foreign_currency',
'type': 'amount_currency',
'width': 14},
@ -110,7 +110,7 @@ class TrialBalanceXslx(abstract_report_xlsx.AbstractReportXslx):
[_('Target moves filter'),
_('All posted entries') if report.only_posted_moves
else _('All entries')],
[_('Account balance at 0 filter'),
[_('Account at 0 filter'),
_('Hide') if report.hide_account_at_0 else _('Show')],
[_('Show foreign currency'),
_('Yes') if report.foreign_currency else _('No')],

21
account_financial_report_qweb/wizard/aged_partner_balance_wizard.py

@ -53,27 +53,6 @@ class AgedPartnerBalance(models.TransientModel):
else:
self.account_ids = None
@api.model
def create(self, vals):
"""
This is a workaround for bug https://github.com/odoo/odoo/issues/14761
This bug impacts M2M fields in wizards filled-up via onchange
It replaces the workaround widget="many2many_tags" on
field name="account_ids" which prevented from selecting several
accounts at the same time (quite useful when you want to select
an interval of accounts for example)
"""
if 'account_ids' in vals and isinstance(vals['account_ids'], list):
account_ids = []
for account in vals['account_ids']:
if account[0] in (1, 4):
account_ids.append(account[1])
elif account[0] == 6 and isinstance(account[2], list):
account_ids += account[2]
vals['account_ids'] = [(6, 0, account_ids)]
res = super(AgedPartnerBalance, self).create(vals)
return res
@api.multi
def button_export_html(self):
self.ensure_one()

13
account_financial_report_qweb/wizard/aged_partner_balance_wizard_view.xml

@ -19,15 +19,16 @@
<field name="show_move_line_details"/>
</group>
</group>
<label for="partner_ids"/>
<field name="partner_ids" nolabel="1" options="{'no_create': True}"/>
<group/>
<label for="account_ids"/>
<group col="4">
<group name="partner_filter" col="1">
<label for="partner_ids"/>
<field name="partner_ids" nolabel="1" widget="many2many_tags" options="{'no_create': True}"/>
</group>
<group name="account_filter" col="4">
<label for="account_ids" colspan="4"/>
<field name="receivable_accounts_only"/>
<field name="payable_accounts_only"/>
<field name="account_ids" nolabel="1" widget="many2many_tags" options="{'no_create': True}" colspan="4"/>
</group>
<field name="account_ids" nolabel="1" options="{'no_create': True}"/>
<footer>
<button name="button_export_html" string="View"
type="object" default_focus="1" class="oe_highlight"/>

21
account_financial_report_qweb/wizard/general_ledger_wizard.py

@ -117,27 +117,6 @@ class GeneralLedgerReportWizard(models.TransientModel):
else:
self.account_ids = None
@api.model
def create(self, vals):
"""
This is a workaround for bug https://github.com/odoo/odoo/issues/14761
This bug impacts M2M fields in wizards filled-up via onchange
It replaces the workaround widget="many2many_tags" on
field name="account_ids" which prevented from selecting several
accounts at the same time (quite useful when you want to select
an interval of accounts for example)
"""
if 'account_ids' in vals and isinstance(vals['account_ids'], list):
account_ids = []
for account in vals['account_ids']:
if account[0] in (1, 4):
account_ids.append(account[1])
elif account[0] == 6 and isinstance(account[2], list):
account_ids += account[2]
vals['account_ids'] = [(6, 0, account_ids)]
res = super(GeneralLedgerReportWizard, self).create(vals)
return res
@api.onchange('partner_ids')
def onchange_partner_ids(self):
"""Handle partners change."""

6
account_financial_report_qweb/wizard/general_ledger_wizard_view.xml

@ -33,16 +33,16 @@
<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" widget="many2many_tags" options="{'no_create': True}"/>
</page>
<page string="Filter partners">
<field name="partner_ids" nolabel="1" options="{'no_create': True}"/>
<field name="partner_ids" nolabel="1" widget="many2many_tags" options="{'no_create': True}"/>
</page>
<page string="Filter cost centers" groups="analytic.group_analytic_accounting">
<field name="cost_center_ids" nolabel="1" options="{'no_create': True}" groups="analytic.group_analytic_accounting"/>
</page>
<page string="Filter analytic tags">
<field name="analytic_tag_ids" nolabel="1" options="{'no_create': True}"/>
<field name="analytic_tag_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/>
</page>
</notebook>
</div>

21
account_financial_report_qweb/wizard/open_items_wizard.py

@ -66,27 +66,6 @@ class OpenItemsReportWizard(models.TransientModel):
else:
self.account_ids = None
@api.model
def create(self, vals):
"""
This is a workaround for bug https://github.com/odoo/odoo/issues/14761
This bug impacts M2M fields in wizards filled-up via onchange
It replaces the workaround widget="many2many_tags" on
field name="account_ids" which prevented from selecting several
accounts at the same time (quite useful when you want to select
an interval of accounts for example)
"""
if 'account_ids' in vals and isinstance(vals['account_ids'], list):
account_ids = []
for account in vals['account_ids']:
if account[0] in (1, 4):
account_ids.append(account[1])
elif account[0] == 6 and isinstance(account[2], list):
account_ids += account[2]
vals['account_ids'] = [(6, 0, account_ids)]
res = super(OpenItemsReportWizard, self).create(vals)
return res
@api.multi
def button_export_html(self):
self.ensure_one()

13
account_financial_report_qweb/wizard/open_items_wizard_view.xml

@ -20,15 +20,16 @@
<field name="foreign_currency"/>
</group>
</group>
<label for="partner_ids"/>
<field name="partner_ids" nolabel="1" options="{'no_create': True}"/>
<group/>
<label for="account_ids"/>
<group col="4">
<group name="partner_filter" col="1">
<label for="partner_ids"/>
<field name="partner_ids" nolabel="1" widget="many2many_tags" options="{'no_create': True}"/>
</group>
<group name="account_filter" col="4">
<label for="account_ids" colspan="4"/>
<field name="receivable_accounts_only"/>
<field name="payable_accounts_only"/>
<field name="account_ids" nolabel="1" widget="many2many_tags" options="{'no_create': True}" colspan="4"/>
</group>
<field name="account_ids" nolabel="1" options="{'no_create': True}"/>
<footer>
<button name="button_export_html" string="View"
type="object" default_focus="1" class="oe_highlight"/>

23
account_financial_report_qweb/wizard/trial_balance_wizard.py

@ -130,36 +130,13 @@ class TrialBalanceReportWizard(models.TransientModel):
else:
self.account_ids = None
@api.model
def create(self, vals):
"""
This is a workaround for bug https://github.com/odoo/odoo/issues/14761
This bug impacts M2M fields in wizards filled-up via onchange
It replaces the workaround widget="many2many_tags" on
field name="account_ids" which prevented from selecting several
accounts at the same time (quite useful when you want to select
an interval of accounts for example)
"""
if 'account_ids' in vals and isinstance(vals['account_ids'], list):
account_ids = []
for account in vals['account_ids']:
if account[0] in (1, 4):
account_ids.append(account[1])
elif account[0] == 6 and isinstance(account[2], list):
account_ids += account[2]
vals['account_ids'] = [(6, 0, account_ids)]
res = super(TrialBalanceReportWizard, self).create(vals)
return res
@api.onchange('show_partner_details')
def onchange_show_partner_details(self):
"""Handle partners change."""
if self.show_partner_details:
self.receivable_accounts_only = self.payable_accounts_only = True
self.hide_account_at_0 = True
else:
self.receivable_accounts_only = self.payable_accounts_only = False
self.hide_account_at_0 = False
@api.multi
def button_export_html(self):

8
account_financial_report_qweb/wizard/trial_balance_wizard_view.xml

@ -31,14 +31,14 @@
</group>
<group name="partner_filter" attrs="{'invisible':[('show_partner_details','!=',True)]}" col="1">
<label for="partner_ids"/>
<field name="partner_ids" nolabel="1" options="{'no_create': True}"/>
<field name="partner_ids" nolabel="1" widget="many2many_tags" options="{'no_create': True}"/>
</group>
<label for="account_ids"/>
<group col="4">
<group name="account_filter" col="4">
<label for="account_ids" colspan="4"/>
<field name="receivable_accounts_only"/>
<field name="payable_accounts_only"/>
<field name="account_ids" nolabel="1" widget="many2many_tags" options="{'no_create': True}" colspan="4"/>
</group>
<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"/>

Loading…
Cancel
Save