diff --git a/account_financial_report_qweb/report/open_items.py b/account_financial_report_qweb/report/open_items.py index d939958c..658ad111 100644 --- a/account_financial_report_qweb/report/open_items.py +++ b/account_financial_report_qweb/report/open_items.py @@ -28,7 +28,7 @@ class OpenItemsReport(models.TransientModel): 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') - + show_reconciliations = fields.Boolean() # Data fields, used to browse report data account_ids = fields.One2many( comodel_name='report_open_items_qweb_account', @@ -129,6 +129,14 @@ class OpenItemsReportMoveLine(models.TransientModel): # Data fields, used to keep link with real object move_line_id = fields.Many2one('account.move.line') + # 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') + # Data fields, used for report display date = fields.Date() date_due = fields.Date() @@ -143,6 +151,20 @@ class OpenItemsReportMoveLine(models.TransientModel): amount_total_due_currency = fields.Float(digits=(16, 2)) amount_residual_currency = fields.Float(digits=(16, 2)) + 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 OpenItemsReportCompute(models.TransientModel): """ Here, we just define methods. diff --git a/account_financial_report_qweb/report/open_items_xlsx.py b/account_financial_report_qweb/report/open_items_xlsx.py index 58343068..0d1d3222 100644 --- a/account_financial_report_qweb/report/open_items_xlsx.py +++ b/account_financial_report_qweb/report/open_items_xlsx.py @@ -27,12 +27,13 @@ class OpenItemsXslx(abstract_report_xlsx.AbstractReportXslx): 3: {'header': _('Account'), 'field': 'account', 'width': 9}, 4: {'header': _('Partner'), 'field': 'partner', 'width': 25}, 5: {'header': _('Ref - Label'), 'field': 'label', 'width': 40}, - 6: {'header': _('Due date'), 'field': 'date_due', 'width': 11}, - 7: {'header': _('Original'), + 6: {'header': _('Rec.'), 'field': 'reconcile_string', 'width': 11}, + 7: {'header': _('Due date'), 'field': 'date_due', 'width': 11}, + 8: {'header': _('Original'), 'field': 'amount_total_due', 'type': 'amount', 'width': 14}, - 8: {'header': _('Residual'), + 9: {'header': _('Residual'), 'field': 'amount_residual', 'field_final_balance': 'final_amount_residual', 'type': 'amount', @@ -40,15 +41,15 @@ class OpenItemsXslx(abstract_report_xlsx.AbstractReportXslx): } if report.foreign_currency: foreign_currency = { - 9: {'header': _('Cur.'), 'field': 'currency_id', - 'field_currency_balance': 'currency_id', - 'type': 'many2one', 'width': 7}, - 10: {'header': _('Cur. Original'), + 10: {'header': _('Cur.'), 'field': 'currency_id', + 'field_currency_balance': 'currency_id', + 'type': 'many2one', 'width': 7}, + 11: {'header': _('Cur. Original'), 'field': 'amount_total_due_currency', 'field_final_balance': 'final_amount_total_due_currency', 'type': 'amount_currency', 'width': 14}, - 11: {'header': _('Cur. Residual'), + 12: {'header': _('Cur. Residual'), 'field': 'amount_residual_currency', 'field_final_balance': 'final_amount_residual_currency', 'type': 'amount_currency', diff --git a/account_financial_report_qweb/report/templates/open_items.xml b/account_financial_report_qweb/report/templates/open_items.xml index 1f451505..9312c506 100644 --- a/account_financial_report_qweb/report/templates/open_items.xml +++ b/account_financial_report_qweb/report/templates/open_items.xml @@ -105,6 +105,10 @@