简体   繁体   中英

Simple math on OpenERP

How to create addition for example 2 + 2 that will be showed in the report? I have tried to use :

num1:fields.integer('Number1', digits=16,2)),
num2:fields.float('Number2', digits=(16,2)),
result:fields.function(addition(char1,char2)),
  def _addition(self, cr, uid, ids, fields, arg, context):
      r = {}
      for record in self.browse(cr, uid, ids):
          r[record.id] = record.num1 + record.num2
      return r

  'num1' : fields.integer('Num1'),
  'num2' : fields.float('Num2'),
  'total' : fields.function(_addition, string='Tot',type='float'),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM