I'm working on simple project and I've got a problem. I want sum one column in my one2many fields how i can do this ?
from openerp import models, fields, api, _
class Fam(models.Model):
_name = 'fam'
fm_id = fields.Many2one('fam')
mileage = fields.Float(string="Mileage", required=True)
fueled = fields.Float(string="Fueled", required=True)
perliter = fields.Float(string='Price per liter', required=True)
class Car2(models.Model):
_name = 'car2'
_description = 'Car record'
_log_access = True
name = fields.Char(
string='Name',
required=True
)
mile = fields.One2many(
"fam",
"fm_id",
string='Mileage, Fuel and cost perliter',
required=True
)
average = fields.Float(
string='Average'
)
combustion = fields.Float(
string='Combustion'
)