Store total field on payment orders

This commit is contained in:
Emanuel Cino
2015-09-24 14:17:49 +02:00
parent a2a2122164
commit 125ce25e35

View File

@@ -35,6 +35,12 @@ class PaymentOrder(models.Model):
readonly=True, states={'draft': [('readonly', False)]})
mode_type = fields.Many2one('payment.mode.type', related='mode.type',
string='Payment Type')
total = fields.Float(compute='_total', store=True)
@api.depends('line_ids', 'line_ids.amount')
@api.one
def _total(self):
self.total = sum(self.mapped('line_ids.amount') or [0.0])
@api.multi
def launch_wizard(self):