This question has been flagged
2 Replies
4558 Views

Hi everyone,

I would like to modify the behaviour of the SurveyMailComposeMessage wizard.
All i have to do is to add a parameter to the create survey answer object.


The problem is that the method that creates the object is nested inside another method:

class SurveyMailComposeMessage(osv.TransientModel):
[...]  
    def send_mail(self, cr, uid, ids, auto_commit=False, context=None): 
    [...]
        def create_token(wizard, partner_id, email):    
        [...]

would like to override the method create_token, without overriding its "parent" method send_mail. 
Does anyone know a way to do that? Overriding the whole send_mail method is working, but i would like to avoid having to copy/paste 100 lines of code to add a single line :-).


Thanks a lot :)

Avatar
Discard
Best Answer

you can not override nested function, using any standard approach. If you consider function itself as an object and hack into it's internal definition, then you should be able to "override" the internal function, but it's not actually what we generally mean under override. see following post. I mentioned the way here, just to say that it's somehow possible, however I do not recommend this way to you, you should avoid it as much as possible if there is an alternate way to go with.

Avatar
Discard