mirror of
https://github.com/bringout/odoomates.git
synced 2026-04-18 23:52:07 +02:00
Partner Ledger: fix PDF filename using _get_report_base_filename method
Remove broken controller override (bypassed by l10n_ba_pdv MRO chain).
Add _get_report_base_filename() method on wizard (l10n_ba_pdv pattern).
Pass report_filename via context for l10n_ba_pdv controller to extract.
🤖 assisted by claude
This commit is contained in:
parent
3d05074af5
commit
aefecb045d
5 changed files with 8 additions and 36 deletions
|
|
@ -1,3 +1 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import main
|
||||
|
|
|
|||
|
|
@ -1,29 +1 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import json
|
||||
|
||||
from odoo.http import content_disposition, request, route
|
||||
from odoo.addons.web.controllers.report import ReportController
|
||||
|
||||
|
||||
class CustomReportController(ReportController):
|
||||
|
||||
@route()
|
||||
def report_download(self, data, context=None, token=None):
|
||||
response = super().report_download(data, context=context, token=token)
|
||||
|
||||
try:
|
||||
requestcontent = json.loads(data)
|
||||
url = requestcontent[0]
|
||||
|
||||
if 'report_partnerledger' in url and context:
|
||||
ctx = json.loads(context)
|
||||
report_filename = ctx.get('report_filename')
|
||||
if report_filename:
|
||||
response.headers['Content-Disposition'] = content_disposition(
|
||||
report_filename + '.pdf'
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return response
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue