简体   繁体   English

OpenERP 上的简单数学

[英]Simple math on OpenERP

How to create addition for example 2 + 2 that will be showed in the report?如何创建将在报告中显示的例如 2 + 2 的加法? 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'),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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