diff --git a/account_credit_control/wizard/credit_control_communication.py b/account_credit_control/wizard/credit_control_communication.py
index 7ef92585e..5c9eca891 100644
--- a/account_credit_control/wizard/credit_control_communication.py
+++ b/account_credit_control/wizard/credit_control_communication.py
@@ -68,17 +68,25 @@ class CreditCommunication(models.TransientModel):
total_invoiced = fields.Float(string='Total Invoiced',
compute='_compute_total')
- total_due = fields.Float(string='Total Invoiced',
+ total_due = fields.Float(string='Total Due',
compute='_compute_total')
+ @api.model
+ def _get_total(self):
+ amount_field = 'credit_control_line_ids.amount_due'
+ return sum(self.mapped(amount_field))
+
+ @api.model
+ def _get_total_due(self):
+ balance_field = 'credit_control_line_ids.balance_due'
+ return sum(self.mapped(balance_field))
+
@api.depends('credit_control_line_ids',
'credit_control_line_ids.amount_due',
'credit_control_line_ids.balance_due')
def _compute_total(self):
- amount_field = 'credit_control_line_ids.amount_due'
- balance_field = 'credit_control_line_ids.balance_due'
- self.total_invoiced = sum(self.mapped(amount_field))
- self.total_due = sum(self.mapped(balance_field))
+ self.total_invoiced = self._get_total()
+ self.total_due = self._get_total_due()
@api.model
@api.returns('self', lambda value: value.id)
diff --git a/account_credit_control_dunning_fees/__init__.py b/account_credit_control_dunning_fees/__init__.py
index 6ac610f01..a485290c7 100644
--- a/account_credit_control_dunning_fees/__init__.py
+++ b/account_credit_control_dunning_fees/__init__.py
@@ -19,3 +19,4 @@
#
##############################################################################
from . import model
+from . import wizard
diff --git a/account_credit_control_dunning_fees/wizard/__init__.py b/account_credit_control_dunning_fees/wizard/__init__.py
new file mode 100644
index 000000000..b400e6315
--- /dev/null
+++ b/account_credit_control_dunning_fees/wizard/__init__.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+#
+##############################################################################
+#
+# Authors: Adrien Peiffer
+# Copyright (c) 2015 Acsone SA/NV (http://www.acsone.eu)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from . import credit_control_communication
diff --git a/account_credit_control_dunning_fees/wizard/credit_control_communication.py b/account_credit_control_dunning_fees/wizard/credit_control_communication.py
new file mode 100644
index 000000000..99669b612
--- /dev/null
+++ b/account_credit_control_dunning_fees/wizard/credit_control_communication.py
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+#
+##############################################################################
+#
+# Authors: Adrien Peiffer
+# Copyright (c) 2015 Acsone SA/NV (http://www.acsone.eu)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from openerp import models, api
+
+
+class CreditCommunication(models.TransientModel):
+ _inherit = 'credit.control.communication'
+
+ @api.model
+ def _get_total_due(self):
+ balance_field = 'credit_control_line_ids.balance_due_total'
+ return sum(self.mapped(balance_field))