Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
i would like to create a calculator operation on odoo using buttons.. but i like to use third field to show the computed values of two other fields.. whenever i hit the button with operations like Addition,division,multipulication etc.. the third field should show the result of the resulting button operation.
Here you go!
define realted methods in class which has been called from button as name value.
#your py field code
from openerp import models, fields, api
f1 = fields.Integer("Field1")
f2 = fields.Integer("Field2")
result = fields.Iteger("Result")
#method defination those will trigger from button.
self.result = self.f1 + self.f2
self.result = self.f1 * self.f2
self.result = self.f1 / self.f2
<!-- inside xml file.
Here in xml field you will define button with type="object" and specific button call the related method from the class which is assigned as name in button.
<button name="add" string="Addition" type="object"/>
<button name="mul" string="Multiplication" type="object"/>
<button name="div" string="Division" type="object"/>
Hope this will work for you.
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
|Asked: 12/29/14, 5:52 AM|
|Seen: 784 times|
|Last updated: 3/16/15, 8:10 AM|