Browse Source

[IMP] allow to display partial reconciliations in the general ledger.

- A new option is added to the general ledger wizard
  'Display partial reconciliations'. Since it has a potential performance
  impact we want this feature to be optional.
- You can navigate to the partial reconciliation records.
pull/739/head
Jordi Ballester Alomar 4 years ago
parent
commit
91cf035f78
  1. 23
      account_financial_report_qweb/report/general_ledger.py
  2. 9
      account_financial_report_qweb/report/templates/general_ledger.xml
  3. 4
      account_financial_report_qweb/wizard/general_ledger_wizard.py
  4. 1
      account_financial_report_qweb/wizard/general_ledger_wizard_view.xml

23
account_financial_report_qweb/report/general_ledger.py

@ -32,6 +32,7 @@ class GeneralLedgerReport(models.TransientModel):
hide_account_at_0 = fields.Boolean()
foreign_currency = fields.Boolean()
show_analytic_tags = fields.Boolean()
show_partial_reconciliations = fields.Boolean()
company_id = fields.Many2one(comodel_name='res.company')
filter_account_ids = fields.Many2many(comodel_name='account.account')
filter_partner_ids = fields.Many2many(comodel_name='res.partner')
@ -204,6 +205,28 @@ class GeneralLedgerReportMoveLine(models.TransientModel):
currency_id = fields.Many2one(comodel_name='res.currency')
amount_currency = fields.Float(digits=(16, 2))
# Display full or partial reconciliations
reconcile_string = fields.Char(
compute='_compute_reconcile', string='Reconcile')
partial_reconcile_ids = fields.Many2many(
comodel_name='account.partial.reconcile',
compute='_compute_reconcile',
string='Reconciliation move lines')
def _compute_reconcile(self):
for line in self:
ml = line.move_line_id
partial_recs = self.env['account.partial.reconcile']
if ml.full_reconcile_id:
rec_str = ml.full_reconcile_id.name
else:
rec_str = ', '.join([
'a%d' % pr.id for pr in
ml.matched_debit_ids + ml.matched_credit_ids])
partial_recs = ml.matched_debit_ids + ml.matched_credit_ids
line.reconcile_string = rec_str
line.partial_reconcile_ids = partial_recs
class GeneralLedgerReportCompute(models.TransientModel):
""" Here, we just define methods.

9
account_financial_report_qweb/report/templates/general_ledger.xml

@ -410,6 +410,15 @@
class="o_account_financial_reports_web_action underline-on-hover">
<t t-att-style="style" t-raw="line.matched_ml_id.name"/></a>
</span>
<span t-if="line.partial_reconcile_ids and not line.matched_ml_id and o.show_partial_reconciliations">
<t t-set="domain" t-value="[('id', 'in', line.partial_reconcile_ids.ids)]"/>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.partial.reconcile'"
class="o_account_financial_reports_web_action_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.reconcile_string"/>
</a>
</span>
</div>
<!--## debit-->
<div class="act_as_cell amount">

4
account_financial_report_qweb/wizard/general_ledger_wizard.py

@ -85,6 +85,9 @@ class GeneralLedgerReportWizard(models.TransientModel):
comodel_name='account.analytic.tag',
string='Filter accounts',
)
show_partial_reconciliations = fields.Boolean(
string='Display partial reconciliations',
)
def _default_foreign_currency(self):
if self.env.user.has_group('base.group_multi_currency'):
@ -267,6 +270,7 @@ class GeneralLedgerReportWizard(models.TransientModel):
'filter_analytic_tag_ids': [(6, 0, self.analytic_tag_ids.ids)],
'centralize': self.centralize,
'fy_start_date': self.fy_start_date,
'show_partial_reconciliations': self.show_partial_reconciliations,
}
def _export(self, report_type):

1
account_financial_report_qweb/wizard/general_ledger_wizard_view.xml

@ -25,6 +25,7 @@
<field name="hide_account_at_0"/>
<field name="foreign_currency"/>
<field name="show_analytic_tags"/>
<field name="show_partial_reconciliations"/>
</group>
</group>
<notebook>

Loading…
Cancel
Save