From 125ce25e3586d5ed4093c92164cc494decce20ef Mon Sep 17 00:00:00 2001 From: Emanuel Cino Date: Thu, 24 Sep 2015 14:17:49 +0200 Subject: [PATCH] Store total field on payment orders --- account_banking_payment_export/models/account_payment.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/account_banking_payment_export/models/account_payment.py b/account_banking_payment_export/models/account_payment.py index 59f5a1da7..f5fb38687 100644 --- a/account_banking_payment_export/models/account_payment.py +++ b/account_banking_payment_export/models/account_payment.py @@ -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):