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

How to place a mathematical function in a field

By
Dzingai Chakazamba
on 1/27/15, 4:03 AM 796 views

I have the following fields for my product:

NAME(char); MASS(int); PRICE(float); VALUE(float)

What I would like to do is to automatically calculate the total value of the product by multiplying the MASS with the PRICE ((MASS*PRICE)/100) in the VLAUE field. How and where do I place this function?

Thanks

1

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 1/27/15, 4:08 AM

@Dzingai what you need is to change the value field into a function field.  In new API (v8) you need to put the compute attribute in the field definition.  In both you need to develop a method in the said model to be used by the function.

You can find sample in the account.invoice modules which have quite a lot of function 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: 1/27/15, 4:03 AM
Seen: 796 times
Last updated: 3/16/15, 8:10 AM