Odoo Help

Welcome!

This community 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.

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 408 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

--zbik--
5941
| 6 4 7
Lodz, Poland
--zbik--


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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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