From 44f33802cdd0a02589896f128a4acca5c9ce5da5 Mon Sep 17 00:00:00 2001 From: Nicolas Bessi Date: Mon, 14 Apr 2014 13:57:02 +0200 Subject: [PATCH] [ADD] credit control dunning fees module [ADD] docstring [FIX] FeesComputer model specification to act as a abstract class without needing overriding [IMP] fees column in report and mail [FIX] dunning fees computer to register itself [RM] unused import [PEP8] [IMP] module documentation [ADD] dunniing fees translations [FIX] name of level in tests [TYPOS] Set all addons to uninstallable [ADD] credit control dunning fees module [ADD] docstring [FIX] FeesComputer model specification to act as a abstract class without needing overriding [IMP] fees column in report and mail [FIX] dunning fees computer to register itself [RM] unused import [PEP8] [IMP] module documentation [ADD] dunniing fees translations [FIX] name of level in tests [TYPOS] Set all addons to uninstallable Rename all addons to xxx_unported to be travis compliant --- .../__init__.py | 21 -- .../__openerp__.py | 71 ----- .../account_credit_control_dunning_fees.pot | 81 ------ .../i18n/fr.po | 80 ------ .../model/__init__.py | 24 -- .../model/dunning.py | 120 --------- .../model/line.py | 29 --- .../model/policy.py | 36 --- .../model/run.py | 39 --- .../report/credit_control_summary.html.mako | 246 ------------------ .../report/report.xml | 12 - .../tests/__init__.py | 23 -- .../tests/test_fees_generation.py | 95 ------- .../view/line_view.xml | 30 --- .../view/policy_view.xml | 26 -- 15 files changed, 933 deletions(-) delete mode 100644 account_credit_control_dunning_fees/__init__.py delete mode 100644 account_credit_control_dunning_fees/__openerp__.py delete mode 100644 account_credit_control_dunning_fees/i18n/account_credit_control_dunning_fees.pot delete mode 100644 account_credit_control_dunning_fees/i18n/fr.po delete mode 100644 account_credit_control_dunning_fees/model/__init__.py delete mode 100644 account_credit_control_dunning_fees/model/dunning.py delete mode 100644 account_credit_control_dunning_fees/model/line.py delete mode 100644 account_credit_control_dunning_fees/model/policy.py delete mode 100644 account_credit_control_dunning_fees/model/run.py delete mode 100644 account_credit_control_dunning_fees/report/credit_control_summary.html.mako delete mode 100644 account_credit_control_dunning_fees/report/report.xml delete mode 100644 account_credit_control_dunning_fees/tests/__init__.py delete mode 100644 account_credit_control_dunning_fees/tests/test_fees_generation.py delete mode 100644 account_credit_control_dunning_fees/view/line_view.xml delete mode 100644 account_credit_control_dunning_fees/view/policy_view.xml diff --git a/account_credit_control_dunning_fees/__init__.py b/account_credit_control_dunning_fees/__init__.py deleted file mode 100644 index 6ac610f01..000000000 --- a/account_credit_control_dunning_fees/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Nicolas Bessi -# Copyright 2014 Camptocamp SA -# -# 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 model diff --git a/account_credit_control_dunning_fees/__openerp__.py b/account_credit_control_dunning_fees/__openerp__.py deleted file mode 100644 index 687f6543f..000000000 --- a/account_credit_control_dunning_fees/__openerp__.py +++ /dev/null @@ -1,71 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Nicolas Bessi -# Copyright 2014 Camptocamp SA -# -# 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 . -# -############################################################################## -{'name': 'Credit control dunning fees', - 'version': '0.1.0', - 'author': 'Camptocamp', - 'maintainer': 'Camptocamp', - 'category': 'Accounting', - 'complexity': 'normal', - 'depends': ['account_credit_control'], - 'description': """ -Dunning Fees for Credit Control -=============================== - -This extention of credit control adds the notion of dunning fees -on credit control lines. - -Configuration -------------- -For release 0.1 only fixed fees are supported. - -You can specifiy a fixed fees amount, a product and a currency -on the credit control level form. - -The amount will be used as fees values the currency will determine -the currency of the fee. If the credit control line has not the -same currency as the fees currency, fees will be converted to -the credit control line currency. - -The product is used to compute taxes in reconciliation process. - -Run ---- -Fees are automatically computed on credit run and saved -on the generated credit lines. - -Fees can be manually edited as long credit line is draft - -Credit control Summary report includes a new fees column. -------- -Support of fees price list - -""", - 'website': 'http://www.camptocamp.com', - 'data': ['view/policy_view.xml', - 'view/line_view.xml', - 'report/report.xml'], - 'demo': [], - 'test': [], - 'installable': False, - 'auto_install': False, - 'license': 'AGPL-3', - 'application': False, -} diff --git a/account_credit_control_dunning_fees/i18n/account_credit_control_dunning_fees.pot b/account_credit_control_dunning_fees/i18n/account_credit_control_dunning_fees.pot deleted file mode 100644 index 6282315c6..000000000 --- a/account_credit_control_dunning_fees/i18n/account_credit_control_dunning_fees.pot +++ /dev/null @@ -1,81 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# * account_credit_control_dunning_fees -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 7.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-05-07 11:44+0000\n" -"PO-Revision-Date: 2014-05-07 11:44+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: account_credit_control_dunning_fees -#: code:_description:0 -#: model:ir.model,name:account_credit_control_dunning_fees.model_credit_control_line -#, python-format -msgid "A credit control line" -msgstr "" - -#. module: account_credit_control_dunning_fees -#: code:_description:0 -#: model:ir.model,name:account_credit_control_dunning_fees.model_credit_control_policy_level -#, python-format -msgid "A credit control policy level" -msgstr "" - -#. module: account_credit_control_dunning_fees -#: code:_description:0 -#: model:ir.model,name:account_credit_control_dunning_fees.model_credit_control_run -#, python-format -msgid "Credit control line generator" -msgstr "" - -#. module: account_credit_control_dunning_fees -#: field:credit.control.line,dunning_fees_amount:0 -#: view:credit.control.policy:0 -msgid "Fees" -msgstr "" - -#. module: account_credit_control_dunning_fees -#: field:credit.control.policy.level,dunning_fixed_amount:0 -msgid "Fees Fixed Amount" -msgstr "" - -#. module: account_credit_control_dunning_fees -#: field:credit.control.policy.level,dunning_product_id:0 -msgid "Fees Product" -msgstr "" - -#. module: account_credit_control_dunning_fees -#: field:credit.control.policy.level,dunning_currency_id:0 -msgid "Fees currency" -msgstr "" - -#. module: account_credit_control_dunning_fees -#: selection:credit.control.policy.level,dunning_fees_type:0 -msgid "Fixed" -msgstr "" - -#. module: account_credit_control_dunning_fees -#: view:credit.control.policy:0 -msgid "Mail and reporting" -msgstr "" - -#. module: account_credit_control_dunning_fees -#: code:_description:0 -#: model:ir.model,name:account_credit_control_dunning_fees.model_credit_control_dunning_fees_computer -#, python-format -msgid "credit.control.dunning.fees.computer" -msgstr "" - -#. module: account_credit_control_dunning_fees -#: field:credit.control.policy.level,dunning_fees_type:0 -msgid "unknown" -msgstr "" - diff --git a/account_credit_control_dunning_fees/i18n/fr.po b/account_credit_control_dunning_fees/i18n/fr.po deleted file mode 100644 index df2e9e0ba..000000000 --- a/account_credit_control_dunning_fees/i18n/fr.po +++ /dev/null @@ -1,80 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# * account_credit_control_dunning_fees -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 7.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-04-16 07:11+0000\n" -"PO-Revision-Date: 2014-04-16 07:11+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: account_credit_control_dunning_fees -#: code:_description:0 -#: model:ir.model,name:account_credit_control_dunning_fees.model_credit_control_line -#, python-format -msgid "A credit control line" -msgstr "Ligne de relance" - -#. module: account_credit_control_dunning_fees -#: code:_description:0 -#: model:ir.model,name:account_credit_control_dunning_fees.model_credit_control_policy_level -#, python-format -msgid "A credit control policy level" -msgstr "Une politique de relance" - -#. module: account_credit_control_dunning_fees -#: code:_description:0 -#: model:ir.model,name:account_credit_control_dunning_fees.model_credit_control_run -#, python-format -msgid "Credit control line generator" -msgstr "Générateur de relance" - -#. module: account_credit_control_dunning_fees -#: field:credit.control.line,dunning_fees_amount:0 -#: view:credit.control.policy:0 -msgid "Fees" -msgstr "Frais de relance" - -#. module: account_credit_control_dunning_fees -#: field:credit.control.policy.level,dunning_fixed_amount:0 -msgid "Fees Fixed Amount" -msgstr "Montant des frais" - -#. module: account_credit_control_dunning_fees -#: field:credit.control.policy.level,dunning_product_id:0 -msgid "Fees Product" -msgstr "Article lié" - -#. module: account_credit_control_dunning_fees -#: field:credit.control.policy.level,dunning_currency_id:0 -msgid "Fees currency" -msgstr "Devises" - -#. module: account_credit_control_dunning_fees -#: selection:credit.control.policy.level,dunning_fees_type:0 -msgid "Fixed" -msgstr "Fixe" - -#. module: account_credit_control_dunning_fees -#: view:credit.control.policy:0 -msgid "Mail and reporting" -msgstr "Lettres et e-mails" - -#. module: account_credit_control_dunning_fees -#: code:_description:0 -#: model:ir.model,name:account_credit_control_dunning_fees.model_credit_control_dunning_fees_computer -#, python-format -msgid "credit.control.dunning.fees.computer" -msgstr "credit.control.dunning.fees.computer" - -#. module: account_credit_control_dunning_fees -#: field:credit.control.policy.level,dunning_fees_type:0 -msgid "unknown" -msgstr "inconnu" diff --git a/account_credit_control_dunning_fees/model/__init__.py b/account_credit_control_dunning_fees/model/__init__.py deleted file mode 100644 index c9a69427a..000000000 --- a/account_credit_control_dunning_fees/model/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Nicolas Bessi -# Copyright 2014 Camptocamp SA -# -# 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 line -from . import policy -from . import run -from . import dunning diff --git a/account_credit_control_dunning_fees/model/dunning.py b/account_credit_control_dunning_fees/model/dunning.py deleted file mode 100644 index b0a75cdd2..000000000 --- a/account_credit_control_dunning_fees/model/dunning.py +++ /dev/null @@ -1,120 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Nicolas Bessi -# Copyright 2014 Camptocamp SA -# -# 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.osv import orm - - -class FeesComputer(orm.BaseModel): - """Model that compute dunnig fees. - - This class does not need any database storage as - it contains pure logic. - - It inherits form ``orm.BaseModel`` to benefit of orm facility - - Similar to AbstractModel but log access and actions - """ - - _name = 'credit.control.dunning.fees.computer' - _auto = False - _log_access = True - _register = True - _transient = False - - def _get_compute_fun(self, level_fees_type): - """Retrieve function of class that should compute the fees based on type - - :param level_fee_type: type exisiting in model `credit.control.policy.level` - for field dunning_fees_type - - :returns: a function of class :class:`FeesComputer` with following signature - self, cr, uid, credit_line (record), context - - """ - if level_fees_type == 'fixed': - return self.compute_fixed_fees - else: - raise NotImplementedError('fees type %s is not supported' % level_fees_type) - - def _compute_fees(self, cr, uid, credit_line_ids, context=None): - """Compute fees for `credit_line_ids` parameter - - Fees amount is written on credit line in field dunning_fees_amount - - :param credit_line_ids: list of `credit.control.line` ids - - :returns: `credit_line_ids` list of `credit.control.line` ids - - """ - if context is None: - context = {} - if not credit_line_ids: - return credit_line_ids - c_model = self.pool['credit.control.line'] - credit_lines = c_model.browse(cr, uid, credit_line_ids, context=context) - for credit in credit_lines: - # if there is no dependence between generated credit lines - # this could be threaded - self._compute(cr, uid, credit, context=context), - return credit_line_ids - - def _compute(self, cr, uid, credit_line, context=None): - """Compute fees for a given credit line - - Fees amount is written on credit line in field dunning_fees_amount - - :param credit_line: credit line record - - :returns: `credit_line` record - """ - fees_type = credit_line.policy_level_id.dunning_fees_type - compute = self._get_compute_fun(fees_type) - fees = compute(cr, uid, credit_line, context=context) - if fees: - credit_line.write({'dunning_fees_amount': fees}, - context=context) - return credit_line - - def compute_fixed_fees(self, cr, uid, credit_line, context=None): - """Compute fees amount for fixed fees. - Correspond to the fixed dunning fees type - - if currency of the fees is not the same as the currency - of the credit line, fees amount is converted to - currency of credit line. - - :param credit_line: credit line record - - :return: fees amount float (in credit line currency) - - """ - currency_model = self.pool['res.currency'] - credit_currency = credit_line.currency_id - level = credit_line.policy_level_id - fees_amount = level.dunning_fixed_amount - if not fees_amount: - return 0.0 - fees_currency = level.dunning_currency_id - if fees_currency == credit_currency: - return fees_amount - else: - return currency_model.compute(cr, uid, fees_currency.id, - credit_currency.id, fees_amount, - context=context) diff --git a/account_credit_control_dunning_fees/model/line.py b/account_credit_control_dunning_fees/model/line.py deleted file mode 100644 index 5e4a3f782..000000000 --- a/account_credit_control_dunning_fees/model/line.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Nicolas Bessi -# Copyright 2014 Camptocamp SA -# -# 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.osv import orm, fields - - -class credit_control_line(orm.Model): - """Add dunning_fees_amount_fees field""" - - _inherit = "credit.control.line" - - _columns = {'dunning_fees_amount': fields.float('Fees')} diff --git a/account_credit_control_dunning_fees/model/policy.py b/account_credit_control_dunning_fees/model/policy.py deleted file mode 100644 index 1cf3c699b..000000000 --- a/account_credit_control_dunning_fees/model/policy.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Nicolas Bessi -# Copyright 2014 Camptocamp SA -# -# 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.osv import orm, fields - - -class credit_control_policy(orm.Model): - """ADD dunning fees fields""" - - _inherit = "credit.control.policy.level" - _columns = {'dunning_product_id': fields.many2one('product.product', - 'Fees Product'), - 'dunning_fixed_amount': fields.float('Fees Fixed Amount'), - 'dunning_currency_id': fields.many2one('res.currency', - 'Fees currency'), - # planned type are fixed, percent, compound - 'dunning_fees_type': fields.selection([('fixed', 'Fixed')])} - - _defaults = {'dunning_fees_type': 'fixed'} diff --git a/account_credit_control_dunning_fees/model/run.py b/account_credit_control_dunning_fees/model/run.py deleted file mode 100644 index 2d6585e58..000000000 --- a/account_credit_control_dunning_fees/model/run.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Nicolas Bessi -# Copyright 2014 Camptocamp SA -# -# 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.osv import orm, fields - - -class credit_control_run(orm.Model): - """Add computation of fees""" - - _inherit = "credit.control.run" - - def _generate_credit_lines(self, cr, uid, run_id, context=None): - """Override method to add fees computation""" - credit_line_ids = super(credit_control_run, self)._generate_credit_lines( - cr, - uid, - run_id, - context=context - ) - fees_model = self.pool['credit.control.dunning.fees.computer'] - fees_model._compute_fees(cr, uid, credit_line_ids, context=context) - return credit_line_ids diff --git a/account_credit_control_dunning_fees/report/credit_control_summary.html.mako b/account_credit_control_dunning_fees/report/credit_control_summary.html.mako deleted file mode 100644 index 985a93403..000000000 --- a/account_credit_control_dunning_fees/report/credit_control_summary.html.mako +++ /dev/null @@ -1,246 +0,0 @@ -## -*- coding: utf-8 -*- - - - - - - - %for comm in objects : - <% setLang(comm.get_contact_address().lang) %> -
- - <% - add = comm.get_contact_address() - %> - %if comm.partner_id.id == add.id: - - <% address_lines = comm.partner_id.contact_address.split("\n") %> - - %else: - - - <% address_lines = add.contact_address.split("\n")[1:] %> - %endif - %for part in address_lines: - %if part: - - %endif - %endfor -
${comm.partner_id.title and comm.partner_id.title.name or ''} ${comm.partner_id.name }
${comm.partner_id.name or ''}
${add.title and add.title.name or ''} ${add.name}
${part}
-
-
-
-
- -
-
-
-
-
- -

- ${_('Reminder')}: ${comm.current_policy_level.name or '' } -

- -

${_('Dear')},

-

${comm.current_policy_level.custom_text.replace('\n', '
')}

- -
-
-

${_('Summary')}

- - - - - - - - - - - -%for line in comm.credit_control_line_ids: - - %if line.invoice_id: - - %else: - - %endif - - - - - - - -%endfor -
${_('Invoice number')}${_('Invoice date')}${_('Date due')}${_('Invoiced amount')}${_('Open amount')}${_('Fees')}${_('Currency')}
${line.invoice_id.number} - %if line.invoice_id.name: -
- ${line.invoice_id.name} - %endif -
${line.move_line_id.name}${line.date_entry}${line.date_due}${line.amount_due}${line.balance_due}${line.dunning_fees_amount}${line.currency_id.name or comm.company_id.currency_id.name}
-
-
-<%doc> - -

${_('If you have any question, do not hesitate to contact us.')}

- -

${comm.user_id.name} ${comm.user_id.email and '<%s>'%(comm.user_id.email) or ''}
- ${comm.company_id.name}
- % if comm.company_id.street: - ${comm.company_id.street or ''}
- - % endif - - % if comm.company_id.street2: - ${comm.company_id.street2}
- % endif - % if comm.company_id.city or comm.company_id.zip: - ${comm.company_id.zip or ''} ${comm.company_id.city or ''}
- % endif - % if comm.company_id.country_id: - ${comm.company_id.state_id and ('%s, ' % comm.company_id.state_id.name) or ''} ${comm.company_id.country_id.name or ''}
- % endif - % if comm.company_id.phone: - Phone: ${comm.company_id.phone}
- % endif - % if comm.company_id.website: - ${comm.company_id.website or ''}
- % endif - - -

- %endfor - - - diff --git a/account_credit_control_dunning_fees/report/report.xml b/account_credit_control_dunning_fees/report/report.xml deleted file mode 100644 index 89a9874a6..000000000 --- a/account_credit_control_dunning_fees/report/report.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - diff --git a/account_credit_control_dunning_fees/tests/__init__.py b/account_credit_control_dunning_fees/tests/__init__.py deleted file mode 100644 index db75f16d2..000000000 --- a/account_credit_control_dunning_fees/tests/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Nicolas Bessi -# Copyright 2014 Camptocamp SA -# -# 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 test_fees_generation - -checks = [test_fees_generation] diff --git a/account_credit_control_dunning_fees/tests/test_fees_generation.py b/account_credit_control_dunning_fees/tests/test_fees_generation.py deleted file mode 100644 index 0d7037a9a..000000000 --- a/account_credit_control_dunning_fees/tests/test_fees_generation.py +++ /dev/null @@ -1,95 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Nicolas Bessi -# Copyright 2014 Camptocamp SA -# -# 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 mock import MagicMock -import openerp.tests.common as test_common - - -class FixedFeesTester(test_common.TransactionCase): - - def setUp(self): - """Initialize credit control level mock to test fees computations""" - super(FixedFeesTester, self).setUp() - self.currency_model = self.registry('res.currency') - self.euro = self.currency_model.search(self.cr, self.uid, - [('name', '=', 'EUR')]) - self.assertTrue(self.euro) - self.euro = self.registry('res.currency').browse(self.cr, - self.uid, - self.euro[0]) - - self.usd = self.currency_model.search(self.cr, self.uid, - [('name', '=', 'USD')]) - self.assertTrue(self.usd) - self.usd = self.registry('res.currency').browse(self.cr, - self.uid, - self.usd[0]) - - self.euro_level = MagicMock(name='Euro policy level') - self.euro_level.dunning_fixed_amount = 5.0 - self.euro_level.dunning_currency_id = self.euro - self.euro_level.dunning_type = 'fixed' - - self.usd_level = MagicMock(name='USD policy level') - self.usd_level.dunning_fixed_amount = 5.0 - self.usd_level.dunning_currency_id = self.usd - self.usd_level.dunning_type = 'fixed' - self.dunning_model = self.registry('credit.control.dunning.fees.computer') - - def test_type_getter(self): - """Test that correct compute function is returned for "fixed" type""" - c_fun = self.dunning_model._get_compute_fun('fixed') - self.assertEqual(c_fun, self.dunning_model.compute_fixed_fees) - - def test_unknow_type(self): - """Test that non implemented error is raised if invalide fees type""" - with self.assertRaises(NotImplementedError): - self.dunning_model._get_compute_fun('bang') - - def test_computation_same_currency(self): - """Test that fees are correctly computed with same currency""" - credit_line = MagicMock(name='Euro credit line') - credit_line.policy_level_id = self.euro_level - credit_line.currency_id = self.euro - fees = self.dunning_model.compute_fixed_fees(self.cr, self.uid, - credit_line, - {}) - self.assertEqual(fees, self.euro_level.dunning_fixed_amount) - - def test_computation_different_currency(self): - """Test that fees are correctly computed with different currency""" - credit_line = MagicMock(name='USD credit line') - credit_line.policy_level_id = self.euro_level - credit_line.currency_id = self.usd - fees = self.dunning_model.compute_fixed_fees(self.cr, self.uid, - credit_line, - {}) - self.assertNotEqual(fees, self.euro_level.dunning_fixed_amount) - - def test_no_fees(self): - """Test that fees are not generated if no amount defined on level""" - credit_line = MagicMock(name='USD credit line') - credit_line.policy_level_id = self.euro_level - self.euro_level.dunning_fixed_amount = 0.0 - credit_line.currency_id = self.usd - fees = self.dunning_model.compute_fixed_fees(self.cr, self.uid, - credit_line, - {}) - self.assertEqual(fees, 0.0) diff --git a/account_credit_control_dunning_fees/view/line_view.xml b/account_credit_control_dunning_fees/view/line_view.xml deleted file mode 100644 index 9d4688bd5..000000000 --- a/account_credit_control_dunning_fees/view/line_view.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - add fees on credit control line - credit.control.line - - - - - - - - - - add fees on credit control line form - credit.control.line - - - - - - - - - - diff --git a/account_credit_control_dunning_fees/view/policy_view.xml b/account_credit_control_dunning_fees/view/policy_view.xml deleted file mode 100644 index 02e9ac618..000000000 --- a/account_credit_control_dunning_fees/view/policy_view.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - add dunning fees on policy - credit.control.policy - - - - - - - - - - - - - - - - - -