Browse Source

add option to show reconciliations in the open items report

pull/739/head
Jordi Ballester Alomar 4 years ago
parent
commit
97c77bd563
  1. 24
      account_financial_report_qweb/report/open_items.py
  2. 13
      account_financial_report_qweb/report/open_items_xlsx.py
  3. 14
      account_financial_report_qweb/report/templates/open_items.xml
  4. 4
      account_financial_report_qweb/wizard/open_items_wizard.py
  5. 1
      account_financial_report_qweb/wizard/open_items_wizard_view.xml

24
account_financial_report_qweb/report/open_items.py

@ -28,7 +28,7 @@ class OpenItemsReport(models.TransientModel):
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')
show_reconciliations = fields.Boolean()
# Data fields, used to browse report data # Data fields, used to browse report data
account_ids = fields.One2many( account_ids = fields.One2many(
comodel_name='report_open_items_qweb_account', comodel_name='report_open_items_qweb_account',
@ -129,6 +129,14 @@ class OpenItemsReportMoveLine(models.TransientModel):
# Data fields, used to keep link with real object # Data fields, used to keep link with real object
move_line_id = fields.Many2one('account.move.line') 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 # Data fields, used for report display
date = fields.Date() date = fields.Date()
date_due = fields.Date() date_due = fields.Date()
@ -143,6 +151,20 @@ class OpenItemsReportMoveLine(models.TransientModel):
amount_total_due_currency = fields.Float(digits=(16, 2)) amount_total_due_currency = fields.Float(digits=(16, 2))
amount_residual_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): class OpenItemsReportCompute(models.TransientModel):
""" Here, we just define methods. """ Here, we just define methods.

13
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}, 3: {'header': _('Account'), 'field': 'account', 'width': 9},
4: {'header': _('Partner'), 'field': 'partner', 'width': 25}, 4: {'header': _('Partner'), 'field': 'partner', 'width': 25},
5: {'header': _('Ref - Label'), 'field': 'label', 'width': 40}, 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', 'field': 'amount_total_due',
'type': 'amount', 'type': 'amount',
'width': 14}, 'width': 14},
8: {'header': _('Residual'),
9: {'header': _('Residual'),
'field': 'amount_residual', 'field': 'amount_residual',
'field_final_balance': 'final_amount_residual', 'field_final_balance': 'final_amount_residual',
'type': 'amount', 'type': 'amount',
@ -40,15 +41,15 @@ class OpenItemsXslx(abstract_report_xlsx.AbstractReportXslx):
} }
if report.foreign_currency: if report.foreign_currency:
foreign_currency = { foreign_currency = {
9: {'header': _('Cur.'), 'field': 'currency_id',
10: {'header': _('Cur.'), 'field': 'currency_id',
'field_currency_balance': 'currency_id', 'field_currency_balance': 'currency_id',
'type': 'many2one', 'width': 7}, 'type': 'many2one', 'width': 7},
10: {'header': _('Cur. Original'),
11: {'header': _('Cur. Original'),
'field': 'amount_total_due_currency', 'field': 'amount_total_due_currency',
'field_final_balance': 'final_amount_total_due_currency', 'field_final_balance': 'final_amount_total_due_currency',
'type': 'amount_currency', 'type': 'amount_currency',
'width': 14}, 'width': 14},
11: {'header': _('Cur. Residual'),
12: {'header': _('Cur. Residual'),
'field': 'amount_residual_currency', 'field': 'amount_residual_currency',
'field_final_balance': 'final_amount_residual_currency', 'field_final_balance': 'final_amount_residual_currency',
'type': 'amount_currency', 'type': 'amount_currency',

14
account_financial_report_qweb/report/templates/open_items.xml

@ -105,6 +105,10 @@
<!--## ref - label--> <!--## ref - label-->
<div class="act_as_cell" style="width: 25.5%;">Ref - <div class="act_as_cell" style="width: 25.5%;">Ref -
Label</div> Label</div>
<t t-if="o.show_reconciliations">
<!--## rec - label-->
<div class="act_as_cell" style="width: 5.74%;">Rec.</div>
</t>
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell" style="width: 5.74%;">Due <div class="act_as_cell" style="width: 5.74%;">Due
date</div> date</div>
@ -160,6 +164,16 @@
</div> </div>
<!--## ref - label--> <!--## ref - label-->
<div class="act_as_cell left"><span t-field="line.label"/></div> <div class="act_as_cell left"><span t-field="line.label"/></div>
<!--## rec.-->
<t t-if="o.show_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"
style="color: black;">
<t t-raw="line.reconcile_string"/>
</a>
</t>
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell left"><span t-field="line.date_due"/></div> <div class="act_as_cell left"><span t-field="line.date_due"/></div>
<!--## amount_total_due--> <!--## amount_total_due-->

4
account_financial_report_qweb/wizard/open_items_wizard.py

@ -53,6 +53,9 @@ class OpenItemsReportWizard(models.TransientModel):
'account currency is not setup through chart of accounts ' 'account currency is not setup through chart of accounts '
'will display initial and final balance in that currency.' 'will display initial and final balance in that currency.'
) )
show_reconciliations = fields.Boolean(
string='Display reconciliations',
)
@api.onchange('company_id') @api.onchange('company_id')
def onchange_company_id(self): def onchange_company_id(self):
@ -153,6 +156,7 @@ class OpenItemsReportWizard(models.TransientModel):
'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)],
'filter_partner_ids': [(6, 0, self.partner_ids.ids)], 'filter_partner_ids': [(6, 0, self.partner_ids.ids)],
'show_reconciliations': self.show_reconciliations,
} }
def _export(self, report_type): def _export(self, report_type):

1
account_financial_report_qweb/wizard/open_items_wizard_view.xml

@ -18,6 +18,7 @@
<field name="target_move" widget="radio"/> <field name="target_move" widget="radio"/>
<field name="hide_account_at_0"/> <field name="hide_account_at_0"/>
<field name="foreign_currency"/> <field name="foreign_currency"/>
<field name="show_reconciliations"/>
</group> </group>
</group> </group>
<group name="partner_filter" col="1"> <group name="partner_filter" col="1">

Loading…
Cancel
Save