Skip to content

Commit

Permalink
[IMP] accounting_pdf_reports: partner filter in partner ledger
Browse files Browse the repository at this point in the history
  • Loading branch information
odoomates committed Mar 31, 2023
1 parent 8082f82 commit 3f2bfde
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion accounting_pdf_reports/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
'name': 'Odoo 14 Accounting Financial Reports',
'version': '14.0.5.2.0',
'version': '14.0.6.0.0',
'category': 'Invoicing Management',
'description': 'Accounting Reports For Odoo 14, Accounting Financial Reports,'
' Odoo 14 Financial Reports',
Expand Down
6 changes: 5 additions & 1 deletion accounting_pdf_reports/report/report_partner_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ def _get_report_values(self, docids, data=None):
AND NOT account.deprecated
AND """ + query_get_data[1] + reconcile_clause
self.env.cr.execute(query, tuple(params))
partner_ids = [res['partner_id'] for res in self.env.cr.dictfetchall()]
if data['form']['partner_ids']:
partner_ids = data['form']['partner_ids']
else:
partner_ids = [res['partner_id'] for res in
self.env.cr.dictfetchall()]
partners = obj_partner.browse(partner_ids)
partners = sorted(partners, key=lambda x: (x.ref or '', x.name or ''))

Expand Down
2 changes: 2 additions & 0 deletions accounting_pdf_reports/wizard/account_partner_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ class AccountPartnerLedger(models.TransientModel):
help="It adds the currency column on report if the "
"currency differs from the company currency.")
reconciled = fields.Boolean('Reconciled Entries')
partner_ids = fields.Many2many('res.partner', string='Partners')

def _get_report_data(self, data):
data = self.pre_print_report(data)
data['form'].update({'reconciled': self.reconciled,
'partner_ids': self.partner_ids.ids,
'amount_currency': self.amount_currency})
return data

Expand Down
3 changes: 3 additions & 0 deletions accounting_pdf_reports/wizard/partner_ledger.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<field name="model">account.report.partner.ledger</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='journal_ids']" position="before">
<field name="partner_ids" widget="many2many_tags" options="{'no_open': True, 'no_create': True}"/>
</xpath>
<xpath expr="//field[@name='target_move']" position="after">
<field name="result_selection"/>
<field name="amount_currency" groups="base.group_multi_currency"/>
Expand Down

0 comments on commit 3f2bfde

Please sign in to comment.