2

i was try to show the field on the xml. But, the problem is ? the fields it's doesn't show. here is my code :

xml file.

<tr>
   <td class="bottom_border_only" ><span t-field="o.test_field_function"/></td>
</tr>

python file

def test_function(self,cr,uid,ids,origin, args, context=None) :
    print "success"

'test_field_function' : fields.function(test_function, method=True, string='data_po', type='char', store=True),
1

1 Answer 1

1

Your field will never have a value the way that you declared it. In the function you need to set the value of the field i'm using my phone but in the new api the function should be like this.

    @depends('some_field') 
   def test_function(self) :
       for rec in self:
             # loop because self can have more than one record
            rec. test_field_function = "success"

printing a message will just print it to the stdout witch is the console check odoo code to see how to use compute fields there is plenty is an open source you finf elegant code writing by professionals

Sign up to request clarification or add additional context in comments.

2 Comments

your code using odoo 8 version, and i using odoo 7 version
You can refer this answer from odoo forum: odoo.com/forum/help-1/question/… This might be helpful in your case

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.