Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
4475 Visualizzazioni

I am trying to change the contact us form. I want to put one drop down list based on my custom module. I am trying to show this custom model values in that drop down list (like many2one field.).

I am following this way.

I have written a custom model and inherited contact form.

##################models.py###################

class website_contact_for(osv.Model):
    _name = "website.contact.for"
    _columns = {
        'name' : fields.char('Style Name', required=True),
    }
    def getcontactfor(self):
        return self.search(cr,uid,[])

#####################################################

I have written   <t t-set="websitecontactfor_value_ids" t-value="getcontactfor()"/>  line in my xml file. It is giving ""'NoneType' object is not callable" while evaluating 'getcontactfor()'" error. All my files is there in my custom module itself. Can any one please help me?

 

Avatar
Abbandona
Risposta migliore

You try  (if o is your model object):

<t t-set="websitecontactfor_value_ids" t-value="o.getcontactfor()"/>

Avatar
Abbandona
Autore

Thank you Zbik, Where can i create this Object o?

o is an standard model object in report. You do not need to create it.