diff --git a/account_bank_statement_tax/i18n/hu.po b/account_bank_statement_tax/i18n/hu.po
index 1527497e1..d4f9956fe 100644
--- a/account_bank_statement_tax/i18n/hu.po
+++ b/account_bank_statement_tax/i18n/hu.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_bank_statement_tax
#: model:ir.model,name:account_bank_statement_tax.model_account_bank_statement_line
diff --git a/account_bank_statement_tax/i18n/nl.po b/account_bank_statement_tax/i18n/nl.po
index 1709dae7a..47ba4a211 100644
--- a/account_bank_statement_tax/i18n/nl.po
+++ b/account_bank_statement_tax/i18n/nl.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_bank_statement_tax
#: model:ir.model,name:account_bank_statement_tax.model_account_bank_statement_line
diff --git a/account_bank_statement_tax/i18n/pt_BR.po b/account_bank_statement_tax/i18n/pt_BR.po
index 13ca3865b..44c8ca780 100644
--- a/account_bank_statement_tax/i18n/pt_BR.po
+++ b/account_bank_statement_tax/i18n/pt_BR.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_bank_statement_tax
#: model:ir.model,name:account_bank_statement_tax.model_account_bank_statement_line
diff --git a/account_banking/account_banking_view.xml b/account_banking/account_banking_view.xml
index 332867dfe..ee1888578 100644
--- a/account_banking/account_banking_view.xml
+++ b/account_banking/account_banking_view.xml
@@ -95,7 +95,7 @@
action="action_account_banking_journals"
sequence="20"
/>
-
+
account.banking.imported.file.form
@@ -221,7 +221,7 @@
@@ -248,7 +248,10 @@
position="after">
-
+
+ {'readonly': ['|', ('state', '!=', 'draft'), ('match_type', '!=', '')]}
+
@@ -292,7 +295,7 @@
-
+
@@ -307,7 +310,8 @@
-
+
diff --git a/account_banking/i18n/da.po b/account_banking/i18n/da.po
index bb8b10922..9adc56c19 100644
--- a/account_banking/i18n/da.po
+++ b/account_banking/i18n/da.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking
#: field:account.bank.statement.line,reconcile_id:0
diff --git a/account_banking/i18n/en.po b/account_banking/i18n/en.po
index baddfde14..01d121c13 100644
--- a/account_banking/i18n/en.po
+++ b/account_banking/i18n/en.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking
#: field:account.bank.statement.line,reconcile_id:0
diff --git a/account_banking/i18n/es_ES.po b/account_banking/i18n/es_ES.po
index 6407110c9..a45ae7d2b 100644
--- a/account_banking/i18n/es_ES.po
+++ b/account_banking/i18n/es_ES.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking
#: field:account.bank.statement.line,reconcile_id:0
diff --git a/account_banking/i18n/hr.po b/account_banking/i18n/hr.po
index 79c8ddf76..da6d1136a 100644
--- a/account_banking/i18n/hr.po
+++ b/account_banking/i18n/hr.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking
#: field:account.bank.statement.line,reconcile_id:0
diff --git a/account_banking/i18n/hu.po b/account_banking/i18n/hu.po
index 53947252d..c9a7327c6 100644
--- a/account_banking/i18n/hu.po
+++ b/account_banking/i18n/hu.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking
#: field:account.bank.statement.line,reconcile_id:0
diff --git a/account_banking/i18n/nb.po b/account_banking/i18n/nb.po
index 880140043..cffd4f4fd 100644
--- a/account_banking/i18n/nb.po
+++ b/account_banking/i18n/nb.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking
#: field:account.bank.statement.line,reconcile_id:0
diff --git a/account_banking/i18n/nl.po b/account_banking/i18n/nl.po
index 5c6d4c205..b54134a3f 100644
--- a/account_banking/i18n/nl.po
+++ b/account_banking/i18n/nl.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking
#: field:account.bank.statement.line,reconcile_id:0
diff --git a/account_banking/i18n/pt_BR.po b/account_banking/i18n/pt_BR.po
index f0c1d32e2..55a268a5d 100644
--- a/account_banking/i18n/pt_BR.po
+++ b/account_banking/i18n/pt_BR.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking
#: field:account.bank.statement.line,reconcile_id:0
diff --git a/account_banking/i18n/ro.po b/account_banking/i18n/ro.po
index 2be8848a4..541664ab0 100644
--- a/account_banking/i18n/ro.po
+++ b/account_banking/i18n/ro.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking
#: field:account.bank.statement.line,reconcile_id:0
diff --git a/account_banking/i18n/tr.po b/account_banking/i18n/tr.po
index 9c9325beb..ed72b3683 100644
--- a/account_banking/i18n/tr.po
+++ b/account_banking/i18n/tr.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking
#: field:account.bank.statement.line,reconcile_id:0
diff --git a/account_banking_fi_patu/i18n/nl.po b/account_banking_fi_patu/i18n/nl.po
index 7a909b75e..081552571 100644
--- a/account_banking_fi_patu/i18n/nl.po
+++ b/account_banking_fi_patu/i18n/nl.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_fi_patu
#: code:addons/account_banking_fi_patu/patu.py:115
diff --git a/account_banking_fi_patu/i18n/pt_BR.po b/account_banking_fi_patu/i18n/pt_BR.po
index 2a393d638..21b40bc37 100644
--- a/account_banking_fi_patu/i18n/pt_BR.po
+++ b/account_banking_fi_patu/i18n/pt_BR.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_fi_patu
#: code:addons/account_banking_fi_patu/patu.py:115
diff --git a/account_banking_payment/model/payment_mode_type.py b/account_banking_mt940/__init__.py
similarity index 58%
rename from account_banking_payment/model/payment_mode_type.py
rename to account_banking_mt940/__init__.py
index 572cce869..bb289e723 100644
--- a/account_banking_payment/model/payment_mode_type.py
+++ b/account_banking_mt940/__init__.py
@@ -1,12 +1,8 @@
# -*- 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
+# OpenERP, Open Source Management Solution
+# This module copyright (C) 2014 Therp BV ().
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -22,20 +18,4 @@
# 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',
- }
+from . import mt940
diff --git a/account_banking_mt940/__openerp__.py b/account_banking_mt940/__openerp__.py
new file mode 100644
index 000000000..3a6ee25a3
--- /dev/null
+++ b/account_banking_mt940/__openerp__.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# This module copyright (C) 2014 Therp BV ().
+#
+# 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" : "MT940",
+ "version" : "1.0",
+ "author" : "Therp BV",
+ "complexity": "expert",
+ "description": """
+This addon provides a generic parser for MT940 files. Given that MT940 is a
+non-open non-standard of pure evil in the way that every bank cooks up its own
+interpretation of it, this addon alone won't help you much. It is rather
+intended to be used by other addons to implement the dialect specific to a
+certain bank.
+
+See account_banking_nl_ing_mt940 for an example on how to use it.
+ """,
+ "category" : "Dependency",
+ "depends" : [
+ 'account_banking',
+ ],
+ "data" : [
+ ],
+ "js": [
+ ],
+ "css": [
+ ],
+ "qweb": [
+ ],
+ "auto_install": False,
+ "installable": True,
+ "application": False,
+ "external_dependencies" : {
+ 'python' : [],
+ },
+}
diff --git a/account_banking_mt940/mt940.py b/account_banking_mt940/mt940.py
new file mode 100644
index 000000000..a5c193e5a
--- /dev/null
+++ b/account_banking_mt940/mt940.py
@@ -0,0 +1,217 @@
+#!/usr/bin/env python2
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# This module copyright (C) 2014 Therp BV ().
+#
+# 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 .
+#
+##############################################################################
+
+"""
+Parser for MT940 format files
+"""
+import re
+import datetime
+import logging
+try:
+ from openerp.addons.account_banking.parsers.models import\
+ mem_bank_statement, mem_bank_transaction
+ from openerp.tools.misc import DEFAULT_SERVER_DATE_FORMAT
+except ImportError:
+ #this allows us to run this file standalone, see __main__ at the end
+ class mem_bank_statement:
+ def __init__(self):
+ self.transactions = []
+ class mem_bank_transaction:
+ pass
+ DEFAULT_SERVER_DATE_FORMAT = "%Y-%m-%d"
+
+class MT940(object):
+ '''Inherit this class in your account_banking.parsers.models.parser,
+ define functions to handle the tags you need to handle and adjust static
+ variables as needed.
+
+ Note that order matters: You need to do your_parser(MT940, parser), not the
+ other way around!
+
+ At least, you should override handle_tag_61 and handle_tag_86. Don't forget
+ to call super.
+ handle_tag_* functions receive the remainder of the the line (that is,
+ without ':XX:') and are supposed to write into self.current_transaction'''
+
+ header_lines = 3
+ '''One file can contain multiple statements, each with its own poorly
+ documented header. For now, the best thing to do seems to skip that'''
+
+ footer_regex = '^-}$'
+ footer_regex = '^-XXX$'
+ 'The line that denotes end of message, we need to create a new statement'
+
+ tag_regex = '^:[0-9]{2}[A-Z]*:'
+ 'The beginning of a record, should be anchored to beginning of the line'
+
+ def __init__(self, *args, **kwargs):
+ super(MT940, self).__init__(*args, **kwargs)
+ 'state variables'
+ self.current_statement = None
+ 'type account_banking.parsers.models.mem_bank_statement'
+ self.current_transaction = None
+ 'type account_banking.parsers.models.mem_bank_transaction'
+ self.statements = []
+ 'parsed statements up to now'
+
+ def parse(self, cr, data):
+ 'implements account_banking.parsers.models.parser.parse()'
+ iterator = data.split('\r\n').__iter__()
+ line = None
+ record_line = ''
+ try:
+ while True:
+ if not self.current_statement:
+ self.handle_header(cr, line, iterator)
+ line = iterator.next()
+ if not self.is_tag(cr, line) and not self.is_footer(cr, line):
+ record_line = self.append_continuation_line(
+ cr, record_line, line)
+ continue
+ if record_line:
+ self.handle_record(cr, record_line)
+ if self.is_footer(cr, line):
+ self.handle_footer(cr, line, iterator)
+ record_line = ''
+ continue
+ record_line = line
+ except StopIteration:
+ pass
+ return self.statements
+
+ def append_continuation_line(self, cr, line, continuation_line):
+ '''append a continuation line for a multiline record.
+ Override and do data cleanups as necessary.'''
+ return line + continuation_line
+
+ def create_statement(self, cr):
+ '''create a mem_bank_statement - override if you need a custom
+ implementation'''
+ return mem_bank_statement()
+
+ def create_transaction(self, cr):
+ '''create a mem_bank_transaction - override if you need a custom
+ implementation'''
+ return mem_bank_transaction()
+
+ def is_footer(self, cr, line):
+ '''determine if a line is the footer of a statement'''
+ return line and bool(re.match(self.footer_regex, line))
+
+ def is_tag(self, cr, line):
+ '''determine if a line has a tag'''
+ return line and bool(re.match(self.tag_regex, line))
+
+ def handle_header(self, cr, line, iterator):
+ '''skip header lines, create current statement'''
+ for i in range(self.header_lines):
+ iterator.next()
+ self.current_statement = self.create_statement(cr)
+
+ def handle_footer(self, cr, line, iterator):
+ '''add current statement to list, reset state'''
+ self.statements.append(self.current_statement)
+ self.current_statement = None
+
+ def handle_record(self, cr, line):
+ '''find a function to handle the record represented by line'''
+ tag_match = re.match(self.tag_regex, line)
+ tag = tag_match.group(0).strip(':')
+ if not hasattr(self, 'handle_tag_%s' % tag):
+ logging.error('Unknown tag %s', tag)
+ logging.error(line)
+ return
+ handler = getattr(self, 'handle_tag_%s' % tag)
+ handler(cr, line[tag_match.end():])
+
+ def handle_tag_20(self, cr, data):
+ '''ignore reference number'''
+ pass
+
+ def handle_tag_25(self, cr, data):
+ '''get account owner information'''
+ self.current_statement.local_account = data
+
+ def handle_tag_28C(self, cr, data):
+ '''get sequence number _within_this_batch_ - this alone
+ doesn't provide a unique id!'''
+ self.current_statement.id = data
+
+ def handle_tag_60F(self, cr, data):
+ '''get start balance and currency'''
+ self.current_statement.local_currency = data[7:10]
+ self.current_statement.date = str2date(data[1:7])
+ self.current_statement.start_balance = \
+ (1 if data[0] == 'C' else -1) * str2float(data[10:])
+ self.current_statement.id = '%s/%s' % (
+ self.current_statement.date.strftime('%Y'),
+ self.current_statement.id)
+
+ def handle_tag_62F(self, cr, data):
+ '''get ending balance'''
+ self.current_statement.end_balance = \
+ (1 if data[0] == 'C' else -1) * str2float(data[10:])
+
+ def handle_tag_64(self, cr, data):
+ '''get current balance in currency'''
+ pass
+
+ def handle_tag_65(self, cr, data):
+ '''get future balance in currency'''
+ pass
+
+ def handle_tag_61(self, cr, data):
+ '''get transaction values'''
+ transaction = self.create_transaction(cr)
+ self.current_statement.transactions.append(transaction)
+ self.current_transaction = transaction
+ transaction.execution_date = str2date(data[:6])
+ transaction.effective_date = str2date(data[:6])
+ '...and the rest already is highly bank dependent'
+
+ def handle_tag_86(self, cr, data):
+ '''details for previous transaction, here most differences between
+ banks occur'''
+ pass
+
+'utility functions'
+def str2date(string, fmt='%y%m%d'):
+ return datetime.datetime.strptime(string, fmt)
+
+def str2float(string):
+ return float(string.replace(',', '.'))
+
+'testing'
+def main(filename):
+ parser = MT940()
+ parser.parse(None, open(filename, 'r').read())
+ for statement in parser.statements:
+ print '''statement found for %(local_account)s at %(date)s
+ with %(local_currency)s%(start_balance)s to %(end_balance)s
+ ''' % statement.__dict__
+ for transaction in statement.transactions:
+ print '''
+ transaction on %(execution_date)s''' % transaction.__dict__
+
+if __name__ == '__main__':
+ import sys
+ main(*sys.argv[1:])
diff --git a/account_banking_mt940/static/src/img/icon.png b/account_banking_mt940/static/src/img/icon.png
new file mode 100644
index 000000000..4c7ab3029
Binary files /dev/null and b/account_banking_mt940/static/src/img/icon.png differ
diff --git a/account_banking_nl_abnamro/i18n/en.po b/account_banking_nl_abnamro/i18n/en.po
index 69da64ad0..7242da101 100644
--- a/account_banking_nl_abnamro/i18n/en.po
+++ b/account_banking_nl_abnamro/i18n/en.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_nl_abnamro
#: code:addons/account_banking_nl_abnamro/abnamro.py:122
diff --git a/account_banking_nl_abnamro/i18n/nl.po b/account_banking_nl_abnamro/i18n/nl.po
index 381942861..c2036b361 100644
--- a/account_banking_nl_abnamro/i18n/nl.po
+++ b/account_banking_nl_abnamro/i18n/nl.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_nl_abnamro
#: code:addons/account_banking_nl_abnamro/abnamro.py:122
diff --git a/account_banking_nl_clieop/i18n/da.po b/account_banking_nl_clieop/i18n/da.po
index 7f37a8c4a..056a89695 100644
--- a/account_banking_nl_clieop/i18n/da.po
+++ b/account_banking_nl_clieop/i18n/da.po
@@ -14,7 +14,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
diff --git a/account_banking_nl_clieop/i18n/en.po b/account_banking_nl_clieop/i18n/en.po
index 9872230d7..83c09a436 100644
--- a/account_banking_nl_clieop/i18n/en.po
+++ b/account_banking_nl_clieop/i18n/en.po
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
diff --git a/account_banking_nl_clieop/i18n/nl.po b/account_banking_nl_clieop/i18n/nl.po
index 8cc5c4d2d..4725b9098 100644
--- a/account_banking_nl_clieop/i18n/nl.po
+++ b/account_banking_nl_clieop/i18n/nl.po
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
diff --git a/account_banking_nl_clieop/i18n/tr.po b/account_banking_nl_clieop/i18n/tr.po
index de3d61ca4..368f85988 100644
--- a/account_banking_nl_clieop/i18n/tr.po
+++ b/account_banking_nl_clieop/i18n/tr.po
@@ -14,7 +14,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
diff --git a/account_banking_nl_girotel/i18n/en.po b/account_banking_nl_girotel/i18n/en.po
index 1af16775b..258bb6a0e 100644
--- a/account_banking_nl_girotel/i18n/en.po
+++ b/account_banking_nl_girotel/i18n/en.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_nl_girotel
#: code:addons/account_banking_nl_girotel/girotel.py:325
diff --git a/account_banking_nl_girotel/i18n/nl.po b/account_banking_nl_girotel/i18n/nl.po
index 5cd9e3067..1006a0405 100644
--- a/account_banking_nl_girotel/i18n/nl.po
+++ b/account_banking_nl_girotel/i18n/nl.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_nl_girotel
#: code:addons/account_banking_nl_girotel/girotel.py:325
diff --git a/account_banking_nl_girotel/i18n/pt_BR.po b/account_banking_nl_girotel/i18n/pt_BR.po
index 2faa21a20..25cf010ba 100644
--- a/account_banking_nl_girotel/i18n/pt_BR.po
+++ b/account_banking_nl_girotel/i18n/pt_BR.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_nl_girotel
#: code:addons/account_banking_nl_girotel/girotel.py:325
diff --git a/account_banking_nl_ing/i18n/nl.po b/account_banking_nl_ing/i18n/nl.po
index 6f5b2f1b9..18d8307b0 100644
--- a/account_banking_nl_ing/i18n/nl.po
+++ b/account_banking_nl_ing/i18n/nl.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_nl_ing
#: code:addons/account_banking_nl_ing/ing.py:257
diff --git a/account_banking_nl_ing/i18n/pt_BR.po b/account_banking_nl_ing/i18n/pt_BR.po
index 3c8780e1f..698d96f1d 100644
--- a/account_banking_nl_ing/i18n/pt_BR.po
+++ b/account_banking_nl_ing/i18n/pt_BR.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_nl_ing
#: code:addons/account_banking_nl_ing/ing.py:257
diff --git a/account_banking_nl_ing_mt940/__init__.py b/account_banking_nl_ing_mt940/__init__.py
new file mode 100644
index 000000000..3b6be506a
--- /dev/null
+++ b/account_banking_nl_ing_mt940/__init__.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# This module copyright (C) 2014 Therp BV ().
+#
+# 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 . import account_banking_nl_ing_mt940
diff --git a/account_banking_nl_ing_mt940/__openerp__.py b/account_banking_nl_ing_mt940/__openerp__.py
new file mode 100644
index 000000000..8eae5c53c
--- /dev/null
+++ b/account_banking_nl_ing_mt940/__openerp__.py
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# This module copyright (C) 2014 Therp BV ().
+#
+# 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" : "MT940 import for Dutch ING",
+ "version" : "1.0",
+ "author" : "Therp BV",
+ "complexity": "normal",
+ "description": """
+This addon imports the structured MT940 format as offered by the Dutch ING
+bank.
+ """,
+ "category" : "Account Banking",
+ "depends" : [
+ 'account_banking_mt940',
+ ],
+ "data" : [
+ ],
+ "js": [
+ ],
+ "css": [
+ ],
+ "qweb": [
+ ],
+ "auto_install": False,
+ "installable": True,
+ "application": False,
+ "external_dependencies" : {
+ 'python' : [],
+ },
+}
diff --git a/account_banking_nl_ing_mt940/account_banking_nl_ing_mt940.py b/account_banking_nl_ing_mt940/account_banking_nl_ing_mt940.py
new file mode 100644
index 000000000..a85ce2ff0
--- /dev/null
+++ b/account_banking_nl_ing_mt940/account_banking_nl_ing_mt940.py
@@ -0,0 +1,100 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# This module copyright (C) 2014 Therp BV ().
+#
+# 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 re
+from openerp.tools.translate import _
+from openerp.addons.account_banking.parsers.models import parser,\
+ mem_bank_transaction
+from openerp.addons.account_banking_mt940.mt940 import MT940, str2float
+
+
+class transaction(mem_bank_transaction):
+ def is_valid(self):
+ '''allow transactions without remote account'''
+ return bool(self.execution_date) and bool(self.transferred_amount)
+
+class IngMT940Parser(MT940, parser):
+ name = _('ING MT940 (structured)')
+ country_code = 'NL'
+ code = 'INT_MT940_STRUC'
+
+ tag_61_regex = re.compile(
+ '^(?P\d{6})(?P[CD])(?P\d+,\d{2})N(?P\d{3})'
+ '(?P\w{1,16})')
+
+ def create_transaction(self, cr):
+ return transaction()
+
+ def handle_tag_60F(self, cr, data):
+ super(IngMT940Parser, self).handle_tag_60F(cr, data)
+ self.current_statement.id = '%s-%s' % (
+ self.get_unique_account_identifier(
+ cr, self.current_statement.local_account),
+ self.current_statement.id)
+
+ def handle_tag_61(self, cr, data):
+ super(IngMT940Parser, self).handle_tag_61(cr, data)
+ parsed_data = self.tag_61_regex.match(data).groupdict()
+ self.current_transaction.transferred_amount = \
+ (-1 if parsed_data['sign'] == 'D' else 1) * str2float(
+ parsed_data['amount'])
+ self.current_transaction.reference = parsed_data['reference']
+
+ def handle_tag_86(self, cr, data):
+ if not self.current_transaction:
+ return
+ super(IngMT940Parser, self).handle_tag_86(cr, data)
+ codewords = ['RTRN', 'BENM', 'ORDP', 'CSID', 'BUSP', 'MARF', 'EREF',
+ 'PREF', 'REMI', 'ID', 'PURP', 'ULTB', 'ULTD']
+ subfields = {}
+ current_codeword = None
+ for word in data.split('/'):
+ if not word and not current_codeword:
+ continue
+ if word in codewords:
+ current_codeword = word
+ subfields[current_codeword] = []
+ continue
+ subfields[current_codeword].append(word)
+
+ if 'BENM' in subfields:
+ self.current_transaction.remote_account = subfields['BENM'][0]
+ self.current_transaction.remote_bank_bic = subfields['BENM'][1]
+ self.current_transaction.remote_owner = subfields['BENM'][2]
+ self.current_transaction.remote_owner_city = subfields['BENM'][3]
+
+ if 'ORDP' in subfields:
+ self.current_transaction.remote_account = subfields['ORDP'][0]
+ self.current_transaction.remote_bank_bic = subfields['ORDP'][1]
+ self.current_transaction.remote_owner = subfields['ORDP'][2]
+ self.current_transaction.remote_owner_city = subfields['ORDP'][3]
+
+ if 'REMI' in subfields:
+ self.current_transaction.message = '/'.join(
+ filter(lambda x: bool(x), subfields['REMI']))
+
+ if self.current_transaction.reference in subfields:
+ self.current_transaction.reference = ''.join(
+ subfields[self.current_transaction.reference])
+
+ if not subfields:
+ self.current_transaction.message = data
+
+ self.current_transaction = None
diff --git a/account_banking_nl_ing_mt940/static/src/img/icon.png b/account_banking_nl_ing_mt940/static/src/img/icon.png
new file mode 100644
index 000000000..4c7ab3029
Binary files /dev/null and b/account_banking_nl_ing_mt940/static/src/img/icon.png differ
diff --git a/account_banking_nl_multibank/i18n/en.po b/account_banking_nl_multibank/i18n/en.po
index 79630c748..7304f42cb 100644
--- a/account_banking_nl_multibank/i18n/en.po
+++ b/account_banking_nl_multibank/i18n/en.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_nl_multibank
#: code:addons/account_banking_nl_multibank/multibank.py:292
diff --git a/account_banking_nl_multibank/i18n/nl.po b/account_banking_nl_multibank/i18n/nl.po
index 1667ba56f..fcacea0e1 100644
--- a/account_banking_nl_multibank/i18n/nl.po
+++ b/account_banking_nl_multibank/i18n/nl.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_nl_multibank
#: code:addons/account_banking_nl_multibank/multibank.py:292
diff --git a/account_banking_nl_multibank/i18n/pt_BR.po b/account_banking_nl_multibank/i18n/pt_BR.po
index 3e9bb535e..77176f17d 100644
--- a/account_banking_nl_multibank/i18n/pt_BR.po
+++ b/account_banking_nl_multibank/i18n/pt_BR.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_nl_multibank
#: code:addons/account_banking_nl_multibank/multibank.py:292
diff --git a/account_banking_nl_triodos/i18n/en.po b/account_banking_nl_triodos/i18n/en.po
index 1352bea75..9601e842a 100644
--- a/account_banking_nl_triodos/i18n/en.po
+++ b/account_banking_nl_triodos/i18n/en.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_nl_triodos
#: code:addons/account_banking_nl_triodos/triodos.py:183
diff --git a/account_banking_nl_triodos/i18n/nl.po b/account_banking_nl_triodos/i18n/nl.po
index 822d181f4..c6eaf71a3 100644
--- a/account_banking_nl_triodos/i18n/nl.po
+++ b/account_banking_nl_triodos/i18n/nl.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_nl_triodos
#: code:addons/account_banking_nl_triodos/triodos.py:183
diff --git a/account_banking_nl_triodos/i18n/pt_BR.po b/account_banking_nl_triodos/i18n/pt_BR.po
index 121b958ff..79cfe7410 100644
--- a/account_banking_nl_triodos/i18n/pt_BR.po
+++ b/account_banking_nl_triodos/i18n/pt_BR.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_nl_triodos
#: code:addons/account_banking_nl_triodos/triodos.py:183
diff --git a/account_banking_pain_base/banking_export_pain.py b/account_banking_pain_base/banking_export_pain.py
index 5a063c5ee..279dc5f5a 100644
--- a/account_banking_pain_base/banking_export_pain.py
+++ b/account_banking_pain_base/banking_export_pain.py
@@ -295,7 +295,7 @@ class banking_export_pain(orm.AbstractModel):
party_agent_bic = etree.SubElement(
party_agent_institution, gen_args.get('bic_xml_tag'))
party_agent_bic.text = bic
- except except_orm:
+ except orm.except_orm:
if order == 'C':
if iban[0:2] != gen_args['initiating_party_country_code']:
raise orm.except_orm(
diff --git a/account_banking_pain_base/company.py b/account_banking_pain_base/company.py
index 2c238cc6a..94864d548 100644
--- a/account_banking_pain_base/company.py
+++ b/account_banking_pain_base/company.py
@@ -45,8 +45,12 @@ class res_company(orm.Model):
company = self.browse(cr, uid, company_id, context=context)
company_vat = company.vat
party_identifier = False
- if company_vat and company_vat[0:2].upper() in ['BE']:
- party_identifier = company_vat[2:].replace(' ', '')
+ if company_vat:
+ country_code = company_vat[0:2].upper()
+ if country_code == 'BE':
+ party_identifier = company_vat[2:].replace(' ', '')
+ elif country_code == 'ES':
+ party_identifier = company.sepa_creditor_identifier
return party_identifier
def _initiating_party_issuer_default(self, cr, uid, context=None):
diff --git a/account_banking_pain_base/i18n/fr.po b/account_banking_pain_base/i18n/fr.po
index 360bff594..f1be6ac5d 100644
--- a/account_banking_pain_base/i18n/fr.po
+++ b/account_banking_pain_base/i18n/fr.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_pain_base
#: field:res.company,initiating_party_issuer:0
diff --git a/account_banking_pain_base/i18n/nl.po b/account_banking_pain_base/i18n/nl.po
index 36e33db82..565dff9e6 100644
--- a/account_banking_pain_base/i18n/nl.po
+++ b/account_banking_pain_base/i18n/nl.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-12 06:27+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_pain_base
#: field:res.company,initiating_party_issuer:0
diff --git a/account_banking_partner_journal_account/i18n/nl.po b/account_banking_partner_journal_account/i18n/nl.po
index d00d02222..09768ce15 100644
--- a/account_banking_partner_journal_account/i18n/nl.po
+++ b/account_banking_partner_journal_account/i18n/nl.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_partner_journal_account
#: model:ir.model,name:account_banking_partner_journal_account.model_res_partner
diff --git a/account_banking_payment/__openerp__.py b/account_banking_payment/__openerp__.py
index 033485126..831e794ad 100644
--- a/account_banking_payment/__openerp__.py
+++ b/account_banking_payment/__openerp__.py
@@ -38,12 +38,10 @@
'view/account_payment.xml',
'view/banking_transaction_wizard.xml',
'view/payment_mode.xml',
- 'view/payment_mode_type.xml',
- 'view/payment_order_create_view.xml',
'workflow/account_payment.xml',
],
'description': '''
- This addon adds payment infrastructure to the Banking Addons.
+ This addon adds payment reconciliation infrastructure to the Banking Addons.
* Extends payments for digital banking:
+ Adapted workflow in payments to reflect banking operations
diff --git a/account_banking_payment/i18n/nl.po b/account_banking_payment/i18n/nl.po
index 862d66b0f..a6f8566e0 100644
--- a/account_banking_payment/i18n/nl.po
+++ b/account_banking_payment/i18n/nl.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_payment
#: model:ir.model,name:account_banking_payment.model_payment_order_create
diff --git a/account_banking_payment/model/__init__.py b/account_banking_payment/model/__init__.py
index cf509d816..60600f542 100644
--- a/account_banking_payment/model/__init__.py
+++ b/account_banking_payment/model/__init__.py
@@ -1,6 +1,5 @@
import account_payment
import payment_line
-import payment_mode_type
import payment_mode
import payment_order_create
import banking_import_transaction
diff --git a/account_banking_payment/model/account_payment.py b/account_banking_payment/model/account_payment.py
index bfe33fb2f..0f4763af3 100644
--- a/account_banking_payment/model/account_payment.py
+++ b/account_banking_payment/model/account_payment.py
@@ -104,18 +104,9 @@ class payment_order(orm.Model):
"execution."
)
),
- 'payment_order_type': fields.selection(
- [('payment', 'Payment'),('debit', 'Direct debit')],
- 'Payment order type', required=True,
- readonly=True, states={'draft': [('readonly', False)]},
- ),
'date_sent': fields.date('Send date', readonly=True),
}
- _defaults = {
- 'payment_order_type': 'payment',
- }
-
def _write_payment_lines(self, cr, uid, ids, **kwargs):
'''
ORM method for setting attributes of corresponding payment.line objects.
diff --git a/account_banking_payment/model/payment_mode.py b/account_banking_payment/model/payment_mode.py
index 31e1cb65b..7a3e1be98 100644
--- a/account_banking_payment/model/payment_mode.py
+++ b/account_banking_payment/model/payment_mode.py
@@ -49,8 +49,4 @@ class payment_mode(orm.Model):
help=('Limit selected invoices to invoices with these payment '
'terms')
),
- 'payment_order_type': fields.related(
- 'type', 'payment_order_type', readonly=True, type='selection',
- selection=[('payment', 'Payment'), ('debit', 'Direct debit')],
- string="Payment Order Type"),
}
diff --git a/account_banking_payment/model/payment_order_create.py b/account_banking_payment/model/payment_order_create.py
index a3d1ed9b0..7d071b44e 100644
--- a/account_banking_payment/model/payment_order_create.py
+++ b/account_banking_payment/model/payment_order_create.py
@@ -3,6 +3,7 @@
#
# Copyright (C) 2009 EduSense BV ().
# (C) 2011 - 2013 Therp BV ().
+# (C) 2014 ACSONE SA/NV ().
#
# All other contributions are (C) by their respective contributors
#
@@ -23,8 +24,7 @@
#
##############################################################################
-from openerp.osv import orm, fields
-from openerp.tools.translate import _
+from openerp.osv import orm
class payment_order_create(orm.TransientModel):
@@ -32,173 +32,13 @@ class payment_order_create(orm.TransientModel):
def extend_payment_order_domain(
self, cr, uid, payment_order, domain, context=None):
- if payment_order.payment_order_type == 'payment':
- domain += [
- ('account_id.type', '=', 'payable'),
- ('amount_to_pay', '>', 0)
- ]
- return True
-
- def search_entries(self, cr, uid, ids, context=None):
- """
- This method taken from account_payment module.
- We adapt the domain based on the payment_order_type
- """
- line_obj = self.pool.get('account.move.line')
- mod_obj = self.pool.get('ir.model.data')
- if context is None:
- context = {}
- data = self.read(cr, uid, ids, ['duedate'], context=context)[0]
- search_due_date = data['duedate']
-
- ### start account_banking_payment ###
- payment = self.pool.get('payment.order').browse(
- cr, uid, context['active_id'], context=context)
- # Search for move line to pay:
- domain = [
- ('move_id.state', '=', 'posted'),
- ('reconcile_id', '=', False),
- ('company_id', '=', payment.mode.company_id.id),
- ]
+ super(payment_order_create, self).extend_payment_order_domain(
+ cr, uid, payment_order, domain, context=context)
# apply payment term filter
- if payment.mode.payment_term_ids:
+ if payment_order.mode.payment_term_ids:
domain += [
- ('invoice.payment_term', 'in',
- [term.id for term in payment.mode.payment_term_ids]
+ ('invoice.payment_term', 'in',
+ [term.id for term in payment_order.mode.payment_term_ids]
)
]
- self.extend_payment_order_domain(
- cr, uid, payment, domain, context=context)
- ### end account_direct_debit ###
-
- domain = domain + [
- '|', ('date_maturity', '<=', search_due_date),
- ('date_maturity', '=', False)
- ]
- line_ids = line_obj.search(cr, uid, domain, context=context)
- context.update({'line_ids': line_ids})
- model_data_ids = mod_obj.search(
- cr, uid,[
- ('model', '=', 'ir.ui.view'),
- ('name', '=', 'view_create_payment_order_lines')],
- context=context)
- resource_id = mod_obj.read(
- cr, uid, model_data_ids, fields=['res_id'],
- context=context)[0]['res_id']
- return {'name': _('Entry Lines'),
- 'context': context,
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'payment.order.create',
- 'views': [(resource_id, 'form')],
- 'type': 'ir.actions.act_window',
- 'target': 'new',
- }
-
- def create_payment(self, cr, uid, ids, context=None):
- '''
- This method is a slightly modified version of the existing method on this
- model in account_payment.
- - pass the payment mode to line2bank()
- - allow invoices to create influence on the payment process: not only 'Free'
- references are allowed, but others as well
- - check date_to_pay is not in the past.
- '''
-
- order_obj = self.pool.get('payment.order')
- line_obj = self.pool.get('account.move.line')
- payment_obj = self.pool.get('payment.line')
- if context is None:
- context = {}
- data = self.read(cr, uid, ids, [], context=context)[0]
- line_ids = data['entries']
- if not line_ids:
- return {'type': 'ir.actions.act_window_close'}
-
- payment = order_obj.browse(
- cr, uid, context['active_id'], context=context)
- ### account banking
- # t = None
- # line2bank = line_obj.line2bank(cr, uid, line_ids, t, context)
- line2bank = line_obj.line2bank(
- cr, uid, line_ids, payment.mode.id, context)
- _today = fields.date.context_today(self, cr, uid, context=context)
- ### end account banking
-
- ## Finally populate the current payment with new lines:
- for line in line_obj.browse(cr, uid, line_ids, context=context):
- if payment.date_prefered == "now":
- #no payment date => immediate payment
- date_to_pay = False
- elif payment.date_prefered == 'due':
- ### account_banking
- # date_to_pay = line.date_maturity
- date_to_pay = (
- line.date_maturity
- if line.date_maturity and line.date_maturity > _today
- else False)
- ### end account banking
- elif payment.date_prefered == 'fixed':
- ### account_banking
- # date_to_pay = payment.date_scheduled
- date_to_pay = (
- payment.date_scheduled
- if payment.date_scheduled and payment.date_scheduled > _today
- else False)
- ### end account banking
-
- ### account_banking
- state = communication2 = False
- communication = line.ref or '/'
- if line.invoice:
- if line.invoice.type in ('in_invoice', 'in_refund'):
- if line.invoice.reference_type == 'structured':
- state = 'structured'
- communication = line.invoice.reference
- else:
- state = 'normal'
- communication2 = line.invoice.reference
- else:
- # Make sure that the communication includes the
- # customer invoice number (in the case of debit order)
- communication = line.invoice.number.replace('/', '')
- state = 'structured'
- if line.invoice.number != line.ref:
- communication2 = line.ref
- else:
- state = 'normal'
- communication2 = line.ref
-
- # support debit orders when enabled
- if (payment.payment_order_type == 'debit' and
- 'amount_to_receive' in line):
- amount_currency = line.amount_to_receive
- else:
- amount_currency = line.amount_to_pay
- ### end account_banking
-
- payment_obj.create(cr, uid, {
- 'move_line_id': line.id,
- 'amount_currency': amount_currency,
- 'bank_id': line2bank.get(line.id),
- 'order_id': payment.id,
- 'partner_id': line.partner_id and line.partner_id.id or False,
- ### account banking
- # 'communication': line.ref or '/'
- 'communication': communication,
- 'communication2': communication2,
- 'state': state,
- ### end account banking
- 'date': date_to_pay,
- 'currency': (line.invoice and line.invoice.currency_id.id
- or line.journal_id.currency.id
- or line.journal_id.company_id.currency_id.id),
- }, context=context)
- return {'name': _('Payment Orders'),
- 'context': context,
- 'view_type': 'form',
- 'view_mode': 'form,tree',
- 'res_model': 'payment.order',
- 'res_id': context['active_id'],
- 'type': 'ir.actions.act_window',
- }
+ return True
diff --git a/account_banking_payment/view/payment_mode.xml b/account_banking_payment/view/payment_mode.xml
index 95d250652..c46823c8d 100644
--- a/account_banking_payment/view/payment_mode.xml
+++ b/account_banking_payment/view/payment_mode.xml
@@ -11,7 +11,6 @@
-
).
# (C) 2011 - 2013 Therp BV ().
-#
+# (C) 2013 - 2014 ACSONE SA ().
+#
# All other contributions are (C) by their respective contributors
#
# All Rights Reserved
@@ -49,13 +50,17 @@
'view/bank_payment_manual.xml',
'view/payment_mode.xml',
'view/payment_mode_type.xml',
+ 'view/payment_order_create_view.xml',
'data/payment_mode_type.xml',
'security/ir.model.access.csv',
],
+ 'demo': ['demo/banking_demo.xml'],
'description': '''
- Infrastructure to export payment orders.
+ Infrastructure to export payment orders
+ plus some bug fixes and obvious enhancements to payment orders
+ that will hopefully land in offical addons one day.
- This technical module provides the base infrastructure to export
+ 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
@@ -63,7 +68,18 @@
* 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
+
+ To enable the use of payment order to collect money for customers,
+ it adds a payment_order_type (payment|debit) as a basis of direct debit support
+ (this field becomes visible when account_direct_debit is installed).
+ Refactoring note: this field should ideally go in account_direct_debit,
+ but account_banking_payment currently depends on it.
+
+ Bug fixes and enhancement that should land in official addons:
+ * make the search function of the payment export wizard extensible
+ * fix lp:1275478: allow payment of customer refunds
+ * display the maturity date of the move lines when you are in
+ the wizard to select the lines to pay
''',
- 'auto_install': True,
'installable': True,
}
diff --git a/account_banking_payment_export/demo/banking_demo.xml b/account_banking_payment_export/demo/banking_demo.xml
new file mode 100644
index 000000000..1b220f072
--- /dev/null
+++ b/account_banking_payment_export/demo/banking_demo.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+ Fortuneo Banque
+ FTNOFRP1XXX
+ 26 avenue des Champs Elysées
+ 75008
+ Paris
+
+
+
+
+ La Banque Postale
+ PSSTFRPPXXX
+ 115 rue de Sèvres
+ 75007
+ Paris
+
+
+
+
+ FR76 4242 4242 4242 4242 4242 424
+ iban
+
+
+ La Banque Postale
+ PSSTFRPPXXX
+
+
+
+ FR66 1212 1212 1212 1212 1212 121
+ iban
+
+
+ Fortuneo Banque
+ FTNOFRP1XXX
+
+
+
+
diff --git a/account_banking_payment_export/i18n/nl.po b/account_banking_payment_export/i18n/nl.po
index 615d1938b..ad83539c4 100644
--- a/account_banking_payment_export/i18n/nl.po
+++ b/account_banking_payment_export/i18n/nl.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_payment_export
#: help:payment.mode.type,name:0
diff --git a/account_banking_payment_export/model/__init__.py b/account_banking_payment_export/model/__init__.py
index 5c7e00141..ea50d43a4 100644
--- a/account_banking_payment_export/model/__init__.py
+++ b/account_banking_payment_export/model/__init__.py
@@ -1,5 +1,6 @@
+from . import account_move_line
from . import account_payment
from . import bank_payment_manual
from . import payment_mode
from . import payment_mode_type
-from . import payment_order_create
\ No newline at end of file
+from . import payment_order_create
diff --git a/account_banking_payment_export/model/account_move_line.py b/account_banking_payment_export/model/account_move_line.py
new file mode 100644
index 000000000..67c8b849d
--- /dev/null
+++ b/account_banking_payment_export/model/account_move_line.py
@@ -0,0 +1,98 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2004-2014 OpenERP S.A. (http://www.openerp.com/)
+# (C) 2014 Akretion (http://www.akretion.com/)
+#
+# 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
+from operator import itemgetter
+
+
+# All the code below aims at fixing one small issue in _to_pay_search()
+# But _to_pay_search() is the search function of the field 'amount_to_pay'
+# which is a field.function and these functions are not inheritable in OpenERP.
+# So we have to inherit the field 'amount_to_pay' and duplicate the related
+# functions
+# If the patch that I proposed in this bug report
+# https://bugs.launchpad.net/openobject-addons/+bug/1275478
+# is integrated in addons/account_payment, then we will be able to remove this
+# file. -- Alexis de Lattre
+class account_move_line(orm.Model):
+ _inherit = 'account.move.line'
+
+ def amount_to_pay(self, cr, uid, ids, name, arg=None, context=None):
+ """ Return the amount still to pay regarding all the payemnt orders
+ (excepting cancelled orders)"""
+ if not ids:
+ return {}
+ cr.execute("""SELECT ml.id,
+ CASE WHEN ml.amount_currency < 0
+ THEN - ml.amount_currency
+ ELSE ml.credit
+ END -
+ (SELECT coalesce(sum(amount_currency),0)
+ FROM payment_line pl
+ INNER JOIN payment_order po
+ ON (pl.order_id = po.id)
+ WHERE move_line_id = ml.id
+ AND po.state != 'cancel') AS amount
+ FROM account_move_line ml
+ WHERE id IN %s""", (tuple(ids),))
+ r = dict(cr.fetchall())
+ return r
+
+ def _to_pay_search(self, cr, uid, obj, name, args, context=None):
+ if not args:
+ return []
+ line_obj = self.pool.get('account.move.line')
+ query = line_obj._query_get(cr, uid, context={})
+ where = ' and '.join(map(lambda x: '''(SELECT
+ CASE WHEN l.amount_currency < 0
+ THEN - l.amount_currency
+ ELSE l.credit
+ END - coalesce(sum(pl.amount_currency), 0)
+ FROM payment_line pl
+ INNER JOIN payment_order po ON (pl.order_id = po.id)
+ WHERE move_line_id = l.id
+ AND po.state != 'cancel'
+ ) %(operator)s %%s ''' % {'operator': x[1]}, args))
+ sql_args = tuple(map(itemgetter(2), args))
+
+ cr.execute(('''SELECT id
+ FROM account_move_line l
+ WHERE account_id IN (select id
+ FROM account_account
+ WHERE type in %s AND active)
+ AND reconcile_id IS null
+ AND credit > 0
+ AND ''' + where + ' and ' + query),
+ (('payable', 'receivable'),)+sql_args )
+ # The patch we have compared to the original function in
+ # addons/account_payment is just above :
+ # original code : type = 'payable'
+ # fixed code : type in ('payable', 'receivable')
+
+ res = cr.fetchall()
+ if not res:
+ return [('id', '=', '0')]
+ return [('id', 'in', map(lambda x:x[0], res))]
+
+ _columns = {
+ 'amount_to_pay': fields.function(amount_to_pay,
+ type='float', string='Amount to pay', fnct_search=_to_pay_search),
+ }
diff --git a/account_banking_payment_export/model/account_payment.py b/account_banking_payment_export/model/account_payment.py
index e5a14e8aa..045b3d867 100644
--- a/account_banking_payment_export/model/account_payment.py
+++ b/account_banking_payment_export/model/account_payment.py
@@ -23,7 +23,7 @@
#
##############################################################################
-from openerp.osv import orm
+from openerp.osv import orm, fields
from openerp.tools.translate import _
from openerp import netsvc
@@ -31,6 +31,18 @@ from openerp import netsvc
class payment_order(orm.Model):
_inherit = 'payment.order'
+ _columns = {
+ 'payment_order_type': fields.selection(
+ [('payment', 'Payment'), ('debit', 'Direct debit')],
+ 'Payment order type', required=True,
+ readonly=True, states={'draft': [('readonly', False)]},
+ ),
+ }
+
+ _defaults = {
+ 'payment_order_type': 'payment',
+ }
+
def launch_wizard(self, cr, uid, ids, context=None):
"""
Search for a wizard to launch according to the type.
diff --git a/account_banking_payment_export/model/payment_mode.py b/account_banking_payment_export/model/payment_mode.py
index 0d85d3aa3..798c8ed20 100644
--- a/account_banking_payment_export/model/payment_mode.py
+++ b/account_banking_payment_export/model/payment_mode.py
@@ -49,4 +49,8 @@ class payment_mode(orm.Model):
required=True,
help='Select the Payment Type for the Payment Mode.'
),
+ 'payment_order_type': fields.related(
+ 'type', 'payment_order_type', readonly=True, type='selection',
+ selection=[('payment', 'Payment'), ('debit', 'Direct debit')],
+ string="Payment Order Type"),
}
diff --git a/account_banking_payment_export/model/payment_mode_type.py b/account_banking_payment_export/model/payment_mode_type.py
index dbc60d5ab..a50e56a85 100644
--- a/account_banking_payment_export/model/payment_mode_type.py
+++ b/account_banking_payment_export/model/payment_mode_type.py
@@ -41,7 +41,7 @@ class payment_mode_type(orm.Model):
'suitable_bank_types': fields.many2many(
'res.partner.bank.type',
'bank_type_payment_type_rel',
- 'pay_type_id','bank_type_id',
+ 'pay_type_id', 'bank_type_id',
'Suitable bank types', required=True),
'ir_model_id': fields.many2one(
'ir.model', 'Payment wizard',
@@ -49,8 +49,16 @@ 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',
+ }
+
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
diff --git a/account_banking_payment_export/model/payment_order_create.py b/account_banking_payment_export/model/payment_order_create.py
index 278d4327a..5dffe24e1 100644
--- a/account_banking_payment_export/model/payment_order_create.py
+++ b/account_banking_payment_export/model/payment_order_create.py
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
##############################################################################
#
-# Copyright (C) 2013 ACSONE SA/NV ();.
+# Copyright (C) 2009 EduSense BV ().
+# (C) 2011 - 2013 Therp BV ().
#
# All other contributions are (C) by their respective contributors
#
@@ -22,37 +23,176 @@
#
##############################################################################
-from openerp.osv import orm
+from openerp.osv import orm, fields
+from openerp.tools.translate import _
class payment_order_create(orm.TransientModel):
_inherit = 'payment.order.create'
+ def extend_payment_order_domain(
+ self, cr, uid, payment_order, domain, context=None):
+ if payment_order.payment_order_type == 'payment':
+ domain += [
+ ('account_id.type', 'in', ('payable', 'receivable')),
+ ('amount_to_pay', '>', 0)
+ ]
+ return True
+
+ def search_entries(self, cr, uid, ids, context=None):
+ """
+ This method taken from account_payment module.
+ We adapt the domain based on the payment_order_type
+ """
+ line_obj = self.pool.get('account.move.line')
+ mod_obj = self.pool.get('ir.model.data')
+ if context is None:
+ context = {}
+ data = self.read(cr, uid, ids, ['duedate'], context=context)[0]
+ search_due_date = data['duedate']
+
+ ### start account_banking_payment ###
+ payment = self.pool.get('payment.order').browse(
+ cr, uid, context['active_id'], context=context)
+ # Search for move line to pay:
+ domain = [
+ ('move_id.state', '=', 'posted'),
+ ('reconcile_id', '=', False),
+ ('company_id', '=', payment.mode.company_id.id),
+ ]
+ self.extend_payment_order_domain(
+ cr, uid, payment, domain, context=context)
+ ### end account_direct_debit ###
+
+ domain = domain + [
+ '|', ('date_maturity', '<=', search_due_date),
+ ('date_maturity', '=', False)
+ ]
+ line_ids = line_obj.search(cr, uid, domain, context=context)
+ context.update({'line_ids': line_ids})
+ model_data_ids = mod_obj.search(
+ cr, uid,[
+ ('model', '=', 'ir.ui.view'),
+ ('name', '=', 'view_create_payment_order_lines')],
+ context=context)
+ resource_id = mod_obj.read(
+ cr, uid, model_data_ids, fields=['res_id'],
+ context=context)[0]['res_id']
+ return {'name': _('Entry Lines'),
+ 'context': context,
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'payment.order.create',
+ 'views': [(resource_id, 'form')],
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ }
+
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 = {}
+ This method is a slightly modified version of the existing method on this
+ model in account_payment.
+ - pass the payment mode to line2bank()
+ - allow invoices to create influence on the payment process: not only 'Free'
+ references are allowed, but others as well
+ - check date_to_pay is not in the past.
+ '''
+
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'''
+ line_obj = self.pool.get('account.move.line')
+ payment_obj = self.pool.get('payment.line')
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)
+ data = self.read(cr, uid, ids, [], context=context)[0]
+ line_ids = data['entries']
+ if not line_ids:
+ return {'type': 'ir.actions.act_window_close'}
+ payment = order_obj.browse(
+ cr, uid, context['active_id'], context=context)
+ ### account banking
+ # t = None
+ # line2bank = line_obj.line2bank(cr, uid, line_ids, t, context)
+ line2bank = line_obj.line2bank(
+ cr, uid, line_ids, payment.mode.id, context)
+ _today = fields.date.context_today(self, cr, uid, context=context)
+ ### end account banking
+
+ ## Finally populate the current payment with new lines:
+ for line in line_obj.browse(cr, uid, line_ids, context=context):
+ if payment.date_prefered == "now":
+ #no payment date => immediate payment
+ date_to_pay = False
+ elif payment.date_prefered == 'due':
+ ### account_banking
+ # date_to_pay = line.date_maturity
+ date_to_pay = (
+ line.date_maturity
+ if line.date_maturity and line.date_maturity > _today
+ else False)
+ ### end account banking
+ elif payment.date_prefered == 'fixed':
+ ### account_banking
+ # date_to_pay = payment.date_scheduled
+ date_to_pay = (
+ payment.date_scheduled
+ if payment.date_scheduled and payment.date_scheduled > _today
+ else False)
+ ### end account banking
+
+ ### account_banking
+ state = communication2 = False
+ communication = line.ref or '/'
+ if line.invoice:
+ if line.invoice.type in ('in_invoice', 'in_refund'):
+ if line.invoice.reference_type == 'structured':
+ state = 'structured'
+ communication = line.invoice.reference
+ else:
+ state = 'normal'
+ communication2 = line.invoice.reference
+ else:
+ # Make sure that the communication includes the
+ # customer invoice number (in the case of debit order)
+ communication = line.invoice.number.replace('/', '')
+ state = 'structured'
+ if line.invoice.number != line.ref:
+ communication2 = line.ref
+ else:
+ state = 'normal'
+ communication2 = line.ref
+
+ # support debit orders when enabled
+ if (payment.payment_order_type == 'debit' and
+ 'amount_to_receive' in line):
+ amount_currency = line.amount_to_receive
+ else:
+ amount_currency = line.amount_to_pay
+ ### end account_banking
+
+ payment_obj.create(cr, uid, {
+ 'move_line_id': line.id,
+ 'amount_currency': amount_currency,
+ 'bank_id': line2bank.get(line.id),
+ 'order_id': payment.id,
+ 'partner_id': line.partner_id and line.partner_id.id or False,
+ ### account banking
+ # 'communication': line.ref or '/'
+ 'communication': communication,
+ 'communication2': communication2,
+ 'state': state,
+ ### end account banking
+ 'date': date_to_pay,
+ 'currency': (line.invoice and line.invoice.currency_id.id
+ or line.journal_id.currency.id
+ or line.journal_id.company_id.currency_id.id),
+ }, context=context)
+ # Force reload of payment order view as a workaround for lp:1155525
+ return {'name': _('Payment Orders'),
+ 'context': context,
+ 'view_type': 'form',
+ 'view_mode': 'form,tree',
+ 'res_model': 'payment.order',
+ 'res_id': context['active_id'],
+ 'type': 'ir.actions.act_window',
+ }
diff --git a/account_banking_payment/view/payment_order_create_view.xml b/account_banking_payment_export/view/payment_order_create_view.xml
similarity index 100%
rename from account_banking_payment/view/payment_order_create_view.xml
rename to account_banking_payment_export/view/payment_order_create_view.xml
diff --git a/account_banking_sepa_credit_transfer/__openerp__.py b/account_banking_sepa_credit_transfer/__openerp__.py
index 762ede89e..9b0521aea 100644
--- a/account_banking_sepa_credit_transfer/__openerp__.py
+++ b/account_banking_sepa_credit_transfer/__openerp__.py
@@ -36,6 +36,7 @@
'data/payment_type_sepa_sct.xml',
'security/ir.model.access.csv',
],
+ 'demo': ['sepa_credit_transfer_demo.xml'],
'description': '''
Module to export payment orders in SEPA XML file format.
diff --git a/account_banking_sepa_credit_transfer/i18n/fr.po b/account_banking_sepa_credit_transfer/i18n/fr.po
index 7c3e39b02..51fe915a3 100644
--- a/account_banking_sepa_credit_transfer/i18n/fr.po
+++ b/account_banking_sepa_credit_transfer/i18n/fr.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_sepa_credit_transfer
#: selection:banking.export.sepa.wizard,state:0
diff --git a/account_banking_sepa_credit_transfer/i18n/nl.po b/account_banking_sepa_credit_transfer/i18n/nl.po
index f20a91a56..07bebebdd 100644
--- a/account_banking_sepa_credit_transfer/i18n/nl.po
+++ b/account_banking_sepa_credit_transfer/i18n/nl.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_sepa_credit_transfer
#: selection:banking.export.sepa.wizard,state:0
diff --git a/account_banking_sepa_credit_transfer/sepa_credit_transfer_demo.xml b/account_banking_sepa_credit_transfer/sepa_credit_transfer_demo.xml
new file mode 100644
index 000000000..77abf1b34
--- /dev/null
+++ b/account_banking_sepa_credit_transfer/sepa_credit_transfer_demo.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+ SEPA Credit Transfer La Banque Postale
+
+
+
+
+
+
+
+
diff --git a/account_banking_sepa_direct_debit/__openerp__.py b/account_banking_sepa_direct_debit/__openerp__.py
index 95ac05413..cd603fc03 100644
--- a/account_banking_sepa_direct_debit/__openerp__.py
+++ b/account_banking_sepa_direct_debit/__openerp__.py
@@ -44,6 +44,7 @@
'data/mandate_reference_sequence.xml',
'security/ir.model.access.csv',
],
+ 'demo': ['sepa_direct_debit_demo.xml'],
'description': '''
Module to export direct debit payment orders in SEPA XML file format.
diff --git a/account_banking_sepa_direct_debit/data/payment_type_sdd.xml b/account_banking_sepa_direct_debit/data/payment_type_sdd.xml
index fcc742531..a17b3b21c 100644
--- a/account_banking_sepa_direct_debit/data/payment_type_sdd.xml
+++ b/account_banking_sepa_direct_debit/data/payment_type_sdd.xml
@@ -1,9 +1,8 @@
-
+
-
SEPA Direct Debit v02 (recommended)
pain.008.001.02
@@ -32,6 +31,5 @@
-
diff --git a/account_banking_sepa_direct_debit/i18n/fr.po b/account_banking_sepa_direct_debit/i18n/fr.po
index 6620d99b0..909b98fc9 100644
--- a/account_banking_sepa_direct_debit/i18n/fr.po
+++ b/account_banking_sepa_direct_debit/i18n/fr.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_sepa_direct_debit
#: model:mail.message.subtype,description:account_banking_sepa_direct_debit.mandate_valid
diff --git a/account_banking_sepa_direct_debit/i18n/nl.po b/account_banking_sepa_direct_debit/i18n/nl.po
index 350697926..80ad8242f 100644
--- a/account_banking_sepa_direct_debit/i18n/nl.po
+++ b/account_banking_sepa_direct_debit/i18n/nl.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-12 06:27+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_banking_sepa_direct_debit
#: model:mail.message.subtype,description:account_banking_sepa_direct_debit.mandate_valid
diff --git a/account_banking_sepa_direct_debit/sdd_mandate_view.xml b/account_banking_sepa_direct_debit/sdd_mandate_view.xml
index d86f74f5b..409919dc5 100644
--- a/account_banking_sepa_direct_debit/sdd_mandate_view.xml
+++ b/account_banking_sepa_direct_debit/sdd_mandate_view.xml
@@ -97,7 +97,7 @@
diff --git a/account_banking_sepa_direct_debit/sepa_direct_debit_demo.xml b/account_banking_sepa_direct_debit/sepa_direct_debit_demo.xml
new file mode 100644
index 000000000..220261088
--- /dev/null
+++ b/account_banking_sepa_direct_debit/sepa_direct_debit_demo.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+ SEPA Direct Debit La Banque Postale
+
+
+
+
+
+
+
+ FR78ZZZ424242
+
+
+
+
+ recurrent
+ first
+ 2014-02-01
+ valid
+
+
+
+
diff --git a/account_banking_tests/__openerp__.py b/account_banking_tests/__openerp__.py
index 59eff6ce9..04e3fdd70 100644
--- a/account_banking_tests/__openerp__.py
+++ b/account_banking_tests/__openerp__.py
@@ -37,6 +37,5 @@ dependencies installed, so that you can run the tests. If you only
run the tests manually, you don't even have to install this module,
only its dependencies.
''',
- 'auto_install': False,
'installable': True,
}
diff --git a/account_direct_debit/__openerp__.py b/account_direct_debit/__openerp__.py
index 5cc16dcac..12fa1d227 100644
--- a/account_direct_debit/__openerp__.py
+++ b/account_direct_debit/__openerp__.py
@@ -25,10 +25,12 @@
'author': ['Therp BV', 'Smile'],
'website': 'https://launchpad.net/banking-addons',
'category': 'Banking addons',
- 'depends': ['account_banking_payment'],
+ 'depends': ['account_banking_payment_export'],
'data': [
'view/account_payment.xml',
'view/account_invoice.xml',
+ 'view/payment_mode.xml',
+ 'view/payment_mode_type.xml',
'workflow/account_invoice.xml',
'data/account_payment_term.xml',
],
diff --git a/account_direct_debit/i18n/nl.po b/account_direct_debit/i18n/nl.po
index 77e7b0b2d..7f2c26bf1 100644
--- a/account_direct_debit/i18n/nl.po
+++ b/account_direct_debit/i18n/nl.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_direct_debit
#: model:account.payment.term,note:account_direct_debit.payment_term_direct_debit
diff --git a/account_direct_debit/model/account_move_line.py b/account_direct_debit/model/account_move_line.py
index a90c2945a..4cd7fab6c 100644
--- a/account_direct_debit/model/account_move_line.py
+++ b/account_direct_debit/model/account_move_line.py
@@ -27,7 +27,7 @@ class account_move_line(orm.Model):
_inherit = "account.move.line"
def amount_to_receive(self, cr, uid, ids, name, arg={}, context=None):
- """
+ """
Return the amount still to receive regarding all the debit orders
(excepting canceled orders).
This is the reverse from amount_to_pay() in
@@ -87,7 +87,7 @@ class account_move_line(orm.Model):
return [('id', '=', '0')]
return [('id', 'in', map(lambda x:x[0], res))]
- def line2bank(self, cr, uid, ids, payment_mode_id=None, context=None):
+ def line2bank(self, cr, uid, ids, payment_mode_id, context=None):
'''I have to inherit this function for direct debits to fix the
following issue : if the customer invoice has a value for
'partner_bank_id', then it will take this partner_bank_id
@@ -98,8 +98,6 @@ class account_move_line(orm.Model):
if context is None:
context = {}
pay_mode_obj = self.pool['payment.mode']
- payment_mode_id = (
- payment_mode_id or context.get('_fix_payment_mode_id'))
if payment_mode_id:
pay_mode = pay_mode_obj.browse(
cr, uid, payment_mode_id, context=context)
@@ -116,7 +114,7 @@ class account_move_line(orm.Model):
break
return line2bank
return super(account_move_line, self).line2bank(
- cr, uid, ids, payment_mode_id=payment_mode_id, context=context)
+ cr, uid, ids, payment_mode_id, context=context)
_columns = {
'amount_to_receive': fields.function(
diff --git a/account_direct_debit/view/payment_mode.xml b/account_direct_debit/view/payment_mode.xml
new file mode 100644
index 000000000..043990df0
--- /dev/null
+++ b/account_direct_debit/view/payment_mode.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+ payment.mode.form.inherit
+ payment.mode
+
+
+
+
+
+
+
+
+
+
diff --git a/account_banking_payment/view/payment_mode_type.xml b/account_direct_debit/view/payment_mode_type.xml
similarity index 83%
rename from account_banking_payment/view/payment_mode_type.xml
rename to account_direct_debit/view/payment_mode_type.xml
index eb8ce821a..eb726750d 100644
--- a/account_banking_payment/view/payment_mode_type.xml
+++ b/account_direct_debit/view/payment_mode_type.xml
@@ -2,6 +2,9 @@
+
view.payment.mode.type.form
payment.mode.type
diff --git a/account_iban_preserve_domestic/i18n/nl.po b/account_iban_preserve_domestic/i18n/nl.po
index 7ecd6b88e..ad1c296e9 100644
--- a/account_iban_preserve_domestic/i18n/nl.po
+++ b/account_iban_preserve_domestic/i18n/nl.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_iban_preserve_domestic
#: field:res.partner.bank,acc_number_domestic:0
diff --git a/account_iban_preserve_domestic/i18n/pt_BR.po b/account_iban_preserve_domestic/i18n/pt_BR.po
index c925a3bff..2db6c6e38 100644
--- a/account_iban_preserve_domestic/i18n/pt_BR.po
+++ b/account_iban_preserve_domestic/i18n/pt_BR.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: account_iban_preserve_domestic
#: field:res.partner.bank,acc_number_domestic:0
diff --git a/account_payment_shortcut/__init__.py b/account_payment_shortcut/__init__.py
index e1873cda0..c9dbb3cf6 100644
--- a/account_payment_shortcut/__init__.py
+++ b/account_payment_shortcut/__init__.py
@@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
-import payment_order
+from . import payment_order
diff --git a/account_payment_shortcut/__openerp__.py b/account_payment_shortcut/__openerp__.py
index 830e37931..30e3acc72 100644
--- a/account_payment_shortcut/__openerp__.py
+++ b/account_payment_shortcut/__openerp__.py
@@ -20,7 +20,7 @@
##############################################################################
{
'name': 'Account Payment Invoice Selection Shortcut',
- 'version': '6.1.1.134',
+ 'version': '1.134',
'license': 'AGPL-3',
'author': 'Smile / Therp BV',
'website': 'https://launchpad.net/banking-addons',
diff --git a/account_payment_shortcut/payment_order.py b/account_payment_shortcut/payment_order.py
index 68523325d..93dfb125b 100644
--- a/account_payment_shortcut/payment_order.py
+++ b/account_payment_shortcut/payment_order.py
@@ -22,7 +22,7 @@
#
##############################################################################
-from osv import orm
+from openerp.osv import orm
class payment_order_create(orm.TransientModel):
_inherit = 'payment.order.create'
diff --git a/base_iban_bic_not_required/i18n/nl.po b/base_iban_bic_not_required/i18n/nl.po
index 952a8fc47..de8b0bf3f 100644
--- a/base_iban_bic_not_required/i18n/nl.po
+++ b/base_iban_bic_not_required/i18n/nl.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: base_iban_bic_not_required
#: constraint:res.partner.bank:0
diff --git a/base_iban_bic_not_required/i18n/pt_BR.po b/base_iban_bic_not_required/i18n/pt_BR.po
index 1f54e846c..3931c2310 100644
--- a/base_iban_bic_not_required/i18n/pt_BR.po
+++ b/base_iban_bic_not_required/i18n/pt_BR.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-02-11 06:47+0000\n"
-"X-Generator: Launchpad (build 16916)\n"
+"X-Launchpad-Export-Date: 2014-03-08 06:59+0000\n"
+"X-Generator: Launchpad (build 16948)\n"
#. module: base_iban_bic_not_required
#: constraint:res.partner.bank:0