mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[MRG] Merge with target branch
This commit is contained in:
@@ -193,6 +193,10 @@ class banking_import_transaction(orm.Model):
|
||||
iname = invoice.name.upper()
|
||||
if iname in ref or iname in msg:
|
||||
return True
|
||||
if invoice.supplier_invoice_number and len(invoice.supplier_invoice_number) > 2:
|
||||
supp_ref = invoice.supplier_invoice_number.upper()
|
||||
if supp_ref in ref or supp_ref in msg:
|
||||
return True
|
||||
elif invoice.type.startswith('out_'):
|
||||
# External id's possible and likely
|
||||
inum = invoice.number.upper()
|
||||
@@ -1211,8 +1215,6 @@ class banking_import_transaction(orm.Model):
|
||||
'match_type',
|
||||
'move_line_id',
|
||||
'invoice_id',
|
||||
'manual_invoice_id',
|
||||
'manual_move_line_id',
|
||||
]] +
|
||||
[(x, [(6, 0, [])]) for x in [
|
||||
'move_line_ids',
|
||||
@@ -1299,9 +1301,9 @@ class banking_import_transaction(orm.Model):
|
||||
'exchange_rate': fields.float('exchange_rate'),
|
||||
'transferred_amount': fields.float('transferred_amount'),
|
||||
'message': fields.char('message', size=1024),
|
||||
'remote_owner': fields.char('remote_owner', size=24),
|
||||
'remote_owner_address': fields.char('remote_owner_address', size=24),
|
||||
'remote_owner_city': fields.char('remote_owner_city', size=24),
|
||||
'remote_owner': fields.char('remote_owner', size=128),
|
||||
'remote_owner_address': fields.char('remote_owner_address', size=256),
|
||||
'remote_owner_city': fields.char('remote_owner_city', size=128),
|
||||
'remote_owner_postalcode': fields.char('remote_owner_postalcode', size=24),
|
||||
'remote_owner_country_code': fields.char('remote_owner_country_code', size=24),
|
||||
'remote_owner_custno': fields.char('remote_owner_custno', size=24),
|
||||
|
||||
@@ -13,12 +13,5 @@
|
||||
<field eval="False" name="required"/>
|
||||
<field eval="False" name="readonly"/>
|
||||
</record>
|
||||
<!--
|
||||
BIC is not legally required
|
||||
See https://bugs.launchpad.net/bugs/933472
|
||||
-->
|
||||
<record id="base_iban.bank_swift_field" model="res.partner.bank.type.field">
|
||||
<field eval="False" name="required"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
33
account_banking/migrations/7.0.0.1/pre-migration.py
Normal file
33
account_banking/migrations/7.0.0.1/pre-migration.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (C) 2013 Therp BV (<http://therp.nl>).
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
def migrate(cr, version):
|
||||
if not version:
|
||||
return
|
||||
|
||||
# workflow state moved to another, new module
|
||||
cr.execute(
|
||||
"""
|
||||
UPDATE ir_model_data
|
||||
SET module = 'account_banking_payment'
|
||||
WHERE name = 'trans_done_sent'
|
||||
AND module = 'account_direct_debit'
|
||||
""")
|
||||
@@ -3,4 +3,3 @@
|
||||
"access_account_banking_settings_user","account.banking.account.settings user","model_account_banking_account_settings","account.group_account_user",1,0,0,0
|
||||
"access_account_banking_import","account.bankimport","model_account_banking_imported_file","account.group_account_user",1,1,1,1
|
||||
"access_banking_import_transaction","Banking addons - Bank import transaction","model_banking_import_transaction","account.group_account_user",1,1,1,1
|
||||
"access_banking_transaction_wizard","Banking addons - Transaction wizard","model_banking_transaction_wizard","account.group_account_user",1,1,1,1
|
||||
|
||||
|
@@ -190,7 +190,7 @@ class IBAN(str):
|
||||
BBAN_formats = {
|
||||
'AL': BBANFormat('CCBBBBVAAAAAAAAAAAAAAAAAA', '%B%A'),
|
||||
'AD': BBANFormat('CCCCBBBBAAAAAAAAAAAA', '%A'),
|
||||
'AT': BBANFormat('BBBBBAAAAAAAAAAA', '%A BLZ %C'),
|
||||
'AT': BBANFormat('BBBBBAAAAAAAAAAA', '%A BLZ %B'),
|
||||
'BE': BBANFormat('CCCAAAAAAAVV', '%C-%A-%V'),
|
||||
'BA': BBANFormat('BBBCCCAAAAAAAA', '%I'),
|
||||
'BG': BBANFormat('BBBBCCCCAAAAAAAAAA', '%I'),
|
||||
|
||||
@@ -314,6 +314,10 @@ class banking_transaction_wizard(orm.TransientModel):
|
||||
'ref': fields.related(
|
||||
'statement_line_id', 'ref', type='char', size=32,
|
||||
string="Reference", readonly=True),
|
||||
'message': fields.related(
|
||||
'statement_line_id', 'import_transaction_id', 'message',
|
||||
type='char', size=1024,
|
||||
string="Message", readonly=True),
|
||||
'partner_id': fields.related(
|
||||
'statement_line_id', 'partner_id',
|
||||
type='many2one', relation='res.partner',
|
||||
@@ -363,13 +367,6 @@ class banking_transaction_wizard(orm.TransientModel):
|
||||
('payment_order_manual', 'Payment order (manual)'),
|
||||
],
|
||||
string='Match type', readonly=True),
|
||||
'manual_invoice_id': fields.many2one(
|
||||
'account.invoice', 'Match this invoice',
|
||||
domain=[('reconciled', '=', False)]),
|
||||
'manual_move_line_id': fields.many2one(
|
||||
'account.move.line', 'Or match this entry',
|
||||
domain=[('account_id.reconcile', '=', True),
|
||||
('reconcile_id', '=', False)]),
|
||||
'manual_invoice_ids': fields.many2many(
|
||||
'account.invoice',
|
||||
'banking_transaction_wizard_account_invoice_rel',
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
<separator string="Transaction data" colspan="4"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="date"/>
|
||||
<field name="ref"/>
|
||||
<field name="amount"/>
|
||||
<field name="ref"/>
|
||||
<field name="message" colspan="4"/>
|
||||
</group>
|
||||
|
||||
<!-- (semi-) automatic matching and selection -->
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
from openerp.osv import orm, fields
|
||||
from openerp.tools.translate import _
|
||||
from openerp.addons.account_banking.wizard import banktools
|
||||
import ast
|
||||
|
||||
class link_partner(orm.TransientModel):
|
||||
_name = 'banking.link_partner'
|
||||
@@ -37,6 +38,16 @@ class link_partner(orm.TransientModel):
|
||||
'statement_line_id': fields.many2one(
|
||||
'account.bank.statement.line',
|
||||
'Statement line', required=True),
|
||||
'amount': fields.related(
|
||||
'statement_line_id', 'amount', type='float',
|
||||
string="Amount", readonly=True),
|
||||
'ref': fields.related(
|
||||
'statement_line_id', 'ref', type='char', size=32,
|
||||
string="Reference", readonly=True),
|
||||
'message': fields.related(
|
||||
'statement_line_id', 'import_transaction_id', 'message',
|
||||
type='char', size=1024,
|
||||
string="Message", readonly=True),
|
||||
'remote_account': fields.char(
|
||||
'Account number', size=24, readonly=True),
|
||||
# Partner values
|
||||
@@ -50,6 +61,11 @@ class link_partner(orm.TransientModel):
|
||||
'phone': fields.char('Phone', size=64),
|
||||
'fax': fields.char('Fax', size=64),
|
||||
'mobile': fields.char('Mobile', size=64),
|
||||
'is_company': fields.boolean('Is a Company'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'is_company': True,
|
||||
}
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
@@ -79,9 +95,19 @@ class link_partner(orm.TransientModel):
|
||||
if 'customer' not in vals and statement_line.amount > 0:
|
||||
vals['customer'] = True
|
||||
|
||||
if not vals.get('street'):
|
||||
vals['street'] = transaction.remote_owner_address
|
||||
if not vals.get('street'):
|
||||
address_list = []
|
||||
try:
|
||||
address_list = ast.literal_eval(
|
||||
transaction.remote_owner_address or [])
|
||||
except ValueError:
|
||||
pass
|
||||
if address_list and not vals.get('street'):
|
||||
vals['street'] = address_list.pop(0)
|
||||
if address_list and not vals.get('street2'):
|
||||
vals['street2'] = address_list.pop(0)
|
||||
if transaction.remote_owner_postalcode and not vals.get('zip'):
|
||||
vals['zip'] = transaction.remote_owner_postalcode
|
||||
if transaction.remote_owner_city and not vals.get('city'):
|
||||
vals['city'] = transaction.remote_owner_city
|
||||
if not vals.get('country_id'):
|
||||
vals['country_id'] = banktools.get_country_id(
|
||||
@@ -101,10 +127,12 @@ class link_partner(orm.TransientModel):
|
||||
:param wizard: read record of wizard (with load='_classic_write')
|
||||
:param values: the dictionary of partner values that will be updated
|
||||
"""
|
||||
for field in ['name',
|
||||
for field in ['is_company',
|
||||
'name',
|
||||
'street',
|
||||
'street2',
|
||||
'zip',
|
||||
'city',
|
||||
'country_id',
|
||||
'state_id',
|
||||
'phone',
|
||||
@@ -126,10 +154,7 @@ class link_partner(orm.TransientModel):
|
||||
else:
|
||||
wiz_read = self.read(
|
||||
cr, uid, ids[0], context=context, load='_classic_write')
|
||||
partner_fields = self.pool.get(
|
||||
'res.partner')._columns.keys()
|
||||
partner_vals = {
|
||||
'is_company': True,
|
||||
'type': 'default',
|
||||
}
|
||||
self.update_partner_values(
|
||||
|
||||
@@ -7,15 +7,24 @@
|
||||
<field name="model">banking.link_partner</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Link partner">
|
||||
<group colspan="4" col="6">
|
||||
<group colspan="4" col="6" string="Transaction data">
|
||||
<field name="ref" />
|
||||
<field name="amount" />
|
||||
<field name="remote_account" />
|
||||
<field name="message" colspan="6"/>
|
||||
</group>
|
||||
<group colspan="4" col="4" string="Create or link partner">
|
||||
<field name="name"
|
||||
attrs="{'readonly': [('partner_id', '!=', False)]}" />
|
||||
<field name="partner_id"/>
|
||||
<field name="remote_account" />
|
||||
</group>
|
||||
<group colspan="2">
|
||||
<field name="is_company" />
|
||||
</group>
|
||||
<group colspan="4"
|
||||
string="Address"
|
||||
attrs="{'invisible': [('partner_id', '!=', False)]}">
|
||||
attrs="{'invisible': [('partner_id', '!=', False)]}"
|
||||
col="4">
|
||||
<group colspan="2" col="2">
|
||||
<field name="street"/>
|
||||
<field name="street2"/>
|
||||
|
||||
@@ -249,6 +249,10 @@ class transaction(models.mem_bank_transaction):
|
||||
for i in range(0, len(self.message), 32)
|
||||
]
|
||||
self.reference = self.remote_owner
|
||||
|
||||
if not parts:
|
||||
return
|
||||
|
||||
if self.reference.startswith('KN: '):
|
||||
self.reference = self.reference[4:]
|
||||
if parts[0] == self.reference:
|
||||
|
||||
@@ -32,17 +32,14 @@
|
||||
'category': 'Banking addons',
|
||||
'depends': [
|
||||
'account_banking',
|
||||
'account_payment',
|
||||
'account_banking_payment_export',
|
||||
],
|
||||
'data': [
|
||||
'view/account_payment.xml',
|
||||
'view/banking_transaction_wizard.xml',
|
||||
'view/payment_mode.xml',
|
||||
'view/payment_mode_type.xml',
|
||||
'view/bank_payment_manual.xml',
|
||||
'data/payment_mode_type.xml',
|
||||
'workflow/account_payment.xml',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'description': '''
|
||||
This addon adds payment infrastructure to the Banking Addons.
|
||||
|
||||
@@ -5,5 +5,4 @@ import payment_mode_type
|
||||
import payment_order_create
|
||||
import banking_import_transaction
|
||||
import banking_transaction_wizard
|
||||
import bank_payment_manual
|
||||
import banking_import_line
|
||||
|
||||
@@ -115,49 +115,6 @@ class payment_order(orm.Model):
|
||||
'payment_order_type': 'payment',
|
||||
}
|
||||
|
||||
def launch_wizard(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Search for a wizard to launch according to the type.
|
||||
If type is manual. just confirm the order.
|
||||
Previously (pre-v6) in account_payment/wizard/wizard_pay.py
|
||||
"""
|
||||
if context == None:
|
||||
context = {}
|
||||
result = {}
|
||||
orders = self.browse(cr, uid, ids, context)
|
||||
order = orders[0]
|
||||
# check if a wizard is defined for the first order
|
||||
if order.mode.type and order.mode.type.ir_model_id:
|
||||
context['active_ids'] = ids
|
||||
wizard_model = order.mode.type.ir_model_id.model
|
||||
wizard_obj = self.pool.get(wizard_model)
|
||||
wizard_id = wizard_obj.create(cr, uid, {}, context)
|
||||
result = {
|
||||
'name': wizard_obj._description or _('Payment Order Export'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': wizard_model,
|
||||
'domain': [],
|
||||
'context': context,
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'res_id': wizard_id,
|
||||
'nodestroy': True,
|
||||
}
|
||||
else:
|
||||
# should all be manual orders without type or wizard model
|
||||
for order in orders[1:]:
|
||||
if order.mode.type and order.mode.type.ir_model_id:
|
||||
raise orm.except_orm(
|
||||
_('Error'),
|
||||
_('You can only combine payment orders of the same type')
|
||||
)
|
||||
# process manual payments
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
for order_id in ids:
|
||||
wf_service.trg_validate(uid, 'payment.order', order_id, 'sent', cr)
|
||||
return result
|
||||
|
||||
def _write_payment_lines(self, cr, uid, ids, **kwargs):
|
||||
'''
|
||||
ORM method for setting attributes of corresponding payment.line objects.
|
||||
@@ -301,7 +258,7 @@ class payment_order(orm.Model):
|
||||
'journal_id': order.mode.transfer_journal_id.id,
|
||||
'name': '%s %s' % (labels[order.payment_order_type],
|
||||
line.move_line_id.move_id.name),
|
||||
'reference': '%s%s' % (order.payment_order_type[:3].upper(),
|
||||
'ref': '%s%s' % (order.payment_order_type[:3].upper(),
|
||||
line.move_line_id.move_id.name),
|
||||
}, context=context)
|
||||
|
||||
|
||||
@@ -151,8 +151,8 @@ class payment_line(orm.Model):
|
||||
if torec_move_line.reconcile_partial_id:
|
||||
line_ids = [
|
||||
x.id for x in
|
||||
transit_move_line.reconcile_partial_id.line_partial_ids
|
||||
] + [torec_move_line.id]
|
||||
torec_move_line.reconcile_partial_id.line_partial_ids
|
||||
] + [transit_move_line.id]
|
||||
|
||||
total = move_line_obj.get_balance(cr, uid, line_ids)
|
||||
vals = {
|
||||
|
||||
@@ -27,28 +27,9 @@ from openerp.osv import orm, fields
|
||||
|
||||
|
||||
class payment_mode(orm.Model):
|
||||
''' Restoring the payment type from version 5,
|
||||
used to select the export wizard (if any) '''
|
||||
_inherit = "payment.mode"
|
||||
|
||||
def suitable_bank_types(self, cr, uid, payment_mode_id=None, context=None):
|
||||
""" Reinstates functional code for suitable bank type filtering.
|
||||
Current code in account_payment is disfunctional.
|
||||
"""
|
||||
res = []
|
||||
payment_mode = self.browse(
|
||||
cr, uid, payment_mode_id, context)
|
||||
if (payment_mode and payment_mode.type and
|
||||
payment_mode.type.suitable_bank_types):
|
||||
res = [type.code for type in payment_mode.type.suitable_bank_types]
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'type': fields.many2one(
|
||||
'payment.mode.type', 'Payment type',
|
||||
required=True,
|
||||
help='Select the Payment Type for the Payment Mode.'
|
||||
),
|
||||
'transfer_account_id': fields.many2one(
|
||||
'account.account', 'Transfer account',
|
||||
domain=[('type', '=', 'other'),
|
||||
|
||||
@@ -27,30 +27,9 @@ from openerp.osv import orm, fields
|
||||
|
||||
|
||||
class payment_mode_type(orm.Model):
|
||||
_name = 'payment.mode.type'
|
||||
_description = 'Payment Mode Type'
|
||||
_inherit = 'payment.mode.type'
|
||||
|
||||
_columns = {
|
||||
'name': fields.char(
|
||||
'Name', size=64, required=True,
|
||||
help='Payment Type'
|
||||
),
|
||||
'code': fields.char(
|
||||
'Code', size=64, required=True,
|
||||
help='Specify the Code for Payment Type'
|
||||
),
|
||||
# Setting suitable_bank_types to required pending
|
||||
# https://bugs.launchpad.net/openobject-addons/+bug/786845
|
||||
'suitable_bank_types': fields.many2many(
|
||||
'res.partner.bank.type',
|
||||
'bank_type_payment_type_rel',
|
||||
'pay_type_id','bank_type_id',
|
||||
'Suitable bank types', required=True),
|
||||
'ir_model_id': fields.many2one(
|
||||
'ir.model', 'Payment wizard',
|
||||
help=('Select the Payment Wizard for payments of this type. '
|
||||
'Leave empty for manual processing'),
|
||||
domain=[('osv_memory', '=', True)],
|
||||
),
|
||||
'payment_order_type': fields.selection(
|
||||
[('payment', 'Payment'),('debit', 'Direct debit')],
|
||||
'Payment order type', required=True,
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from datetime import datetime
|
||||
from openerp.osv import orm, fields
|
||||
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
|
||||
from openerp.tools.translate import _
|
||||
|
||||
|
||||
|
||||
@@ -17,10 +17,6 @@
|
||||
'invisible':[('state','!=','draft')]
|
||||
}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//button[@string='Make Payments']"
|
||||
position="attributes">
|
||||
<attribute name="name">launch_wizard</attribute>
|
||||
</xpath>
|
||||
<!-- Communication only used for 'structured' communication -->
|
||||
<xpath expr="//field[@name='line_ids']/form//field[@name='communication']"
|
||||
position="attributes">
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_payment_manual_form" model="ir.ui.view">
|
||||
<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>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -26,7 +26,7 @@
|
||||
domain="[('id', 'in', payment_order_ids[0][2])]"
|
||||
/>
|
||||
</field>
|
||||
<field name="manual_move_line_id" position="after">
|
||||
<field name="manual_move_line_ids" position="after">
|
||||
<field name="manual_payment_line_id"/>
|
||||
<field name="manual_payment_order_id"/>
|
||||
</field>
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
<record id="view_payment_mode_form_inherit" model="ir.ui.view">
|
||||
<field name="name">payment.mode.form.inherit</field>
|
||||
<field name="model">payment.mode</field>
|
||||
<field name="inherit_id" ref="account_payment.view_payment_mode_form"/>
|
||||
<field name="inherit_id" ref="account_banking_payment_export.view_payment_mode_form_inherit"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="company_id" position="after">
|
||||
<field name="type"/>
|
||||
<field name="type" position="after">
|
||||
<group colspan="4" col="4">
|
||||
<group colspan="2">
|
||||
<separator colspan="2"
|
||||
|
||||
@@ -2,29 +2,14 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_payment_mode_tree_inherit" model="ir.ui.view">
|
||||
<field name="name">payment.mode.tree.inherit</field>
|
||||
<field name="model">payment.mode</field>
|
||||
<field name="inherit_id" ref="account_payment.view_payment_mode_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="company_id" position="after">
|
||||
<field name="type"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- basic view for payment mode type -->
|
||||
<record model="ir.ui.view" id="view_payment_mode_type_form">
|
||||
<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="name" />
|
||||
<field name="code" />
|
||||
<field name="suitable_bank_types"/>
|
||||
<field name="payment_order_type"/>
|
||||
<field name="ir_model_id"/>
|
||||
</form>
|
||||
<field name="suitable_bank_types" position="after">
|
||||
<field name="payment_order_type"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -29,6 +29,12 @@ write({'state':'rejected'})</field>
|
||||
<field name="act_to" ref="account_banking.act_sent"/>
|
||||
<field name="signal">sent</field>
|
||||
</record>
|
||||
<!-- the done signal continues to work but goes to sent -->
|
||||
<record id="account_banking.trans_open_done" model="workflow.transition">
|
||||
<field name="act_from" ref="account_payment.act_open"/>
|
||||
<field name="act_to" ref="account_banking.act_sent"/>
|
||||
<field name="signal">done</field>
|
||||
</record>
|
||||
<!-- From sent straight to sent_wait -->
|
||||
<record id="account_banking.trans_sent_sent_wait" model="workflow.transition">
|
||||
<field name="act_from" ref="account_banking.act_sent"/>
|
||||
|
||||
1
account_banking_payment_export/__init__.py
Normal file
1
account_banking_payment_export/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import model
|
||||
69
account_banking_payment_export/__openerp__.py
Normal file
69
account_banking_payment_export/__openerp__.py
Normal file
@@ -0,0 +1,69 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
'name': 'Account Banking - Payments Export Infrastructure',
|
||||
'version': '0.1.164',
|
||||
'license': 'AGPL-3',
|
||||
'author': 'Banking addons community',
|
||||
'website': 'https://launchpad.net/banking-addons',
|
||||
'category': 'Banking addons',
|
||||
'depends': [
|
||||
'account_payment',
|
||||
'base_iban', # for manual_bank_tranfer
|
||||
],
|
||||
'conflicts': [
|
||||
# lp:account-payment/account_payment_extension also adds
|
||||
# a type field to payment.mode, with a very similar purpose.
|
||||
# We can't add a dependency on account_payment_extension here
|
||||
# because account_payment_extension adds many other features
|
||||
# that probably conflict with other parts of lp:banking-addons.
|
||||
# Proposal to resolve: make account_payment_extension depend
|
||||
# on the present account_banking_payment_export module.
|
||||
'account_payment_extension',
|
||||
],
|
||||
'data': [
|
||||
'view/account_payment.xml',
|
||||
'view/bank_payment_manual.xml',
|
||||
'view/payment_mode.xml',
|
||||
'view/payment_mode_type.xml',
|
||||
'data/payment_mode_type.xml',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'description': '''
|
||||
Infrastructure to export payment orders.
|
||||
|
||||
This technical module provides the base infrastructure to export
|
||||
payment orders for electronic banking. It provides the following
|
||||
technical features:
|
||||
* a new payment.mode.type model
|
||||
* payment.mode now 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 as an example, with a default "do nothing" wizard
|
||||
''',
|
||||
'auto_install': True,
|
||||
'installable': True,
|
||||
}
|
||||
@@ -2,13 +2,13 @@
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- Add manual bank transfer as default payment option -->
|
||||
<record model="payment.mode.type" id="account_banking.manual_bank_tranfer">
|
||||
<record model="payment.mode.type" id="manual_bank_tranfer">
|
||||
<field name="name">Manual Bank Transfer</field>
|
||||
<field name="code">BANKMAN</field>
|
||||
<field name="suitable_bank_types"
|
||||
eval="[(6,0,[ref('base.bank_normal'),ref('base_iban.bank_iban'),])]" />
|
||||
<field name="ir_model_id"
|
||||
ref="account_banking_payment.model_payment_manual"/>
|
||||
ref="model_payment_manual"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
5
account_banking_payment_export/model/__init__.py
Normal file
5
account_banking_payment_export/model/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from . import account_payment
|
||||
from . import bank_payment_manual
|
||||
from . import payment_mode
|
||||
from . import payment_mode_type
|
||||
from . import payment_order_create
|
||||
75
account_banking_payment_export/model/account_payment.py
Normal file
75
account_banking_payment_export/model/account_payment.py
Normal file
@@ -0,0 +1,75 @@
|
||||
# -*- 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
|
||||
from openerp.tools.translate import _
|
||||
from openerp import netsvc
|
||||
|
||||
|
||||
class payment_order(orm.Model):
|
||||
_inherit = 'payment.order'
|
||||
|
||||
def launch_wizard(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Search for a wizard to launch according to the type.
|
||||
If type is manual. just confirm the order.
|
||||
Previously (pre-v6) in account_payment/wizard/wizard_pay.py
|
||||
"""
|
||||
if context == None:
|
||||
context = {}
|
||||
result = {}
|
||||
orders = self.browse(cr, uid, ids, context)
|
||||
order = orders[0]
|
||||
# check if a wizard is defined for the first order
|
||||
if order.mode.type and order.mode.type.ir_model_id:
|
||||
context['active_ids'] = ids
|
||||
wizard_model = order.mode.type.ir_model_id.model
|
||||
wizard_obj = self.pool.get(wizard_model)
|
||||
wizard_id = wizard_obj.create(cr, uid, {}, context)
|
||||
result = {
|
||||
'name': wizard_obj._description or _('Payment Order Export'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': wizard_model,
|
||||
'domain': [],
|
||||
'context': context,
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'res_id': wizard_id,
|
||||
'nodestroy': True,
|
||||
}
|
||||
else:
|
||||
# should all be manual orders without type or wizard model
|
||||
for order in orders[1:]:
|
||||
if order.mode.type and order.mode.type.ir_model_id:
|
||||
raise orm.except_orm(
|
||||
_('Error'),
|
||||
_('You can only combine payment orders of the same type')
|
||||
)
|
||||
# process manual payments
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
for order_id in ids:
|
||||
wf_service.trg_validate(uid, 'payment.order', order_id, 'done', cr)
|
||||
return result
|
||||
@@ -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, 'sent', 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'}
|
||||
52
account_banking_payment_export/model/payment_mode.py
Normal file
52
account_banking_payment_export/model/payment_mode.py
Normal file
@@ -0,0 +1,52 @@
|
||||
# -*- 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(orm.Model):
|
||||
''' Restoring the payment type from version 5,
|
||||
used to select the export wizard (if any) '''
|
||||
_inherit = "payment.mode"
|
||||
|
||||
def suitable_bank_types(self, cr, uid, payment_mode_id=None, context=None):
|
||||
""" Reinstates functional code for suitable bank type filtering.
|
||||
Current code in account_payment is disfunctional.
|
||||
"""
|
||||
res = []
|
||||
payment_mode = self.browse(
|
||||
cr, uid, payment_mode_id, context)
|
||||
if (payment_mode and payment_mode.type and
|
||||
payment_mode.type.suitable_bank_types):
|
||||
res = [t.code for t in payment_mode.type.suitable_bank_types]
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'type': fields.many2one(
|
||||
'payment.mode.type', 'Payment type',
|
||||
required=True,
|
||||
help='Select the Payment Type for the Payment Mode.'
|
||||
),
|
||||
}
|
||||
61
account_banking_payment_export/model/payment_mode_type.py
Normal file
61
account_banking_payment_export/model/payment_mode_type.py
Normal file
@@ -0,0 +1,61 @@
|
||||
# -*- 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):
|
||||
_name = 'payment.mode.type'
|
||||
_description = 'Payment Mode Type'
|
||||
_columns = {
|
||||
'name': fields.char(
|
||||
'Name', size=64, required=True,
|
||||
help='Payment Type'
|
||||
),
|
||||
'code': fields.char(
|
||||
'Code', size=64, required=True,
|
||||
help='Specify the Code for Payment Type'
|
||||
),
|
||||
'suitable_bank_types': fields.many2many(
|
||||
'res.partner.bank.type',
|
||||
'bank_type_payment_type_rel',
|
||||
'pay_type_id','bank_type_id',
|
||||
'Suitable bank types', required=True),
|
||||
'ir_model_id': fields.many2one(
|
||||
'ir.model', 'Payment wizard',
|
||||
help=('Select the Payment Wizard for payments of this type. '
|
||||
'Leave empty for manual processing'),
|
||||
domain=[('osv_memory', '=', True)],
|
||||
),
|
||||
}
|
||||
|
||||
def _auto_init(self, cr, context=None):
|
||||
r = super(payment_mode_type, self)._auto_init(cr, context=context)
|
||||
# migrate xmlid from manual_bank_transfer to avoid dependency on account_banking
|
||||
cr.execute("""UPDATE ir_model_data SET module='account_banking_payment_export'
|
||||
WHERE module='account_banking' AND
|
||||
name='manual_bank_tranfer' AND
|
||||
model='payment.mode.type'""")
|
||||
return r
|
||||
58
account_banking_payment_export/model/payment_order_create.py
Normal file
58
account_banking_payment_export/model/payment_order_create.py
Normal file
@@ -0,0 +1,58 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (C) 2013 ACSONE SA/NV (<http://acsone.eu>);.
|
||||
#
|
||||
# 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
|
||||
|
||||
|
||||
class payment_order_create(orm.TransientModel):
|
||||
_inherit = 'payment.order.create'
|
||||
|
||||
def create_payment(self, cr, uid, ids, context=None):
|
||||
'''This method adapts the core create_payment()
|
||||
to pass the payment mode to line2bank() through the context,
|
||||
so it is in turn propagated to suitable_bank_types().
|
||||
|
||||
This is necessary because the core does not propagate the payment mode to line2bank: t = None in
|
||||
http://bazaar.launchpad.net/~openerp/openobject-addons/7.0/view/head:/account_payment/wizard/account_payment_order.py#L72
|
||||
|
||||
Hack idea courtesy Stefan Rijnhart.
|
||||
'''
|
||||
if context is None:
|
||||
context = {}
|
||||
order_obj = self.pool.get('payment.order')
|
||||
payment = order_obj.browse(cr, uid, context['active_id'], context=context)
|
||||
context['_fix_payment_mode_id'] = payment.mode.id
|
||||
return super(payment_order_create, self).create_payment(cr, uid, ids, context=context)
|
||||
|
||||
|
||||
class account_move_line(orm.Model):
|
||||
_inherit = 'account.move.line'
|
||||
|
||||
def line2bank(self, cr, uid, ids, payment_mode_id=None, context=None):
|
||||
'''Obtain payment_type from context, see create_payment above'''
|
||||
if context is None:
|
||||
context = {}
|
||||
payment_mode_id = payment_mode_id or context.get('_fix_payment_mode_id')
|
||||
return super(account_move_line, self).line2bank(cr, uid, ids, payment_mode_id, context=context)
|
||||
|
||||
22
account_banking_payment_export/view/account_payment.xml
Normal file
22
account_banking_payment_export/view/account_payment.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- restore wizard functionality when making payments
|
||||
-->
|
||||
|
||||
<record id="view_banking_payment_order_form_1" model="ir.ui.view">
|
||||
<field name="name">account.payment.order.form.banking-1</field>
|
||||
<field name="inherit_id" ref="account_payment.view_payment_order_form" />
|
||||
<field name="model">payment.order</field>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//button[@string='Make Payments']"
|
||||
position="attributes">
|
||||
<attribute name="name">launch_wizard</attribute>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
18
account_banking_payment_export/view/bank_payment_manual.xml
Normal file
18
account_banking_payment_export/view/bank_payment_manual.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_payment_manual_form" model="ir.ui.view">
|
||||
<field name="name">Form for manual payment wizard</field>
|
||||
<field name="model">payment.manual</field>
|
||||
<field name="arch" type="xml">
|
||||
<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>
|
||||
</data>
|
||||
</openerp>
|
||||
20
account_banking_payment_export/view/payment_mode.xml
Normal file
20
account_banking_payment_export/view/payment_mode.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!--
|
||||
Add the payment mode type and transfer settings
|
||||
-->
|
||||
<record id="view_payment_mode_form_inherit" model="ir.ui.view">
|
||||
<field name="name">payment.mode.form.inherit</field>
|
||||
<field name="model">payment.mode</field>
|
||||
<field name="inherit_id" ref="account_payment.view_payment_mode_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="company_id" position="after">
|
||||
<field name="type"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
31
account_banking_payment_export/view/payment_mode_type.xml
Normal file
31
account_banking_payment_export/view/payment_mode_type.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_payment_mode_tree_inherit" model="ir.ui.view">
|
||||
<field name="name">payment.mode.tree.inherit</field>
|
||||
<field name="model">payment.mode</field>
|
||||
<field name="inherit_id" ref="account_payment.view_payment_mode_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="company_id" position="after">
|
||||
<field name="type"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- basic view for payment mode type -->
|
||||
<record model="ir.ui.view" id="view_payment_mode_type_form">
|
||||
<field name="name">view.payment.mode.type.form</field>
|
||||
<field name="model">payment.mode.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Payment mode">
|
||||
<field name="name" />
|
||||
<field name="code" />
|
||||
<field name="suitable_bank_types"/>
|
||||
<field name="ir_model_id"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -20,12 +20,13 @@
|
||||
##############################################################################
|
||||
{
|
||||
'name': 'Account Banking SEPA Credit Transfer',
|
||||
'summary': 'Create SEPA XML files for Credit Transfers',
|
||||
'version': '0.1',
|
||||
'license': 'AGPL-3',
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'category': 'Banking addons',
|
||||
'depends': ['account_banking_payment'],
|
||||
'depends': ['account_banking_payment_export'],
|
||||
'data': [
|
||||
'account_banking_sepa_view.xml',
|
||||
'wizard/export_sepa_view.xml',
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
##############################################################################
|
||||
|
||||
from openerp.osv import orm, fields
|
||||
import time
|
||||
from openerp.tools.translate import _
|
||||
from openerp.addons.decimal_precision import decimal_precision as dp
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="SEPA Credit Transfer">
|
||||
<notebook>
|
||||
<page string="General information">
|
||||
<page string="General Information">
|
||||
<field name="msg_identification" select="1" />
|
||||
<field name="total_amount" />
|
||||
<field name="nb_transactions" />
|
||||
@@ -25,7 +25,7 @@
|
||||
<field name="file" filename="filename"/>
|
||||
<field name="filename" invisible="True"/>
|
||||
</page>
|
||||
<page string="Payment orders">
|
||||
<page string="Payment Orders">
|
||||
<field name="payment_order_ids" colspan="4" nolabel="1">
|
||||
<tree colors="blue:state in ('draft');gray:state in ('cancel','done');black:state in ('open')" string="Payment order">
|
||||
<field name="reference"/>
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<record id="action_account_banking_sepa" model="ir.actions.act_window">
|
||||
<field name="name">Generated SEPA XML files</field>
|
||||
<field name="name">Generated SEPA Credit Transfer XML files</field>
|
||||
<field name="res_model">banking.export.sepa</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
@@ -65,13 +65,13 @@
|
||||
|
||||
|
||||
<menuitem id="menu_account_banking_sepa"
|
||||
parent="account_banking.menu_finance_banking_actions"
|
||||
parent="account_payment.menu_main_payment"
|
||||
action="action_account_banking_sepa"
|
||||
sequence="15"
|
||||
/>
|
||||
|
||||
<act_window id="act_banking_export_sepa_payment_order"
|
||||
name="Generated SEPA files"
|
||||
name="Generated SEPA Credit Transfer files"
|
||||
domain="[('payment_order_ids', '=', active_id)]"
|
||||
res_model="banking.export.sepa"
|
||||
src_model="payment.order"
|
||||
|
||||
@@ -101,12 +101,10 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
'''
|
||||
Creates the SEPA Credit Transfer file. That's the important code !
|
||||
'''
|
||||
payment_order_obj = self.pool.get('payment.order')
|
||||
|
||||
sepa_export = self.browse(cr, uid, ids[0], context=context)
|
||||
|
||||
my_company_name = sepa_export.payment_order_ids[0].mode.bank_id.partner_id.name
|
||||
my_company_iban = self._validate_iban(cr, uid, sepa_export.payment_order_ids[0].mode.bank_id.iban, context=context)
|
||||
my_company_iban = self._validate_iban(cr, uid, sepa_export.payment_order_ids[0].mode.bank_id.acc_number, context=context)
|
||||
my_company_bic = sepa_export.payment_order_ids[0].mode.bank_id.bank.bic
|
||||
#my_company_country_code = sepa_export.payment_order_ids[0].mode.bank_id.partner_id.address[0].country_id.code
|
||||
#my_company_city = sepa_export.payment_order_ids[0].mode.bank_id.partner_id.address[0].city
|
||||
@@ -211,8 +209,9 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
debtor_account_iban.text = my_company_iban
|
||||
debtor_agent = etree.SubElement(payment_info, 'DbtrAgt')
|
||||
debtor_agent_institution = etree.SubElement(debtor_agent, 'FinInstnId')
|
||||
debtor_agent_bic = etree.SubElement(debtor_agent_institution, bic_xml_tag)
|
||||
debtor_agent_bic.text = my_company_bic
|
||||
if my_company_bic:
|
||||
debtor_agent_bic = etree.SubElement(debtor_agent_institution, bic_xml_tag)
|
||||
debtor_agent_bic.text = my_company_bic
|
||||
charge_bearer = etree.SubElement(payment_info, 'ChrgBr')
|
||||
charge_bearer.text = sepa_export.charge_bearer
|
||||
|
||||
@@ -238,8 +237,11 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
amount_control_sum += line.amount_currency
|
||||
creditor_agent = etree.SubElement(credit_transfer_transaction_info, 'CdtrAgt')
|
||||
creditor_agent_institution = etree.SubElement(creditor_agent, 'FinInstnId')
|
||||
creditor_agent_bic = etree.SubElement(creditor_agent_institution, bic_xml_tag)
|
||||
creditor_agent_bic.text = line.bank_id.bank.bic
|
||||
if not line.bank_id:
|
||||
raise orm.except_orm(_('Error :'), _("Missing Bank Account on invoice '%s' (payment order line reference '%s').") %(line.ml_inv_ref.number, line.name))
|
||||
if line.bank_id.bank.bic:
|
||||
creditor_agent_bic = etree.SubElement(creditor_agent_institution, bic_xml_tag)
|
||||
creditor_agent_bic.text = line.bank_id.bank.bic
|
||||
creditor = etree.SubElement(credit_transfer_transaction_info, 'Cdtr')
|
||||
creditor_name = etree.SubElement(creditor, 'Nm')
|
||||
creditor_name.text = self._limit_size(cr, uid, line.partner_id.name, name_maxsize, context=context)
|
||||
@@ -255,7 +257,7 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
creditor_account = etree.SubElement(credit_transfer_transaction_info, 'CdtrAcct')
|
||||
creditor_account_id = etree.SubElement(creditor_account, 'Id')
|
||||
creditor_account_iban = etree.SubElement(creditor_account_id, 'IBAN')
|
||||
creditor_account_iban.text = self._validate_iban(cr, uid, line.bank_id.iban, context=context)
|
||||
creditor_account_iban.text = self._validate_iban(cr, uid, line.bank_id.acc_number, context=context)
|
||||
remittance_info = etree.SubElement(credit_transfer_transaction_info, 'RmtInf')
|
||||
# switch to Structured (Strdr) ? If we do it, beware that the format is not the same between pain 02 and pain 03
|
||||
remittance_info_unstructured = etree.SubElement(remittance_info, 'Ustrd')
|
||||
@@ -275,7 +277,8 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
official_pain_schema = etree.XMLSchema(etree.parse(tools.file_open('account_banking_sepa_credit_transfer/data/%s.xsd' % pain_flavor)))
|
||||
|
||||
try:
|
||||
official_pain_schema.validate(root)
|
||||
root_to_validate = etree.fromstring(xml_string)
|
||||
official_pain_schema.assertValid(root_to_validate)
|
||||
except Exception, e:
|
||||
_logger.warning("The XML file is invalid against the XML Schema Definition")
|
||||
_logger.warning(xml_string)
|
||||
@@ -325,12 +328,15 @@ class banking_export_sepa_wizard(orm.TransientModel):
|
||||
|
||||
def save_sepa(self, cr, uid, ids, context=None):
|
||||
'''
|
||||
Save the SEPA PAIN: mark all payments in the file as 'sent'.
|
||||
Save the SEPA PAIN: send the done signal to all payment orders in the file.
|
||||
With the default workflow, they will transition to 'done', while with the
|
||||
advanced workflow in account_banking_payment they will transition to 'sent'
|
||||
waiting reconciliation.
|
||||
'''
|
||||
sepa_export = self.browse(cr, uid, ids[0], context=context)
|
||||
sepa_file = self.pool.get('banking.export.sepa').write(cr, uid,
|
||||
self.pool.get('banking.export.sepa').write(cr, uid,
|
||||
sepa_export.file_id.id, {'state': 'sent'}, context=context)
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
for order in sepa_export.payment_order_ids:
|
||||
wf_service.trg_validate(uid, 'payment.order', order.id, 'sent', cr)
|
||||
wf_service.trg_validate(uid, 'payment.order', order.id, 'done', cr)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<field name="name">banking.export.sepa.wizard.view</field>
|
||||
<field name="model">banking.export.sepa.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="SEPA XML file generation">
|
||||
<form string="SEPA XML file generation" version="7.0">
|
||||
<field name="state" invisible="True"/>
|
||||
<group states="create">
|
||||
<separator colspan="4" string="Processing details" />
|
||||
@@ -20,9 +20,6 @@
|
||||
<field name="charge_bearer" />
|
||||
<separator colspan="4" string="Reference for further communication" />
|
||||
<field name="msg_identification" required="True" />
|
||||
<newline />
|
||||
<button icon="gtk-close" special="cancel" string="Cancel" colspan="2"/>
|
||||
<button icon="gtk-ok" string="Generate" name="create_sepa" type="object" colspan="2"/>
|
||||
</group>
|
||||
<group states="finish">
|
||||
<field name="total_amount" />
|
||||
@@ -31,14 +28,16 @@
|
||||
Bug desc : in the Gtk client, you have to clic twice on the
|
||||
"Create" button.
|
||||
<field name="nb_transactions" /> -->
|
||||
<newline />
|
||||
<field name="file_id" />
|
||||
<!-- <field name="file_id" /> -->
|
||||
<field name="file" filename="filename" />
|
||||
<field name="filename" invisible="True"/>
|
||||
<newline />
|
||||
<button icon="gtk-cancel" string="Cancel" name="cancel_sepa" type="object" colspan="2"/>
|
||||
<button icon="gtk-ok" string="Validate" name="save_sepa" type="object" colspan="2"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Generate" name="create_sepa" type="object" class="oe_highlight" states="create"/>
|
||||
<button string="Cancel" special="cancel" class="oe_link" states="create"/>
|
||||
<button string="Validate" name="save_sepa" type="object" class="oe_highlight" states="finish"/>
|
||||
<button string="Cancel" name="cancel_sepa" type="object" class="oe_link" states="finish"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
'author': ['Therp BV', 'Smile'],
|
||||
'website': 'https://launchpad.net/banking-addons',
|
||||
'category': 'Banking addons',
|
||||
'depends': ['account_banking'],
|
||||
'depends': ['account_banking_payment'],
|
||||
'data': [
|
||||
'view/account_payment.xml',
|
||||
'view/account_invoice.xml',
|
||||
|
||||
38
account_direct_debit/migrations/7.0.2/post-migration.py
Normal file
38
account_direct_debit/migrations/7.0.2/post-migration.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (C) 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
def migrate(cr, version):
|
||||
if not version:
|
||||
return
|
||||
cr.execute(
|
||||
"""
|
||||
UPDATE payment_line
|
||||
SET transit_move_line_id = banking_addons_61_debit_move_line_id
|
||||
""")
|
||||
cr.execute(
|
||||
"""
|
||||
ALTER TABLE "payment_line"
|
||||
DROP COLUMN "banking_addons_61_debit_move_line_id"
|
||||
"""
|
||||
)
|
||||
@@ -22,6 +22,9 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger()
|
||||
|
||||
def rename_columns(cr, column_spec):
|
||||
"""
|
||||
Rename table columns. Taken from OpenUpgrade.
|
||||
@@ -41,17 +44,8 @@ def migrate(cr, version):
|
||||
if not version:
|
||||
return
|
||||
|
||||
# workflow state moved to another module
|
||||
cr.execute(
|
||||
"""
|
||||
UPDATE ir_model_data
|
||||
SET module = 'account_banking_payment'
|
||||
WHERE name = 'trans_done_sent'
|
||||
AND module = 'account_direct_debit'
|
||||
""")
|
||||
|
||||
# rename field debit_move_line_id
|
||||
rename_columns(cr, {
|
||||
'payment_line': [
|
||||
('debit_move_line_id', 'transit_move_line_id'),
|
||||
('debit_move_line_id', 'banking_addons_61_debit_move_line_id'),
|
||||
]})
|
||||
|
||||
@@ -133,14 +133,14 @@ class payment_line(orm.Model):
|
||||
"""
|
||||
if isinstance(payment_line_id, (list, tuple)):
|
||||
payment_line_id = payment_line_id[0]
|
||||
payment_line = self.read(
|
||||
payment_line_vals = self.read(
|
||||
cr, uid, payment_line_id, ['storno', 'name'], context=context)
|
||||
if payment_line['storno']:
|
||||
if payment_line_vals['storno']:
|
||||
raise orm.except_orm(
|
||||
_('Can not reconcile'),
|
||||
_('Cancelation of payment line \'%s\' has already been '
|
||||
'processed') % payment_line['name'])
|
||||
return super(self, payment_line).debit_reconcile(
|
||||
'processed') % payment_line_vals['name'])
|
||||
return super(payment_line, self).debit_reconcile(
|
||||
cr, uid, payment_line_id, context=context)
|
||||
|
||||
_columns = {
|
||||
|
||||
1
base_iban_bic_not_required/__init__.py
Normal file
1
base_iban_bic_not_required/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
import model
|
||||
47
base_iban_bic_not_required/__openerp__.py
Normal file
47
base_iban_bic_not_required/__openerp__.py
Normal file
@@ -0,0 +1,47 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (C) 2013 Therp BV (<http://therp.nl>).
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
'name': 'IBAN - Bic not required',
|
||||
'version': '0.1',
|
||||
'license': 'AGPL-3',
|
||||
'author': 'Banking addons community',
|
||||
'website': 'https://launchpad.net/banking-addons',
|
||||
'category': 'Banking addons',
|
||||
'depends': [
|
||||
'base_iban',
|
||||
],
|
||||
'description': '''
|
||||
The account_iban module in OpenERP mandates the presence of a BIC
|
||||
code on an IBAN account number through a constraint. However, as of
|
||||
Februari 2012 there is a resolution from the EU that drops this requirement
|
||||
(see section 8 of [1]). This module reverts the constraint on BICs in the
|
||||
base_iban module.
|
||||
|
||||
See also https://bugs.launchpad.net/openobject-addons/+bug/933472
|
||||
|
||||
[1] http://www.europarl.europa.eu/sides/getDoc.do?pubRef=-//EP//TEXT+TA+P7-TA-2012-0037+0+DOC+XML+V0//EN&language=EN#BKMD-9
|
||||
''',
|
||||
'data': [
|
||||
'data/res_partner_bank_type_field.xml',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="base_iban.bank_swift_field"
|
||||
model="res.partner.bank.type.field">
|
||||
<field eval="False" name="required"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
1
base_iban_bic_not_required/model/__init__.py
Normal file
1
base_iban_bic_not_required/model/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
import res_partner_bank
|
||||
38
base_iban_bic_not_required/model/res_partner_bank.py
Normal file
38
base_iban_bic_not_required/model/res_partner_bank.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (C) 2013 Therp BV (<http://therp.nl>).
|
||||
# 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
|
||||
|
||||
|
||||
class res_partner_bank(orm.Model):
|
||||
_inherit = 'res.partner.bank'
|
||||
|
||||
def _check_bank(self, cr, uid, ids, context=None):
|
||||
#suppress base_iban's constraint to enforce BICs for IBANs
|
||||
#workaround for lp:933472
|
||||
return True
|
||||
|
||||
# Redefine constraint to update its function reference
|
||||
_constraints = [
|
||||
(_check_bank,
|
||||
'\nPlease define BIC/Swift code on bank for bank '
|
||||
'type IBAN Account to make valid payments',
|
||||
['bic'])
|
||||
]
|
||||
Reference in New Issue
Block a user