Odoo Help

0

how to get value from another function?

By
kitcle
on 4/11/15, 1:43 AM 1,197 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

1

Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
11594
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 

LinkedIn

Blog

Stackoverflow

Sudhir Arya
ERP Harbor Consulting Services
skype: 
sudhir@erpharbor.com 
Sudhir Arya (ERP Harbor Consulting Services)
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

2

Anil R. Kesariya

--Anil R. Kesariya--
5873
| 7 6 8
Rajkot, India
--Anil R. Kesariya--

Odoo Techno Functional Expert

* Engaged with odoo since May - 2012.

* Customise existing module or develop new module base on customer requirement.

* Played key developer role in many past and running projects.

* Expert in requirement gathering of business and transforming requirement into odoo platform.

* Major expertise in core modules, database, report development and theme development.

* Integration expert.


Linkedin  : https://in.linkedin.com/in/anil-kesariya-97b20a66


Anil R. Kesariya
On 4/11/15, 6:52 AM

kitcle,

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.


Regards,

Anil.


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: 4/11/15, 1:43 AM
Seen: 1197 times
Last updated: 3/13/16, 7:43 AM