Odoo Help


how to replace some strings to float value and do calculations?

on 8/30/16, 2:38 AM 634 views

Hi friends,

I have a char field,which has formula for calculations (char field value is 0.17*(@tw)+0.6*(@tw-500) ).Here i need to replace @tw with some float value and do calculations and need to return float value.How to achieve this.

Thanks in advance.

it shows invalid syntax error on .20*@tw

on 8/30/16, 3:07 AM

use it without @

just 0.20*tw

its working

yousif Mobark
on 8/30/16, 10:57 AM
yousif Mobark
On 8/30/16, 2:57 AM

hello vadivel

you can do it with "eval" method

def formula( self ):     
    tw=10 #your value
  return eval ('0.17*(tw)+0.6*(tw-500)')

Good Luck

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: 8/30/16, 2:38 AM
Seen: 634 times
Last updated: 8/30/16, 3:08 AM