diff --git a/account_banking_payment/__openerp__.py b/account_banking_payment/__openerp__.py index 4453971bd..a0984398f 100644 --- a/account_banking_payment/__openerp__.py +++ b/account_banking_payment/__openerp__.py @@ -38,6 +38,7 @@ 'view/account_payment.xml', 'view/banking_transaction_wizard.xml', 'view/payment_mode.xml', + 'view/payment_mode_type.xml', 'workflow/account_payment.xml', ], 'description': ''' diff --git a/account_banking_payment/model/__init__.py b/account_banking_payment/model/__init__.py index c0ecd6f95..e7ae81724 100644 --- a/account_banking_payment/model/__init__.py +++ b/account_banking_payment/model/__init__.py @@ -1,6 +1,8 @@ import account_payment import payment_line import payment_mode +import payment_mode_type +import payment_order_create import banking_import_transaction import banking_transaction_wizard import banking_import_line diff --git a/account_banking_payment/model/payment_mode.py b/account_banking_payment/model/payment_mode.py index 1b87b0a5a..6237593b6 100644 --- a/account_banking_payment/model/payment_mode.py +++ b/account_banking_payment/model/payment_mode.py @@ -44,4 +44,10 @@ class payment_mode(orm.Model): help=('Journal to write payment entries when confirming ' 'a debit order of this mode'), ), + 'payment_term_ids': fields.many2many( + 'account.payment.term', 'account_payment_order_terms_rel', + 'mode_id', 'term_id', 'Payment terms', + help=('Limit selected invoices to invoices with these payment ' + 'terms') + ), } diff --git a/account_banking_payment/model/payment_mode_type.py b/account_banking_payment/model/payment_mode_type.py new file mode 100644 index 000000000..572cce869 --- /dev/null +++ b/account_banking_payment/model/payment_mode_type.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2009 EduSense BV (). +# (C) 2011 - 2013 Therp BV (). +# +# 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 . +# +############################################################################## + +from openerp.osv import orm, fields + + +class payment_mode_type(orm.Model): + _inherit = 'payment.mode.type' + + _columns = { + 'payment_order_type': fields.selection( + [('payment', 'Payment'),('debit', 'Direct debit')], + 'Payment order type', required=True, + ), + } + + _defaults = { + 'payment_order_type': 'payment', + } diff --git a/account_banking_payment_export/model/payment_order_create.py b/account_banking_payment/model/payment_order_create.py similarity index 100% rename from account_banking_payment_export/model/payment_order_create.py rename to account_banking_payment/model/payment_order_create.py diff --git a/account_banking_payment/view/payment_mode.xml b/account_banking_payment/view/payment_mode.xml index 08d0cf5b1..c46823c8d 100644 --- a/account_banking_payment/view/payment_mode.xml +++ b/account_banking_payment/view/payment_mode.xml @@ -28,6 +28,11 @@ domain="[('company_id', '=', company_id)]" /> + + + + diff --git a/account_banking_payment/view/payment_mode_type.xml b/account_banking_payment/view/payment_mode_type.xml new file mode 100644 index 000000000..797dc44b5 --- /dev/null +++ b/account_banking_payment/view/payment_mode_type.xml @@ -0,0 +1,19 @@ + + + + + + view.payment.mode.type.form + payment.mode.type + + +
+ + + + +
+
+ +
+
diff --git a/account_banking_payment_export/__openerp__.py b/account_banking_payment_export/__openerp__.py index 56f8d1c1a..9d6495976 100644 --- a/account_banking_payment_export/__openerp__.py +++ b/account_banking_payment_export/__openerp__.py @@ -42,11 +42,14 @@ 'security/ir.model.access.csv', ], 'description': ''' - This addon adds payment export infrastructure to the Banking Addons. - * the "make payment" launches a wizard depending on the payment mode - * create a manual payment mode type - * various improvements to the payment order invoice import wizard - * suitable bank account type filtering + This module adds payment export infrastructure to the payment orders. + + It provides the following features: + * payment.mode.type model + * payment.mode has a mandatory type + * a better implementation of payment_mode.suitable_bank_types() based on payment.mode.type + * the "make payment" button launches a wizard depending on the payment.mode.type + * a manual payment mode type is provided, with a default "do nothing" wizard ''', 'auto_install': True, 'installable': True, diff --git a/account_banking_payment_export/model/__init__.py b/account_banking_payment_export/model/__init__.py index 4887825eb..bfb8f9fcf 100644 --- a/account_banking_payment_export/model/__init__.py +++ b/account_banking_payment_export/model/__init__.py @@ -2,4 +2,3 @@ import account_payment import bank_payment_manual import payment_mode import payment_mode_type -import payment_order_create diff --git a/account_banking_payment_export/model/bank_payment_manual.py b/account_banking_payment_export/model/bank_payment_manual.py index fb15267dd..8cfa35d53 100644 --- a/account_banking_payment_export/model/bank_payment_manual.py +++ b/account_banking_payment_export/model/bank_payment_manual.py @@ -24,7 +24,7 @@ ############################################################################## ''' -This module contains a single "wizard" for including a 'sent' state for manual +This module contains a single "wizard" for confirming manual bank transfers. ''' @@ -34,20 +34,26 @@ from openerp import netsvc class payment_manual(orm.TransientModel): _name = 'payment.manual' - _description = 'Set payment orders to \'sent\' manually' - - def default_get(self, cr, uid, fields_list, context=None): - if context and context.get('active_ids'): - payment_order_obj = self.pool.get('payment.order') - wf_service = netsvc.LocalService('workflow') - for order_id in context['active_ids']: - wf_service.trg_validate( - uid, 'payment.order', order_id, 'done', cr) - return super(payment_manual, self).default_get( - cr, uid, fields_list, context=None) + _description = 'Send payment order(s) manually' _columns = { - # dummy field, to trigger a call to default_get - 'name': fields.char('Name', size=1), + 'payment_order_ids': fields.many2many('payment.order', + 'wiz_manual_payorders_rel', 'wizard_id', 'payment_order_id', + 'Payment orders', readonly=True), } + def create(self, cr, uid, vals, context=None): + payment_order_ids = context.get('active_ids', []) + vals.update({ + 'payment_order_ids': [[6, 0, payment_order_ids]], + }) + return super(payment_manual, self).create(cr, uid, + vals, context=context) + + def button_ok(self, cr, uid, ids, context=None): + wf_service = netsvc.LocalService('workflow') + for wiz in self.browse(cr, uid, ids, context=context): + for order_id in wiz.payment_order_ids: + wf_service.trg_validate( + uid, 'payment.order', order_id.id, 'done', cr) + return {'type': 'ir.actions.act_window_close'} diff --git a/account_banking_payment_export/model/payment_mode.py b/account_banking_payment_export/model/payment_mode.py index 39e469690..1b5d93123 100644 --- a/account_banking_payment_export/model/payment_mode.py +++ b/account_banking_payment_export/model/payment_mode.py @@ -49,10 +49,4 @@ class payment_mode(orm.Model): required=True, help='Select the Payment Type for the Payment Mode.' ), - 'payment_term_ids': fields.many2many( - 'account.payment.term', 'account_payment_order_terms_rel', - 'mode_id', 'term_id', 'Payment terms', - help=('Limit selected invoices to invoices with these payment ' - 'terms') - ), } diff --git a/account_banking_payment_export/model/payment_mode_type.py b/account_banking_payment_export/model/payment_mode_type.py index 51de7ca66..99eab533f 100644 --- a/account_banking_payment_export/model/payment_mode_type.py +++ b/account_banking_payment_export/model/payment_mode_type.py @@ -51,12 +51,4 @@ class payment_mode_type(orm.Model): 'Leave empty for manual processing'), domain=[('osv_memory', '=', True)], ), - 'payment_order_type': fields.selection( - [('payment', 'Payment'),('debit', 'Direct debit')], - 'Payment order type', required=True, - ), } - - _defaults = { - 'payment_order_type': 'payment', - } diff --git a/account_banking_payment_export/view/bank_payment_manual.xml b/account_banking_payment_export/view/bank_payment_manual.xml index 538862ca3..e350c9b6f 100644 --- a/account_banking_payment_export/view/bank_payment_manual.xml +++ b/account_banking_payment_export/view/bank_payment_manual.xml @@ -5,9 +5,12 @@ Form for manual payment wizard payment.manual -
-