mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[IMP] clarify scope of account_banking_payment_export by moving some features back to account_banking_payment
[IMP] nicer manual payment wizard
This commit is contained in:
@@ -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': '''
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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')
|
||||
),
|
||||
}
|
||||
|
||||
41
account_banking_payment/model/payment_mode_type.py
Normal file
41
account_banking_payment/model/payment_mode_type.py
Normal file
@@ -0,0 +1,41 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
|
||||
# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
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',
|
||||
}
|
||||
@@ -28,6 +28,11 @@
|
||||
domain="[('company_id', '=', company_id)]"
|
||||
/>
|
||||
</group>
|
||||
<group colspan="2">
|
||||
<separator colspan="2"
|
||||
string="Optional filter by payment term" />
|
||||
<field name="payment_term_ids" nolabel="1" colspan="2"/>
|
||||
</group>
|
||||
</group>
|
||||
</field>
|
||||
</field>
|
||||
|
||||
19
account_banking_payment/view/payment_mode_type.xml
Normal file
19
account_banking_payment/view/payment_mode_type.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record model="ir.ui.view" id="view_payment_mode_type_form_inherit">
|
||||
<field name="name">view.payment.mode.type.form</field>
|
||||
<field name="model">payment.mode.type</field>
|
||||
<field name="inherit_id" ref="account_banking_payment_export.view_payment_mode_type_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Payment mode">
|
||||
<field name="suitable_bank_types" position="after">
|
||||
<field name="payment_order_type"/>
|
||||
</field>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -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,
|
||||
|
||||
@@ -2,4 +2,3 @@ import account_payment
|
||||
import bank_payment_manual
|
||||
import payment_mode
|
||||
import payment_mode_type
|
||||
import payment_order_create
|
||||
|
||||
@@ -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'}
|
||||
|
||||
@@ -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')
|
||||
),
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
}
|
||||
|
||||
@@ -5,9 +5,12 @@
|
||||
<field name="name">Form for manual payment wizard</field>
|
||||
<field name="model">payment.manual</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Manual payment">
|
||||
<label string="Payment order(s) have been set to 'sent'"/>
|
||||
<button special="cancel" icon="gtk-ok" string="OK"/>
|
||||
<form string="Manual payment" version="7.0">
|
||||
<label string="Please execute payment order manually, and click OK when succesfully sent."/>
|
||||
<footer>
|
||||
<button name="button_ok" type="object" string="OK" class="oe_highlight"/>
|
||||
<button special="cancel" string="Cancel" class="oe_link"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -12,13 +12,6 @@
|
||||
<field name="arch" type="xml">
|
||||
<field name="company_id" position="after">
|
||||
<field name="type"/>
|
||||
<group colspan="4" col="4">
|
||||
<group colspan="2">
|
||||
<separator colspan="2"
|
||||
string="Optional filter by payment term" />
|
||||
<field name="payment_term_ids" nolabel="1" colspan="2"/>
|
||||
</group>
|
||||
</group>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
<field name="name" />
|
||||
<field name="code" />
|
||||
<field name="suitable_bank_types"/>
|
||||
<field name="payment_order_type"/>
|
||||
<field name="ir_model_id"/>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user