From 1ea580872d7e5af9872ded1a00d378fc75354e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Mon, 15 Sep 2014 15:46:56 +0200 Subject: [PATCH] [ADD] account_banking_payment_blocking In the payment order creation wizard, do not propose invoices that are under litigation. This is based on the blocked (aka No Followup) flag on the account move lines. --- account_banking_payment_blocking/__init__.py | 23 ++++++++ .../__openerp__.py | 52 +++++++++++++++++++ .../model/__init__.py | 23 ++++++++ .../model/payment_order_create.py | 34 ++++++++++++ 4 files changed, 132 insertions(+) create mode 100644 account_banking_payment_blocking/__init__.py create mode 100644 account_banking_payment_blocking/__openerp__.py create mode 100644 account_banking_payment_blocking/model/__init__.py create mode 100644 account_banking_payment_blocking/model/payment_order_create.py diff --git a/account_banking_payment_blocking/__init__.py b/account_banking_payment_blocking/__init__.py new file mode 100644 index 000000000..248eb311a --- /dev/null +++ b/account_banking_payment_blocking/__init__.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Payment Blocking module for OpenERP +# Copyright (C) 2014 ACSONE SA/NV (http://acsone.eu) +# @author Stéphane Bidoul +# +# 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 . +# +############################################################################## + +import model diff --git a/account_banking_payment_blocking/__openerp__.py b/account_banking_payment_blocking/__openerp__.py new file mode 100644 index 000000000..024d79cf0 --- /dev/null +++ b/account_banking_payment_blocking/__openerp__.py @@ -0,0 +1,52 @@ +############################################################################## +# +# Copyright (C) ACSONE SA/NV () +# +# All other contributions are (C) by their respective contributors +# +# All Rights Reserved +# +# 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': 'account banking payment blocking', + 'version': '0.1', + 'category': 'Banking addons', + 'description': """ + Prevent invoices under litigation to be proposed in payment orders + """, + 'author': 'Stéphane Bidoul', + 'website': 'http://acsone.eu', + 'depends': [ + 'base', + 'account_banking_payment_export' + ], + 'data': [ + ], + 'test': [ + ], + 'demo': [ + ], + 'js': [ + ], + 'qweb': [ + ], + 'css': [ + ], + 'installable': True, + 'application': False, + 'auto_install': False, + 'license': 'AGPL-3', +} diff --git a/account_banking_payment_blocking/model/__init__.py b/account_banking_payment_blocking/model/__init__.py new file mode 100644 index 000000000..ae51395a6 --- /dev/null +++ b/account_banking_payment_blocking/model/__init__.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Payment Blocking module for OpenERP +# Copyright (C) 2014 ACSONE SA/NV (http://acsone.eu) +# @author Stéphane Bidoul +# +# 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 . +# +############################################################################## + +import payment_order_create diff --git a/account_banking_payment_blocking/model/payment_order_create.py b/account_banking_payment_blocking/model/payment_order_create.py new file mode 100644 index 000000000..ef167886a --- /dev/null +++ b/account_banking_payment_blocking/model/payment_order_create.py @@ -0,0 +1,34 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Payment Blocking module for OpenERP +# Copyright (C) 2014 ACSONE SA/NV (http://acsone.eu) +# @author Stéphane Bidoul +# +# 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 payment_order_create(orm.TransientModel): + _inherit = 'payment.order.create' + + def extend_payment_order_domain( + self, cr, uid, payment_order, domain, context=None): + super(payment_order_create, self).extend_payment_order_domain( + cr, uid, payment_order, domain, context=context) + domain += [('blocked', '!=', True)] + return True