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

Default value for function field ?

By
Balvant
on 3/13/15, 9:05 AM 1,133 views

i have one function field with type integer. i want to set default value for it ? how it is possible ?

i used that field in other module with one2many relation and display it in tree view under other module.

0

Temur

--Temur--
2896
| 6 5 7
Tbilisi, Georgia
--Temur--
Programmer
Temur
On 3/13/15, 9:58 AM

- first make the functional field writable (if you don't like it to be writable by the end user, then addtionally you'll need to set it as readonly in view)

in v7.0 it may be something like:

    def _set_my_field(self, cr, uid, ids, field_name, field_value, arg, context=None):
        pass

 

    'my_field': fields.function(_compute_my_field, fnct_inv=_set_my_field, method=Truestring="My Field", type="integer")

- then set default value by the ordinary way as for other fields...

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: 3/13/15, 9:05 AM
Seen: 1133 times
Last updated: 3/16/15, 8:10 AM