From 125ce25e3586d5ed4093c92164cc494decce20ef Mon Sep 17 00:00:00 2001 From: Emanuel Cino Date: Thu, 24 Sep 2015 14:17:49 +0200 Subject: [PATCH 1/2] 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): From 1a42ce7acf7a91edfdaa926f85240cf8050fa5c0 Mon Sep 17 00:00:00 2001 From: Emanuel Cino Date: Thu, 24 Sep 2015 16:02:12 +0200 Subject: [PATCH 2/2] rename compute method in payment_order --- account_banking_payment_export/models/account_payment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account_banking_payment_export/models/account_payment.py b/account_banking_payment_export/models/account_payment.py index f5fb38687..795054cc5 100644 --- a/account_banking_payment_export/models/account_payment.py +++ b/account_banking_payment_export/models/account_payment.py @@ -35,11 +35,11 @@ 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) + total = fields.Float(compute='_compute_total', store=True) @api.depends('line_ids', 'line_ids.amount') @api.one - def _total(self): + def _compute_total(self): self.total = sum(self.mapped('line_ids.amount') or [0.0]) @api.multi