Odoo Help


how to get value from another function?

on 4/11/15, 1:43 AM 908 views

def _wc(self, cr, uid, ids, field_name, arg, context=None):

      res = {}

      v = {'w': 1,'l': 1,'h': 1,}

      for f in self.browse(cr, uid, ids, context=context):

          res[f.id] = v

          res[f.id]['w'] = 8*1

          res[f.id]['l'] = 8*2

          res[f.id]['h'] = 8*3

      return res


def _wc2(self, cr, uid, ids, field_name, arg, context=None):

      res = {}

      v = {'x': 1,'y': 1,}

      for f in self.browse(cr, uid, ids, context=context):

          res[f.id] = v

          res[f.id]['x'] = how to get value ...'w' from def _wc.... ??

          res[f.id]['y'] = 25

      return res


Sudhir Arya (SA)

--Sudhir Arya (SA)--
| 6 8 8
Ahmedabad, India
--Sudhir Arya (SA)--

Working as an OpenERP/Odoo developer and a Team Leader 

Top 5 Odoo contributor On Stackoverflow




Sudhir Arya (SA)
On 4/11/15, 3:28 AM

Hello Kitcle,

It seems w is your function field so you directly can get it's value either browse or read method.

Try following code:

res[f.id]['x'] = f.w #how to get value ...'w' from def _wc.... ??

System will call function when you access function field if the field is not stored in database, otherwise system will get it's value from database instead calling method.

Reference: Function field


Anil R. Kesariya

--Anil R. Kesariya--
| 6 5 8
Gandhinagar, India
--Anil R. Kesariya--
ERP Consultant

Key Skill
Technical & Functional Expert
Anil R. Kesariya
On 4/11/15, 6:52 AM


This guidance might help you.

1) If you will combined both the function by applying multi="your key" on that field it will call the common function for all the fields, so you can return at the same time all the fileds value, it will be easy to get information based on another field.

2) If you are using v8 (api) coding standard

Than you can directly use store=true, it will always  store the latest calculated value in the database, because in api coding standard , it using depends decorator.

Here is the link for that example : click here  for more information for store=true in v8, follow the answer given in attached link.

Or Explain more your question if you don't want to comibined function for all field, explain the exact purpose for doing this.



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.


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)


Asked: 4/11/15, 1:43 AM
Seen: 908 times
Last updated: 3/13/16, 7:43 AM