Skip to Content
Menu
This question has been flagged
1 Reply
2169 Views

I want to override a function ( get_account_lines ) wish is placed in sale's module   in a new custom module and whene i calledthe function only the original function was called , there is my code :


class ReportFinancialInherit(models.AbstractModel):

    _inherit = 'report.account.report_financial'


    def get_account_lines(self, data):

        super(ReportFinancial, self).get_account_lines(data)

        lines = []

        vals = {

                    'name': 'CAPITAUX PROPRES',

                    'balance': False ,

                    'balance_passe':False,

                    'type': 'report',

                    'level': 1,

                    'account_type': False, #used to underline the financial report balances

            }

        lines.append(vals)


        return lines




Avatar
Discard
Best Answer

Hi,

If you use super both the function will get executed, ie, the original one and the one in the custom module.


In your case you are not returning the super(ReportFinancial, self).get_account_lines(data),  

assign

 super(ReportFinancial, self).get_account_lines(data)  to a variable like,

res = super(ReportFinancial, self).get_account_lines(data)


And at the end of the function return the res and see. Now put print inside this function and see whether it gets printed or not.


Thanks

Avatar
Discard