Skip to content

Commit

Permalink
add louve_addons/account_payment_confirm
Browse files Browse the repository at this point in the history
  • Loading branch information
fjg committed Feb 11, 2021
1 parent c4c01d3 commit dd2050b
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 0 deletions.
23 changes: 23 additions & 0 deletions account_payment_confirm/README.rst
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions account_payment_confirm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-

from . import models
21 changes: 21 additions & 0 deletions account_payment_confirm/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
# @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,
}
44 changes: 44 additions & 0 deletions account_payment_confirm/i18n/account_payment_confirm.pot
Original file line number Diff line number Diff line change
@@ -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 ""

49 changes: 49 additions & 0 deletions account_payment_confirm/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 3 additions & 0 deletions account_payment_confirm/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-

from . import account_payment
32 changes: 32 additions & 0 deletions account_payment_confirm/models/account_payment.py
Original file line number Diff line number Diff line change
@@ -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()
20 changes: 20 additions & 0 deletions account_payment_confirm/views/action.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- ********************************************************************** -->
<!-- See __openerp__.py file for Copyright and Licence Informations. -->
<!-- ********************************************************************** -->
<odoo>
<record id="account_payment_action_multiple_confirm" model="ir.actions.server">
<field name="name">Confirm Payments</field>
<field name="model_id" ref="account_payment_confirm.model_account_payment"/>
<field name="state">code</field>
<field name="code">action = self.check_post(cr, uid, context.get('active_ids', []), context=context)</field>
</record>

<record id="account_payment_value_multiple_confirm" model="ir.values">
<field name="name">Confirm Payments</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.server,%d'%account_payment_action_multiple_confirm"/>
<field name="key">action</field>
<field name="model">account.payment</field>
</record>
</odoo>

0 comments on commit dd2050b

Please sign in to comment.