I have a question. I created a one2many which is a replica of a one2many budget field of the sales module.
Well I want to obey the summation of all the values of the field that is inside the one2many
example :
This is my one2many:
order_line = fields.One2many ('sale.order.line', 'order_id', string = 'Orders', copy = True)
I want the subtotal sum so that after getting the total amount put it where it says (total :), so far I have echoed this but the behavior is not appropriate:
@api.multi
@api.depends('order_line.price_unit')
def _total(self):
total = 0
for element in self.order_line:
total = total + element.prince_unit
self.total = total
finally, it does not show me anything in the total field and if I print self.order_line it shows me the following:
sale.order (<odoo.models.NewId object at 0x000000000A9CD630>,)
and I do not understand