Explorar el Código

commit inicial

Rodney Elpidio Enciso Arias hace 7 años
commit
6954e2ef68

+ 35 - 0
README.rst

@@ -0,0 +1,35 @@
+Account Payment Term Extension
+==============================
+
+This module was written to extend the functionality of payment terms to support rounding, months and weeks on payment term lines.
+
+By default in Odoo, if you have a payment term of *30 days end of months* and you invoice on January 30, you will have a due date on March 31st. With this module, if you configure the payment term line with months = 1, days = 0 and days2 = -1, you will have a due date on February 28th.
+
+This module also adds support for payment terms such as *End of month 45 days* (which is not the same as *45 days end of month* !).
+
+Configuration
+=============
+
+To configure the Payment Terms and see the new options on the Payment Term Lines, go to the menu Accounting > Configuration > Miscellaneous > Payment Terms.
+
+Credits
+=======
+
+Contributors
+------------
+
+* Yannick Vaucher <yannick.vaucher@camptocamp.com>
+* Alexis de Lattre <alexis.delattre@akretion.com>
+
+Maintainer
+----------
+
+.. image:: http://odoo-community.org/logo.png
+   :alt: Odoo Community Association
+   :target: http://odoo-community.org
+
+This module is maintained by the OCA.
+
+OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
+
+To contribute to this module, please visit http://odoo-community.org.

+ 21 - 0
__init__.py

@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Yannick Vaucher
+#    Copyright 2013 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from . import account

BIN
__init__.pyc


+ 40 - 0
__openerp__.py

@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Yannick Vaucher
+#    Copyright 2013 Camptocamp SA
+#    Copyright 2015 Akretion (www.akretion.com)
+#    @author Alexis de Lattre <alexis.delattre@akretion.com>
+#
+#    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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+{
+    'name': 'Payment Term Extension',
+    'version': '8.0.1.0.0',
+    'category': 'Accounting & Finance',
+    'summary': 'Adds rounding, months and weeks properties on '
+               'payment term lines',
+    'description': "",
+    'author': 'Camptocamp,Odoo Community Association (OCA)',
+    'maintainer': 'OCA',
+    'website': 'http://www.camptocamp.com/',
+    'license': 'AGPL-3',
+    'depends': ['account'],
+    'data': ['account_view.xml'],
+    'demo': ['account_demo.xml'],
+    'test': [],
+    'installable': True,
+}

+ 117 - 0
account.py

@@ -0,0 +1,117 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Yannick Vaucher
+#    Copyright 2013 Camptocamp SA
+#    Copyright (C) 2004-2010 OpenERP S.A. (www.odoo.com)
+#    Copyright (C) 2015 Akretion (http://www.akretion.com)
+#    @author Alexis de Lattre <alexis.delattre@akretion.com>
+#
+#    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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from datetime import datetime
+from dateutil.relativedelta import relativedelta
+import time
+
+from openerp import models, fields, api
+from openerp.tools.float_utils import float_round
+
+import openerp.addons.decimal_precision as dp
+from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
+
+
+class AccountPaymentTermLine(models.Model):
+    _inherit = "account.payment.term.line"
+
+    amount_round = fields.Float(
+        string='Amount Rounding',
+        digits=dp.get_precision('Account'),
+        # TODO : I don't understand this help msg ; what is surcharge ?
+        help="Sets the amount so that it is a multiple of this value.\n"
+             "To have amounts that end in 0.99, set rounding 1, "
+             "surcharge -0.01")
+    months = fields.Integer(string='Number of Months')
+    weeks = fields.Integer(string='Number of Weeks')
+    start_with_end_month = fields.Boolean(
+        string='Start by End of Month',
+        help="If you have a payment term 'End of month 45 days' "
+        "(which is not the same as '45 days end of month' !), you "
+        "should activate this option and then set "
+        "'Number of days' = 45 and 'Day of the month' = 0.")
+
+    @api.multi
+    def compute_line_amount(self, total_amount, remaining_amount):
+        """Compute the amount for a payment term line.
+        In case of procent computation, use the payment
+        term line rounding if defined
+
+            :param total_amount: total balance to pay
+            :param remaining_amount: total amount minus sum of previous lines
+                computed amount
+            :returns: computed amount for this line
+        """
+        self.ensure_one()
+        prec = self.env['decimal.precision'].precision_get('Account')
+        if self.value == 'fixed':
+            return float_round(self.value_amount, precision_digits=prec)
+        elif self.value == 'procent':
+            amt = total_amount * self.value_amount
+            if self.amount_round:
+                amt = float_round(amt, precision_rounding=self.amount_round)
+            return float_round(amt, precision_digits=prec)
+        elif self.value == 'balance':
+            return float_round(remaining_amount,  precision_digits=prec)
+        return None
+
+
+class AccountPaymentTerm(models.Model):
+    _inherit = "account.payment.term"
+
+    def compute(self, cr, uid, id, value, date_ref=False, context=None):
+        """Complete overwrite of compute method to add rounding on line
+        computing and also to handle weeks and months
+        """
+        obj_precision = self.pool['decimal.precision']
+        prec = obj_precision.precision_get(cr, uid, 'Account')
+        if not date_ref:
+            date_ref = datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT)
+        pt = self.browse(cr, uid, id, context=context)
+        amount = value
+        result = []
+        for line in pt.line_ids:
+            amt = line.compute_line_amount(value, amount)
+            if not amt:
+                continue
+
+            next_date = fields.Date.from_string(date_ref)
+            if line.start_with_end_month:
+                next_date += relativedelta(day=1, months=1, days=-1)
+            next_date += relativedelta(
+                days=line.days, weeks=line.weeks, months=line.months)
+            if line.days2 < 0:
+                # Getting 1st of next month
+                next_date += relativedelta(day=1, months=1, days=line.days2)
+            if line.days2 > 0:
+                next_date += relativedelta(day=line.days2, months=1)
+            result.append(
+                (fields.Date.to_string(next_date), amt))
+            amount -= amt
+
+        amount = reduce(lambda x, y: x + y[1], result, 0.0)
+        dist = round(value - amount, prec)
+        if dist:
+            result.append((time.strftime(DEFAULT_SERVER_DATE_FORMAT), dist))
+        return result

BIN
account.pyc


+ 25 - 0
account_demo.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<openerp>
+<data noupdate="1">
+
+<record id="account.account_payment_term_line" model="account.payment.term.line">
+    <field name="days" eval="0"/>
+    <field name="months" eval="1"/>
+</record>
+
+<record id="sixty_days_end_of_month" model="account.payment.term">
+    <field name="name">60 Days End of Month</field>
+    <field name="note">60 Days End of Month</field>
+</record>
+
+<record id="sixty_days_end_of_month_line" model="account.payment.term.line">
+    <field name="payment_id" ref="sixty_days_end_of_month"/>
+    <field name="value">balance</field>
+    <field name="months" eval="2"/>
+    <field name="days" eval="0"/>
+    <field name="days2" eval="-1"/>
+</record>
+
+</data>
+</openerp>

+ 43 - 0
account_view.xml

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="view_payment_term_line_form" model="ir.ui.view">
+            <field name="name">account.payment.term.line.form.extension</field>
+            <field name="model">account.payment.term.line</field>
+            <field name="inherit_id" ref="account.view_payment_term_line_form"/>
+            <field name="arch" type="xml">
+                <div attrs="{'invisible':[('value','=','balance')]}" position="after">
+                    <field name="amount_round"
+                        attrs="{'invisible':[('value','=','balance')]}"/>
+                </div>
+                <field name="days" position="after">
+                    <field name="weeks"/>
+                    <field name="months"/>
+                </field>
+                <field name="days" position="before">
+                    <field name="start_with_end_month"/>
+                </field>
+            </field>
+        </record>
+
+        <record id="view_payment_term_line_tree" model="ir.ui.view">
+            <field name="name">account.payment.term.line.tree.extension</field>
+            <field name="model">account.payment.term.line</field>
+            <field name="inherit_id" ref="account.view_payment_term_line_tree" />
+            <field name="arch"  type="xml">
+                <field name="value_amount" position="after">
+                    <field name="amount_round"/>
+                </field>
+                <field name="days" position="after">
+                    <field name="weeks"/>
+                    <field name="months"/>
+                </field>
+                <field name="days" position="before">
+                    <field name="start_with_end_month"/>
+                </field>
+            </field>
+        </record>
+
+    </data>
+</openerp>

BIN
documentation/DOC_payment_terms_rounding.ods


+ 54 - 0
i18n/account_payment_term_extension.pot

@@ -0,0 +1,54 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+#	* account_payment_term_extension
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-03-01 20:46+0000\n"
+"PO-Revision-Date: 2015-03-01 20:46+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_payment_term_extension
+#: model:account.payment.term,name:account_payment_term_extension.sixty_days_end_of_month
+#: model:account.payment.term,note:account_payment_term_extension.sixty_days_end_of_month
+msgid "60 Days End of Month"
+msgstr ""
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,amount_round:0
+msgid "Amount Rounding"
+msgstr ""
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,months:0
+msgid "Number of Months"
+msgstr ""
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,weeks:0
+msgid "Number of Weeks"
+msgstr ""
+
+#. module: account_payment_term_extension
+#: model:ir.model,name:account_payment_term_extension.model_account_payment_term
+msgid "Payment Term"
+msgstr ""
+
+#. module: account_payment_term_extension
+#: model:ir.model,name:account_payment_term_extension.model_account_payment_term_line
+msgid "Payment Term Line"
+msgstr ""
+
+#. module: account_payment_term_extension
+#: help:account.payment.term.line,amount_round:0
+msgid "Sets the amount so that it is a multiple of this value.\n"
+"To have amounts that end in 0.99, set rounding 1, surcharge -0.01"
+msgstr ""
+

+ 57 - 0
i18n/de.po

@@ -0,0 +1,57 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * account_payment_term_extension
+# 
+# Translators:
+# Rudolf Schnapka <rs@techno-flex.de>, 2015
+msgid ""
+msgstr ""
+"Project-Id-Version: account-invoicing (8.0)\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-11-21 01:40+0000\n"
+"PO-Revision-Date: 2015-11-24 09:59+0000\n"
+"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>\n"
+"Language-Team: German (http://www.transifex.com/oca/OCA-account-invoicing-8-0/language/de/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Language: de\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#. module: account_payment_term_extension
+#: model:account.payment.term,name:account_payment_term_extension.sixty_days_end_of_month
+#: model:account.payment.term,note:account_payment_term_extension.sixty_days_end_of_month
+msgid "60 Days End of Month"
+msgstr "60 Tage zum Monatsende"
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,amount_round:0
+msgid "Amount Rounding"
+msgstr "Betragsrundung"
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,months:0
+msgid "Number of Months"
+msgstr "Anzahl Monate"
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,weeks:0
+msgid "Number of Weeks"
+msgstr "Anzahl Wochen"
+
+#. module: account_payment_term_extension
+#: model:ir.model,name:account_payment_term_extension.model_account_payment_term
+msgid "Payment Term"
+msgstr "Zahlungsbedingung"
+
+#. module: account_payment_term_extension
+#: model:ir.model,name:account_payment_term_extension.model_account_payment_term_line
+msgid "Payment Term Line"
+msgstr "Position der Zahlungsbedingung"
+
+#. module: account_payment_term_extension
+#: help:account.payment.term.line,amount_round:0
+msgid ""
+"Sets the amount so that it is a multiple of this value.\n"
+"To have amounts that end in 0.99, set rounding 1, surcharge -0.01"
+msgstr "Setzt den Betrag, so dass dieser ein Vielfaches dieses Wertes hat.\nUm Beträge, die auf 0,99 enden zu erhalten, setzen Sie Rundung auf 1 und Aufschlag -0,01"

+ 58 - 0
i18n/es.po

@@ -0,0 +1,58 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * account_payment_term_extension
+# 
+# Translators:
+# Antonio Trueba, 2016
+# Antonio Trueba, 2016
+msgid ""
+msgstr ""
+"Project-Id-Version: account-invoicing (8.0)\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-12-04 01:38+0000\n"
+"PO-Revision-Date: 2016-02-23 12:44+0000\n"
+"Last-Translator: Antonio Trueba\n"
+"Language-Team: Spanish (http://www.transifex.com/oca/OCA-account-invoicing-8-0/language/es/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Language: es\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#. module: account_payment_term_extension
+#: model:account.payment.term,name:account_payment_term_extension.sixty_days_end_of_month
+#: model:account.payment.term,note:account_payment_term_extension.sixty_days_end_of_month
+msgid "60 Days End of Month"
+msgstr "60 días fin de mes"
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,amount_round:0
+msgid "Amount Rounding"
+msgstr "Redondeo de cantidad"
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,months:0
+msgid "Number of Months"
+msgstr "Número de meses"
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,weeks:0
+msgid "Number of Weeks"
+msgstr "Número de semanas"
+
+#. module: account_payment_term_extension
+#: model:ir.model,name:account_payment_term_extension.model_account_payment_term
+msgid "Payment Term"
+msgstr "Condiciones de pago"
+
+#. module: account_payment_term_extension
+#: model:ir.model,name:account_payment_term_extension.model_account_payment_term_line
+msgid "Payment Term Line"
+msgstr "Linea de condiciones de pago"
+
+#. module: account_payment_term_extension
+#: help:account.payment.term.line,amount_round:0
+msgid ""
+"Sets the amount so that it is a multiple of this value.\n"
+"To have amounts that end in 0.99, set rounding 1, surcharge -0.01"
+msgstr "Ajusta la cantidad para que sea un múltiplo de este valor. Para obtener cantidades que terminen en x,99, fije el redonde a 1 y el descuento a -0,01"

+ 57 - 0
i18n/fr.po

@@ -0,0 +1,57 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * account_payment_term_extension
+# 
+# Translators:
+# Maxime Chambreuil <maxime.chambreuil@gmail.com>, 2015
+msgid ""
+msgstr ""
+"Project-Id-Version: account-invoicing (8.0)\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-09-09 12:43+0000\n"
+"PO-Revision-Date: 2015-09-12 22:35+0000\n"
+"Last-Translator: Maxime Chambreuil <maxime.chambreuil@gmail.com>\n"
+"Language-Team: French (http://www.transifex.com/oca/OCA-account-invoicing-8-0/language/fr/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Language: fr\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+#. module: account_payment_term_extension
+#: model:account.payment.term,name:account_payment_term_extension.sixty_days_end_of_month
+#: model:account.payment.term,note:account_payment_term_extension.sixty_days_end_of_month
+msgid "60 Days End of Month"
+msgstr "60 jours fin de mois"
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,amount_round:0
+msgid "Amount Rounding"
+msgstr "Arrondi du montant"
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,months:0
+msgid "Number of Months"
+msgstr "Nombre de mois"
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,weeks:0
+msgid "Number of Weeks"
+msgstr "Nombre de semaines"
+
+#. module: account_payment_term_extension
+#: model:ir.model,name:account_payment_term_extension.model_account_payment_term
+msgid "Payment Term"
+msgstr "Condition de règlement"
+
+#. module: account_payment_term_extension
+#: model:ir.model,name:account_payment_term_extension.model_account_payment_term_line
+msgid "Payment Term Line"
+msgstr "Détail des conditions de règlement"
+
+#. module: account_payment_term_extension
+#: help:account.payment.term.line,amount_round:0
+msgid ""
+"Sets the amount so that it is a multiple of this value.\n"
+"To have amounts that end in 0.99, set rounding 1, surcharge -0.01"
+msgstr "Détermine le montant pour que ce soit un multiple de cette valeur.\nPour avoir un montant terminant par 0,99, mettre l'arrondi à 1, et la surcharge à -0.01"

+ 69 - 0
i18n/nl_NL.po

@@ -0,0 +1,69 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * account_payment_term_extension
+# 
+# Translators:
+msgid ""
+msgstr ""
+"Project-Id-Version: account-invoicing (8.0)\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-08-18 08:21+0000\n"
+"PO-Revision-Date: 2017-08-29 07:53+0000\n"
+"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n"
+"Language-Team: Dutch (Netherlands) (http://www.transifex.com/oca/OCA-account-invoicing-8-0/language/nl_NL/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Language: nl_NL\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#. module: account_payment_term_extension
+#: model:account.payment.term,name:account_payment_term_extension.sixty_days_end_of_month
+#: model:account.payment.term,note:account_payment_term_extension.sixty_days_end_of_month
+msgid "60 Days End of Month"
+msgstr ""
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,amount_round:0
+msgid "Amount Rounding"
+msgstr ""
+
+#. module: account_payment_term_extension
+#: help:account.payment.term.line,start_with_end_month:0
+msgid ""
+"If you have a payment term 'End of month 45 days' (which is not the same as "
+"'45 days end of month' !), you should activate this option and then set "
+"'Number of days' = 45 and 'Day of the month' = 0."
+msgstr ""
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,months:0
+msgid "Number of Months"
+msgstr "Aantal maanden"
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,weeks:0
+msgid "Number of Weeks"
+msgstr "Aantal weken"
+
+#. module: account_payment_term_extension
+#: model:ir.model,name:account_payment_term_extension.model_account_payment_term
+msgid "Payment Term"
+msgstr "Betalingsconditie"
+
+#. module: account_payment_term_extension
+#: model:ir.model,name:account_payment_term_extension.model_account_payment_term_line
+msgid "Payment Term Line"
+msgstr ""
+
+#. module: account_payment_term_extension
+#: help:account.payment.term.line,amount_round:0
+msgid ""
+"Sets the amount so that it is a multiple of this value.\n"
+"To have amounts that end in 0.99, set rounding 1, surcharge -0.01"
+msgstr ""
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,start_with_end_month:0
+msgid "Start by End of Month"
+msgstr ""

+ 57 - 0
i18n/pt_BR.po

@@ -0,0 +1,57 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * account_payment_term_extension
+# 
+# Translators:
+# danimaribeiro <danimaribeiro@gmail.com>, 2015
+msgid ""
+msgstr ""
+"Project-Id-Version: account-invoicing (8.0)\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-08-25 16:48+0000\n"
+"PO-Revision-Date: 2015-06-19 02:00+0000\n"
+"Last-Translator: danimaribeiro <danimaribeiro@gmail.com>\n"
+"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-account-invoicing-8-0/language/pt_BR/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Language: pt_BR\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+#. module: account_payment_term_extension
+#: model:account.payment.term,name:account_payment_term_extension.sixty_days_end_of_month
+#: model:account.payment.term,note:account_payment_term_extension.sixty_days_end_of_month
+msgid "60 Days End of Month"
+msgstr "60 dias final do mês"
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,amount_round:0
+msgid "Amount Rounding"
+msgstr "Arredondamento do total"
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,months:0
+msgid "Number of Months"
+msgstr "Número de meses"
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,weeks:0
+msgid "Number of Weeks"
+msgstr "Número de semanas"
+
+#. module: account_payment_term_extension
+#: model:ir.model,name:account_payment_term_extension.model_account_payment_term
+msgid "Payment Term"
+msgstr "Condições de pagamentos"
+
+#. module: account_payment_term_extension
+#: model:ir.model,name:account_payment_term_extension.model_account_payment_term_line
+msgid "Payment Term Line"
+msgstr "Linha da condição de pagamento"
+
+#. module: account_payment_term_extension
+#: help:account.payment.term.line,amount_round:0
+msgid ""
+"Sets the amount so that it is a multiple of this value.\n"
+"To have amounts that end in 0.99, set rounding 1, surcharge -0.01"
+msgstr ""

+ 70 - 0
i18n/sl.po

@@ -0,0 +1,70 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * account_payment_term_extension
+# 
+# Translators:
+# Matjaž Mozetič <m.mozetic@matmoz.si>, 2015-2016
+msgid ""
+msgstr ""
+"Project-Id-Version: account-invoicing (8.0)\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2016-03-24 01:41+0000\n"
+"PO-Revision-Date: 2016-03-24 05:12+0000\n"
+"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
+"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-account-invoicing-8-0/language/sl/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Language: sl\n"
+"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
+
+#. module: account_payment_term_extension
+#: model:account.payment.term,name:account_payment_term_extension.sixty_days_end_of_month
+#: model:account.payment.term,note:account_payment_term_extension.sixty_days_end_of_month
+msgid "60 Days End of Month"
+msgstr "60 dni od konca meseca"
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,amount_round:0
+msgid "Amount Rounding"
+msgstr "Zaokroževanje zneska"
+
+#. module: account_payment_term_extension
+#: help:account.payment.term.line,start_with_end_month:0
+msgid ""
+"If you have a payment term 'End of month 45 days' (which is not the same as "
+"'45 days end of month' !), you should activate this option and then set "
+"'Number of days' = 45 and 'Day of the month' = 0."
+msgstr "Pri plačilnem pogoju 'Konec meseca po 45 dneh' (kar ni isto kot '45 dni od konca meseca' !), morate aktivirati to opcijo in nastaviti 'Število dni' = 45 in 'Dan v mesecu' = 0."
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,months:0
+msgid "Number of Months"
+msgstr "Število mesecev"
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,weeks:0
+msgid "Number of Weeks"
+msgstr "Število tednov"
+
+#. module: account_payment_term_extension
+#: model:ir.model,name:account_payment_term_extension.model_account_payment_term
+msgid "Payment Term"
+msgstr "Plačilni pogoj"
+
+#. module: account_payment_term_extension
+#: model:ir.model,name:account_payment_term_extension.model_account_payment_term_line
+msgid "Payment Term Line"
+msgstr "Postavka plačilnega pogoja"
+
+#. module: account_payment_term_extension
+#: help:account.payment.term.line,amount_round:0
+msgid ""
+"Sets the amount so that it is a multiple of this value.\n"
+"To have amounts that end in 0.99, set rounding 1, surcharge -0.01"
+msgstr "Znesek nastavi kot večkratnik te vrednosti.\nDa bi zneske, ki se končujejo z 0.99 zaokrožili na 1, dodajte -0.01"
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,start_with_end_month:0
+msgid "Start by End of Month"
+msgstr "Začetek ob koncu meseca"

+ 69 - 0
i18n/tr_TR.po

@@ -0,0 +1,69 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * account_payment_term_extension
+# 
+# Translators:
+msgid ""
+msgstr ""
+"Project-Id-Version: account-invoicing (8.0)\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2016-12-31 00:28+0000\n"
+"PO-Revision-Date: 2017-01-05 11:42+0000\n"
+"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n"
+"Language-Team: Turkish (Turkey) (http://www.transifex.com/oca/OCA-account-invoicing-8-0/language/tr_TR/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Language: tr_TR\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+
+#. module: account_payment_term_extension
+#: model:account.payment.term,name:account_payment_term_extension.sixty_days_end_of_month
+#: model:account.payment.term,note:account_payment_term_extension.sixty_days_end_of_month
+msgid "60 Days End of Month"
+msgstr ""
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,amount_round:0
+msgid "Amount Rounding"
+msgstr ""
+
+#. module: account_payment_term_extension
+#: help:account.payment.term.line,start_with_end_month:0
+msgid ""
+"If you have a payment term 'End of month 45 days' (which is not the same as "
+"'45 days end of month' !), you should activate this option and then set "
+"'Number of days' = 45 and 'Day of the month' = 0."
+msgstr ""
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,months:0
+msgid "Number of Months"
+msgstr ""
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,weeks:0
+msgid "Number of Weeks"
+msgstr ""
+
+#. module: account_payment_term_extension
+#: model:ir.model,name:account_payment_term_extension.model_account_payment_term
+msgid "Payment Term"
+msgstr "Ödeme şekli"
+
+#. module: account_payment_term_extension
+#: model:ir.model,name:account_payment_term_extension.model_account_payment_term_line
+msgid "Payment Term Line"
+msgstr ""
+
+#. module: account_payment_term_extension
+#: help:account.payment.term.line,amount_round:0
+msgid ""
+"Sets the amount so that it is a multiple of this value.\n"
+"To have amounts that end in 0.99, set rounding 1, surcharge -0.01"
+msgstr ""
+
+#. module: account_payment_term_extension
+#: field:account.payment.term.line,start_with_end_month:0
+msgid "Start by End of Month"
+msgstr ""

BIN
static/description/payment_term_form.jpg


+ 2 - 0
tests/__init__.py

@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+from . import test_payment_term

+ 59 - 0
tests/test_payment_term.py

@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2015 Akretion (http://www.akretion.com)
+#    @author Alexis de Lattre <alexis.delattre@akretion.com>
+#
+#    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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.tests.common import TransactionCase
+
+
+class TestAccountPaymentTerm(TransactionCase):
+
+    def setUp(self):
+        super(TestAccountPaymentTerm, self).setUp()
+        self.account_payment_term = self.registry('account.payment.term')
+        self.sixty_days_end_of_month =\
+            self.registry('ir.model.data').xmlid_to_res_id(
+                self.cr, self.uid,
+                'account_payment_term_extension.sixty_days_end_of_month')
+
+    def test_00_compute(self):
+        cr, uid = self.cr, self.uid
+        res = self.account_payment_term.compute(
+            cr, uid, self.sixty_days_end_of_month, 10, date_ref='2015-01-30')
+        self.assertEquals(
+            res[0][0],
+            '2015-03-31',
+            'Error in the compute of payment terms with months')
+
+    def test_01_compute(self):
+        cr, uid = self.cr, self.uid
+        two_week_payterm_id = self.account_payment_term.create(
+            cr, uid, {
+                'name': '2 weeks',
+                'line_ids': [(0, 0, {
+                    'value': 'balance',
+                    'days': 0,
+                    'weeks': 2})]
+                })
+        res = self.account_payment_term.compute(
+            cr, uid, two_week_payterm_id, 10, date_ref='2015-03-02')
+        self.assertEquals(
+            res[0][0],
+            '2015-03-16',
+            'Error in the compute of payment terms with weeks')