Odoo Help

0

Unabel to call function in to template <t-set. Can any one help me please?

By
samba
on 2/9/15, 3:08 AM 735 views

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?

 

0
Zbik
On 2/9/15, 3:33 AM

You try  (if o is your model object):

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

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

samba
on 2/9/15, 3:43 AM

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

Zbik
on 2/9/15, 5:04 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 2/9/15, 3:08 AM
Seen: 735 times
Last updated: 3/16/15, 8:10 AM