I think the below query is used to print the partner wise partner ledger report. How to modify the query to print a salesperson wise partner ledger report? What extra things should I do?
class ReportPartnerLedger(models.AbstractModel):query_get_data = self.env['account.move.line'].with_context(data['form'].get('used_context', {}))._query_get()
_inherit = 'report.account.report_partnerledger'
@api.model
def render_html(self, docids, data=None):reconcile_clause = "" if data['form']['reconciled'] else ' AND "account_move_line".reconciled = falsequery =
"""SELECT DISTINCT "account_move_line".partner_id
FROM """ + query_get_data[0] + """, account_account AS account, account_move AS am
WHERE "account_move_line".partner_id IS NOT NULL
AND "account_move_line".account_id = account.id
AND am.id = "account_move_line".move_id
AND am.state IN %s
AND "account_move_line".account_id IN %s
AND NOT account.deprecated
AND """ + query_get_data[1] + reconcile_clause
The query seems to be from this module : https://apps.odoo.com/apps/modules/10.0/account_partner_ledger_filter/ ,
For you to change this filter to saleperson , account_move_line object have no field sale person, instead you have invoice id, from this invoice id you can get the sales person , invoice_id.user_id
Enhance your Partner Ledger Report with advanced filtering options and additional data visibility. This module introduces a dynamic Salesperson filter to your Partner Ledger Report, allowing you to easily include or exclude salesperson information based on your reporting needs. Whether you need to track sales performance by individual salespeople or streamline your reporting processes, this module provides the flexibility and insights you need.
https://apps.odoo.com/apps/modules/17.0/mh_sales_person_filter_partner_ledger