Skip to Content
Menu
This question has been flagged
223 Views

Hi All,


I am wanting to capture when certain reports are run for the first time such as picking tickets, PO receiving documents, etc, so that I can update the relevant record.


I have tried to override "ir.actions.report" object and various functions on that object.  Below is an example of what I have tried, but it appears to never get called:


I have also tried overriding the functions "run", "report_action", "render" as per the original object found at:

parOdoo/addons/odoo/addons/base/models/ir_actions_report.py at master · parodoo/parOdoo · GitHub


class IrActionsReport(models.Model):

    _inherit = 'ir.actions.report'


    def get_pdf(self, docids, data=None):

        # Log the report generation with model and records

        _logger.info(f"Custom log before PDF generation for model: {self.model}, records: {docids}")

       

        # Call the original method to continue with the PDF generation

        pdf = super(IrActionsReport, self).get_pdf(docids, data)

       

        # Additional custom logging after PDF generation

        _logger.info(f"PDF report generated for model: {self.model}, records: {docids}")

       

        return pdf


I know the file is being executed, because I was able to successfully override "IrActionsServer" in the same file.  but the IrActionReport doesn't seem to be doing anything.

Any assistance would be greatly appreciated.

Avatar
Discard