Skip to content

Commit

Permalink
[WIP] account_accountant_ux: mass partner ledger report
Browse files Browse the repository at this point in the history
closes #399

Signed-off-by: Filoquin adhoc <[email protected]>
  • Loading branch information
cav-adhoc committed Jul 26, 2024
1 parent f6495b5 commit ab5350a
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion account_accountant_ux/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Accounting Accountant UX',
'version': "16.0.2.3.0",
'version': "16.0.2.4.0",
'category': 'Accounting',
'sequence': 14,
'summary': '',
Expand Down
1 change: 1 addition & 0 deletions account_accountant_ux/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
from . import account_move_line
from . import account_move
from . import account_journal_dashboard
from . import res_partner
20 changes: 20 additions & 0 deletions account_accountant_ux/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from odoo import models
from odoo.exceptions import UserError

class ResPartner(models.Model):
_name = 'res.partner'
_inherit = 'res.partner'

def open_mass_partner_ledger(self):
selected_partner_ids = self.env.context.get('active_ids')
if len(selected_partner_ids) < 1000:

action = self.env["ir.actions.actions"]._for_xml_id("account_reports.action_account_report_partner_ledger")
action['params'] = {

'options': {'partner_ids': selected_partner_ids},
'ignore_session': 'both',
}
return action
else:
raise UserError('Se deben seleccionar menos de 1000 contactos')
24 changes: 24 additions & 0 deletions account_accountant_ux/views/res_partner_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,29 @@
</button>
</field>
</record>
<record model="ir.actions.server" id="action_partner_ledger">
<field name="name">Partner Ledger Report</field>
<field name="model_id" ref="model_res_partner"/>
<field name="binding_model_id" ref="model_res_partner" />
<field name="binding_view_types">tree</field>
<field name="state">code</field>
<field name="code">
if records:
action = records.open_mass_partner_ledger()
</field>
</record>

<record id="res_partner_view_search" model="ir.ui.view">
<field name="name">res.partner.search.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_res_partner_filter"/>
<field name="arch" type="xml">
<xpath expr="//filter[@name='inactive']" position="before">
<filter name="debt_to_charge" string="Deuda a cobrar" domain="['|', ('credit','>',0), ('credit', '&lt;', 0)]"/>
<filter name="debt_to_pay" string="Deuda a pagar" domain="[('debit','>',0)]"/>
<separator/>
</xpath>
</field>
</record>

</odoo>

0 comments on commit ab5350a

Please sign in to comment.