From dd2050bd6aa5c83e0554cfc49132447b44c2ad52 Mon Sep 17 00:00:00 2001 From: fjg Date: Thu, 11 Feb 2021 11:58:04 +0100 Subject: [PATCH] add louve_addons/account_payment_confirm --- account_payment_confirm/README.rst | 23 +++++++++ account_payment_confirm/__init__.py | 3 ++ account_payment_confirm/__openerp__.py | 21 ++++++++ .../i18n/account_payment_confirm.pot | 44 +++++++++++++++++ account_payment_confirm/i18n/fr.po | 49 +++++++++++++++++++ account_payment_confirm/models/__init__.py | 3 ++ .../models/account_payment.py | 32 ++++++++++++ account_payment_confirm/views/action.xml | 20 ++++++++ 8 files changed, 195 insertions(+) create mode 100644 account_payment_confirm/README.rst create mode 100644 account_payment_confirm/__init__.py create mode 100644 account_payment_confirm/__openerp__.py create mode 100644 account_payment_confirm/i18n/account_payment_confirm.pot create mode 100644 account_payment_confirm/i18n/fr.po create mode 100644 account_payment_confirm/models/__init__.py create mode 100644 account_payment_confirm/models/account_payment.py create mode 100644 account_payment_confirm/views/action.xml diff --git a/account_payment_confirm/README.rst b/account_payment_confirm/README.rst new file mode 100644 index 0000000..a654ab8 --- /dev/null +++ b/account_payment_confirm/README.rst @@ -0,0 +1,23 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +=================== +Account Payment Confirm +=================== + +This module allows to confirm a selection of payments at the same time. +In the Payment list view, you can check several lines, then click the Action +button, and you'll find the Confirm Payments options. +If one of the payments you selected is not confirmable, you'll get a detailed +message that will help you to tell which one failed. + +Issues / Roadmap +================ + +Credits +======= + +Contributors +------------ + +* Julien Weste diff --git a/account_payment_confirm/__init__.py b/account_payment_confirm/__init__.py new file mode 100644 index 0000000..cde864b --- /dev/null +++ b/account_payment_confirm/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models diff --git a/account_payment_confirm/__openerp__.py b/account_payment_confirm/__openerp__.py new file mode 100644 index 0000000..3c0dc48 --- /dev/null +++ b/account_payment_confirm/__openerp__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2016-Today: La Louve () +# @author: Julien Weste +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + + +{ + 'name': 'Account Payment Confirm', + 'version': '9.0.1.0.0', + 'category': 'Accounting', + 'summary': 'Improve payment confirmation', + 'author': 'La Louve', + 'website': 'http://www.lalouve.net', + 'depends': [ + 'account', + ], + 'data': [ + "views/action.xml", + ], + 'installable': True, +} diff --git a/account_payment_confirm/i18n/account_payment_confirm.pot b/account_payment_confirm/i18n/account_payment_confirm.pot new file mode 100644 index 0000000..c297001 --- /dev/null +++ b/account_payment_confirm/i18n/account_payment_confirm.pot @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_confirm +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \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_confirm +#: model:ir.actions.server,name:account_payment_confirm.account_payment_action_multiple_confirm +msgid "Confirm Payments" +msgstr "" + +#. module: account_payment_confirm +#: model:ir.model,name:account_payment_confirm.model_account_payment +msgid "Payments" +msgstr "" + +#. module: account_payment_confirm +#: code:addons/account_payment_confirm/models/account_payment.py:28 +#, python-format +msgid "The payment cannot be processed because some invoices are not open!\n" +"%s" +msgstr "" + +#. module: account_payment_confirm +#: code:addons/account_payment_confirm/models/account_payment.py:25 +#, python-format +msgid "invoice" +msgstr "" + +#. module: account_payment_confirm +#: code:addons/account_payment_confirm/models/account_payment.py:26 +#, python-format +msgid "payment" +msgstr "" + diff --git a/account_payment_confirm/i18n/fr.po b/account_payment_confirm/i18n/fr.po new file mode 100644 index 0000000..20fa060 --- /dev/null +++ b/account_payment_confirm/i18n/fr.po @@ -0,0 +1,49 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_confirm +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-01-10 16:49+0000\n" +"PO-Revision-Date: 2017-01-10 16:49+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: account_payment_confirm +#: model:ir.actions.server,name:account_payment_confirm.account_payment_action_multiple_confirm +msgid "Confirm Payments" +msgstr "Confirmer paiements" + +#. module: account_payment_confirm +#: model:ir.model,name:account_payment_confirm.model_account_payment +msgid "Payments" +msgstr "Paiements" + +#. module: account_payment_confirm +#: code:addons/account_payment_confirm/models/account_payment.py:28 +#, python-format +msgid "" +"The payment cannot be processed because some invoices are not open!\n" +"%s" +msgstr "" +"Le paiement ne peut pas ĂȘtre traitĂ© car des factures ne sont pas ouvertes!\n" +"%s" + +#. module: account_payment_confirm +#: code:addons/account_payment_confirm/models/account_payment.py:25 +#, python-format +msgid "invoice" +msgstr "facture" + +#. module: account_payment_confirm +#: code:addons/account_payment_confirm/models/account_payment.py:26 +#, python-format +msgid "payment" +msgstr "paiement" diff --git a/account_payment_confirm/models/__init__.py b/account_payment_confirm/models/__init__.py new file mode 100644 index 0000000..d564ba5 --- /dev/null +++ b/account_payment_confirm/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import account_payment diff --git a/account_payment_confirm/models/account_payment.py b/account_payment_confirm/models/account_payment.py new file mode 100644 index 0000000..a4ff0b9 --- /dev/null +++ b/account_payment_confirm/models/account_payment.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +from openerp import api, models, _ +from openerp.exceptions import ValidationError + + +class AccountPayment(models.Model): + _inherit = "account.payment" + + @api.multi + def check_post(self): + new_context = dict( + self.env.context, **{'account_payment_confirm': True}) + self.with_context(new_context).post() + + @api.multi + def post(self): + if self.env.context.get('account_payment_confirm', False): + for rec in self: + error_invoices = rec.invoice_ids.filtered( + lambda i: i.state != 'open') + if len(error_invoices): + msg = "\n".join([ + "%s: %s - %s - %s: %s - %s" % ( + _("invoice"), inv.partner_id.name, inv.number, + _("payment"), rec.name, rec.payment_date + ) for inv in error_invoices]) + raise ValidationError(_( + """The payment cannot be processed because some """ + """invoices are not open!\n""" + """%s""") % msg) + return super(AccountPayment, self).post() diff --git a/account_payment_confirm/views/action.xml b/account_payment_confirm/views/action.xml new file mode 100644 index 0000000..c1eae26 --- /dev/null +++ b/account_payment_confirm/views/action.xml @@ -0,0 +1,20 @@ + + + + + + + Confirm Payments + + code + action = self.check_post(cr, uid, context.get('active_ids', []), context=context) + + + + Confirm Payments + client_action_multi + + action + account.payment + + \ No newline at end of file