← Back to team overview

banking-addons-team team mailing list archive

[Merge] lp:~therp-nl/banking-addons/7.0-fix_post_date_vs_value_date_confusion into lp:banking-addons

 

Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/banking-addons/7.0-fix_post_date_vs_value_date_confusion into lp:banking-addons.

Requested reviews:
  Banking Addons Core Editors (banking-addons-team)

For more details, see:
https://code.launchpad.net/~therp-nl/banking-addons/7.0-fix_post_date_vs_value_date_confusion/+merge/206683

Disambiguate the terminology concerning post date and value date. The only import filter that distinguished both dates was HBSC, which assigned value date to 'effective_date'. The recent CAMT filter copied this behaviour but as it turns out, the meaning of the value date (or rather the post date) was not honoured in processing the statement lines.

This branch implements using the post date for basically everything: statement line date, base date for determining statement reference, lookup of reconcilable items. To avoid further confusion, I'm applying the well known 'value date' terminology to the column name (migration included).

A basic fix for 6.1, without the column rename is here: https://code.launchpad.net/~therp-nl/banking-addons/6.1-fix_post_date_vs_value_date_confusion/+merge/206684
-- 
https://code.launchpad.net/~therp-nl/banking-addons/7.0-fix_post_date_vs_value_date_confusion/+merge/206683
Your team Banking Addons Core Editors is requested to review the proposed merge of lp:~therp-nl/banking-addons/7.0-fix_post_date_vs_value_date_confusion into lp:banking-addons.
=== modified file 'account_banking/__openerp__.py'
--- account_banking/__openerp__.py	2013-12-10 07:06:28 +0000
+++ account_banking/__openerp__.py	2014-02-17 10:51:01 +0000
@@ -26,7 +26,7 @@
 
 {
     'name': 'Account Banking',
-    'version': '0.1.136',
+    'version': '0.2.0',
     'license': 'AGPL-3',
     'author': 'Banking addons community',
     'website': 'https://launchpad.net/banking-addons',

=== modified file 'account_banking/banking_import_transaction.py'
--- account_banking/banking_import_transaction.py	2014-01-21 07:55:55 +0000
+++ account_banking/banking_import_transaction.py	2014-02-17 10:51:01 +0000
@@ -74,7 +74,7 @@
             ('type', '=', 'in_invoice'),
             ('partner_id', 'child_of', account_info.bank_partner_id.id),
             ('company_id', '=', account_info.company_id.id),
-            ('date_invoice', '=', trans.effective_date),
+            ('date_invoice', '=', trans.execution_date),
             ('reference', '=', reference),
             ('amount_total', '=', amount),
             ]
@@ -101,7 +101,7 @@
                 period_id = period_id,
                 journal_id = account_info.invoice_journal_id.id,
                 account_id = account_info.bank_partner_id.property_account_payable.id,
-                date_invoice = trans.effective_date,
+                date_invoice = trans.execution_date,
                 reference_type = 'none',
                 reference = reference,
                 name = trans.reference or trans.message,
@@ -943,7 +943,7 @@
 
             # Link accounting period
             period_id = banktools.get_period(
-                self.pool, cr, uid, transaction.effective_date,
+                self.pool, cr, uid, transaction.execution_date,
                 company, results['log'])
             if not period_id:
                 results['trans_skipped_cnt'] += 1
@@ -959,7 +959,7 @@
             else:
                 values = {
                     'name': '%s.%s' % (transaction.statement, transaction.transaction),
-                    'date': transaction.effective_date,
+                    'date': transaction.execution_date,
                     'amount': transaction.transferred_amount,
                     'statement_id': transaction.statement_id.id,
                     'note': transaction.message,
@@ -1290,8 +1290,8 @@
         'reference': fields.char('reference', size=1024),
         'local_account': fields.char('local_account', size=24),
         'local_currency': fields.char('local_currency', size=16),
-        'execution_date': fields.date('execution_date'),
-        'effective_date': fields.date('effective_date'),
+        'execution_date': fields.date('Posted date'),
+        'value_date': fields.date('Value date'),
         'remote_account': fields.char('remote_account', size=24),
         'remote_currency': fields.char('remote_currency', size=16),
         'exchange_rate': fields.float('exchange_rate'),

=== modified file 'account_banking/i18n/account_banking.pot'
--- account_banking/i18n/account_banking.pot	2013-11-13 08:13:18 +0000
+++ account_banking/i18n/account_banking.pot	2014-02-17 10:51:01 +0000
@@ -288,7 +288,7 @@
 
 #. module: account_banking
 #: field:banking.import.transaction,execution_date:0
-msgid "execution_date"
+msgid "Posted date"
 msgstr ""
 
 #. module: account_banking
@@ -785,8 +785,8 @@
 msgstr ""
 
 #. module: account_banking
-#: field:banking.import.transaction,effective_date:0
-msgid "effective_date"
+#: field:banking.import.transaction,value_date:0
+msgid "Value date"
 msgstr ""
 
 #. module: account_banking

=== modified file 'account_banking/i18n/da.po'
--- account_banking/i18n/da.po	2014-02-11 06:47:45 +0000
+++ account_banking/i18n/da.po	2014-02-17 10:51:01 +0000
@@ -801,8 +801,8 @@
 msgstr ""
 
 #. module: account_banking
-#: field:banking.import.transaction,effective_date:0
-msgid "effective_date"
+#: field:banking.import.transaction,value_date:0
+msgid "value_date"
 msgstr ""
 
 #. module: account_banking

=== modified file 'account_banking/i18n/en.po'
--- account_banking/i18n/en.po	2014-02-11 06:47:45 +0000
+++ account_banking/i18n/en.po	2014-02-17 10:51:01 +0000
@@ -807,8 +807,8 @@
 msgstr ""
 
 #. module: account_banking
-#: field:banking.import.transaction,effective_date:0
-msgid "effective_date"
+#: field:banking.import.transaction,value_date:0
+msgid "value_date"
 msgstr ""
 
 #. module: account_banking

=== modified file 'account_banking/i18n/es_ES.po'
--- account_banking/i18n/es_ES.po	2014-02-11 06:47:45 +0000
+++ account_banking/i18n/es_ES.po	2014-02-17 10:51:01 +0000
@@ -801,8 +801,8 @@
 msgstr ""
 
 #. module: account_banking
-#: field:banking.import.transaction,effective_date:0
-msgid "effective_date"
+#: field:banking.import.transaction,value_date:0
+msgid "value_date"
 msgstr ""
 
 #. module: account_banking

=== modified file 'account_banking/i18n/hr.po'
--- account_banking/i18n/hr.po	2014-02-11 06:47:45 +0000
+++ account_banking/i18n/hr.po	2014-02-17 10:51:01 +0000
@@ -807,8 +807,8 @@
 msgstr ""
 
 #. module: account_banking
-#: field:banking.import.transaction,effective_date:0
-msgid "effective_date"
+#: field:banking.import.transaction,value_date:0
+msgid "value_date"
 msgstr ""
 
 #. module: account_banking

=== modified file 'account_banking/i18n/hu.po'
--- account_banking/i18n/hu.po	2014-02-11 06:47:45 +0000
+++ account_banking/i18n/hu.po	2014-02-17 10:51:01 +0000
@@ -814,8 +814,8 @@
 msgstr ""
 
 #. module: account_banking
-#: field:banking.import.transaction,effective_date:0
-msgid "effective_date"
+#: field:banking.import.transaction,value_date:0
+msgid "value_date"
 msgstr ""
 
 #. module: account_banking

=== modified file 'account_banking/i18n/nb.po'
--- account_banking/i18n/nb.po	2014-02-11 06:47:45 +0000
+++ account_banking/i18n/nb.po	2014-02-17 10:51:01 +0000
@@ -801,8 +801,8 @@
 msgstr ""
 
 #. module: account_banking
-#: field:banking.import.transaction,effective_date:0
-msgid "effective_date"
+#: field:banking.import.transaction,value_date:0
+msgid "value_date"
 msgstr ""
 
 #. module: account_banking

=== modified file 'account_banking/i18n/nl.po'
--- account_banking/i18n/nl.po	2014-02-11 06:47:45 +0000
+++ account_banking/i18n/nl.po	2014-02-17 10:51:01 +0000
@@ -301,8 +301,8 @@
 
 #. module: account_banking
 #: field:banking.import.transaction,execution_date:0
-msgid "execution_date"
-msgstr "execution_date"
+msgid "Posted date"
+msgstr "Boekdatum"
 
 #. module: account_banking
 #: field:banking.import.line,account_id:0
@@ -822,9 +822,9 @@
 msgstr "Betaalverschil"
 
 #. module: account_banking
-#: field:banking.import.transaction,effective_date:0
-msgid "effective_date"
-msgstr "effective_date"
+#: field:banking.import.transaction,value_date:0
+msgid "Value date"
+msgstr "valutadatum"
 
 #. module: account_banking
 #: view:account.bank.statement.line:0

=== modified file 'account_banking/i18n/pt_BR.po'
--- account_banking/i18n/pt_BR.po	2014-02-11 06:47:45 +0000
+++ account_banking/i18n/pt_BR.po	2014-02-17 10:51:01 +0000
@@ -801,8 +801,8 @@
 msgstr ""
 
 #. module: account_banking
-#: field:banking.import.transaction,effective_date:0
-msgid "effective_date"
+#: field:banking.import.transaction,value_date:0
+msgid "value_date"
 msgstr ""
 
 #. module: account_banking

=== modified file 'account_banking/i18n/ro.po'
--- account_banking/i18n/ro.po	2014-02-11 06:47:45 +0000
+++ account_banking/i18n/ro.po	2014-02-17 10:51:01 +0000
@@ -801,8 +801,8 @@
 msgstr ""
 
 #. module: account_banking
-#: field:banking.import.transaction,effective_date:0
-msgid "effective_date"
+#: field:banking.import.transaction,value_date:0
+msgid "value_date"
 msgstr ""
 
 #. module: account_banking

=== modified file 'account_banking/i18n/tr.po'
--- account_banking/i18n/tr.po	2014-02-11 06:47:45 +0000
+++ account_banking/i18n/tr.po	2014-02-17 10:51:01 +0000
@@ -801,8 +801,8 @@
 msgstr ""
 
 #. module: account_banking
-#: field:banking.import.transaction,effective_date:0
-msgid "effective_date"
+#: field:banking.import.transaction,value_date:0
+msgid "value_date"
 msgstr ""
 
 #. module: account_banking

=== added directory 'account_banking/migrations/7.0.0.2'
=== added file 'account_banking/migrations/7.0.0.2/pre-migration.py'
--- account_banking/migrations/7.0.0.2/pre-migration.py	1970-01-01 00:00:00 +0000
+++ account_banking/migrations/7.0.0.2/pre-migration.py	2014-02-17 10:51:01 +0000
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2014 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
+
+    # Rename value date column
+    cr.execute(
+        """
+        ALTER TABLE banking_import_transaction
+        RENAME COLUMN effective_date TO value_date
+        """)

=== modified file 'account_banking/parsers/models.py'
--- account_banking/parsers/models.py	2014-01-05 02:07:34 +0000
+++ account_banking/parsers/models.py	2014-02-17 10:51:01 +0000
@@ -86,10 +86,10 @@
         # The currency the bank used to process the transferred amount
 
         'execution_date',
-        # The requested execution date of the action - order date if you like
+        # The posted date of the action
 
-        'effective_date',
-        # The real execution date of the action
+        'value_date',
+        # The value date of the action
 
         'remote_account',
         # The account of the other party

=== modified file 'account_banking_camt/camt.py'
--- account_banking_camt/camt.py	2013-10-11 12:20:14 +0000
+++ account_banking_camt/camt.py	2014-02-17 10:51:01 +0000
@@ -182,7 +182,7 @@
         """
         entry_details = {
             'execution_date': self.xpath(node, './ns:BookgDt/ns:Dt')[0].text,
-            'effective_date': self.xpath(node, './ns:ValDt/ns:Dt')[0].text,
+            'value_date': self.xpath(node, './ns:ValDt/ns:Dt')[0].text,
             'transfer_type': self.get_transfer_type(node),
             'transferred_amount': self.parse_amount(node)
             }

=== modified file 'account_banking_fi_patu/patu.py'
--- account_banking_fi_patu/patu.py	2013-04-15 13:59:50 +0000
+++ account_banking_fi_patu/patu.py	2014-02-17 10:51:01 +0000
@@ -39,7 +39,7 @@
             "remote_currency": "currency",
             "transferred_amount": "amount",
             "execution_date": "recorddate",
-            "effective_date": "paymentdate",
+            "value_date": "paymentdate",
             "transfer_type": "eventtype",
             "reference": "refnr",
             "eventcode": "eventcode",

=== modified file 'account_banking_nl_abnamro/abnamro.py'
--- account_banking_nl_abnamro/abnamro.py	2013-10-02 08:56:55 +0000
+++ account_banking_nl_abnamro/abnamro.py	2014-02-17 10:51:01 +0000
@@ -67,9 +67,9 @@
         self.transferred_amount = float(
             self.transferred_amount.replace(',', '.'))
         self.execution_date = str2date(self.date, '%Y%m%d')
-        self.effective_date = str2date(self.date, '%Y%m%d')
+        self.value_date = str2date(self.date, '%Y%m%d')
         # Set statement_id based on week number
-        self.statement_id = self.effective_date.strftime('%Yw%W')
+        self.statement_id = self.execution_date.strftime('%Yw%W')
         self.id = str(subno).zfill(4)
 
 class transaction(models.mem_bank_transaction):
@@ -77,7 +77,7 @@
     Implementation of transaction communication class for account_banking.
     '''
     attrnames = ['local_account', 'local_currency', 'transferred_amount',
-                 'blob', 'execution_date', 'effective_date', 'id',
+                 'blob', 'execution_date', 'value_date', 'id',
                 ]
 
     type_map = {
@@ -369,7 +369,7 @@
             msg = transaction_message(line, subno)
             if not statement_id:
                 statement_id = self.get_unique_statement_id(
-                    cr, msg.effective_date.strftime('%Yw%W'))
+                    cr, msg.execution_date.strftime('%Yw%W'))
             msg.statement_id = statement_id
             if stmnt:
                 stmnt.import_transaction(msg)

=== modified file 'account_banking_nl_girotel/girotel.py'
--- account_banking_nl_girotel/girotel.py	2013-08-02 12:51:00 +0000
+++ account_banking_nl_girotel/girotel.py	2014-02-17 10:51:01 +0000
@@ -120,7 +120,7 @@
             self.remote_account = self.remote_account.zfill(10)
         else:
             self.remote_account = False
-        self.execution_date = self.effective_date = self.date
+        self.execution_date = self.value_date = self.date
         self.remote_owner = self.remote_owner.rstrip()
         self.message = self.message.rstrip()
         self.genid()
@@ -137,7 +137,7 @@
     '''
     attrnames = [ 'statement_id', 'remote_account', 'remote_owner',
                  'remote_currency', 'transferred_amount', 'execution_date',
-                 'effective_date', 'transfer_type', 'message',
+                 'value_date', 'transfer_type', 'message',
                 ]
 
     type_map = {

=== modified file 'account_banking_nl_ing/ing.py'
--- account_banking_nl_ing/ing.py	2013-06-05 12:30:03 +0000
+++ account_banking_nl_ing/ing.py	2014-02-17 10:51:01 +0000
@@ -68,10 +68,10 @@
         if self.debcred == 'Af':
             self.transferred_amount = -self.transferred_amount
         try:
-            self.execution_date = self.effective_date = str2date(self.date, '%Y%m%d')
+            self.execution_date = self.value_date = str2date(self.date, '%Y%m%d')
         except ValueError:
-            self.execution_date = self.effective_date = str2date(self.date, '%d-%m-%Y')
-        self.statement_id = '' #self.effective_date.strftime('%Yw%W')
+            self.execution_date = self.value_date = str2date(self.date, '%d-%m-%Y')
+        self.statement_id = '' #self.value_date.strftime('%Yw%W')
         self.id = str(subno).zfill(4)
         self.reference = ''
         # Normalize basic account numbers
@@ -85,7 +85,7 @@
     '''
     attrnames = ['local_account', 'remote_account',
                  'remote_owner', 'transferred_amount',
-                 'execution_date', 'effective_date', 'transfer_type',
+                 'execution_date', 'value_date', 'transfer_type',
                  'id', 'reference', 'statement_id', 'message',
                 ]
 
@@ -279,7 +279,7 @@
             msg = transaction_message(line, subno)
             if not statement_id:
                 statement_id = self.get_unique_statement_id(
-                    cr, msg.effective_date.strftime('%Yw%W'))
+                    cr, msg.execution_date.strftime('%Yw%W'))
             msg.statement_id = statement_id
             if stmnt:
                 stmnt.import_transaction(msg)

=== modified file 'account_banking_nl_multibank/multibank.py'
--- account_banking_nl_multibank/multibank.py	2013-04-15 13:59:50 +0000
+++ account_banking_nl_multibank/multibank.py	2014-02-17 10:51:01 +0000
@@ -44,7 +44,7 @@
     attrnames = [
         'date', 'local_account', 'remote_account', 'remote_owner', 'u1', 'u2',
         'u3', 'local_currency', 'start_balance', 'remote_currency',
-        'transferred_amount', 'execution_date', 'effective_date', 'nr1',
+        'transferred_amount', 'execution_date', 'value_date', 'nr1',
         'transfer_type', 'nr2', 'reference', 'message', 'statement_id'
     ]
 
@@ -82,7 +82,7 @@
         self.start_balance = float(self.start_balance)
         self.transferred_amount = float(self.transferred_amount)
         self.execution_date = str2date(self.execution_date, '%d-%m-%Y')
-        self.effective_date = str2date(self.effective_date, '%d-%m-%Y')
+        self.value_date = str2date(self.value_date, '%d-%m-%Y')
         self.id = str(subno).zfill(4)
 
 class transaction(models.mem_bank_transaction):
@@ -91,7 +91,7 @@
     '''
     attrnames = ['local_account', 'local_currency', 'remote_account',
                  'remote_owner', 'remote_currency', 'transferred_amount',
-                 'execution_date', 'effective_date', 'transfer_type',
+                 'execution_date', 'value_date', 'transfer_type',
                  'reference', 'message', 'statement_id', 'id',
                 ]
 
@@ -152,7 +152,7 @@
         have their transfer_type set to 'OPN'.
         '''
         return (self.transferred_amount and self.execution_date and
-                self.effective_date) and (
+                self.value_date) and (
                     self.remote_account or
                     self.transfer_type in [
                         'KST', 'PRV', 'BTL', 'BEA', 'OPN', 'KNT', 'DIV',

=== modified file 'account_banking_nl_triodos/triodos.py'
--- account_banking_nl_triodos/triodos.py	2013-11-17 19:15:43 +0000
+++ account_banking_nl_triodos/triodos.py	2014-02-17 10:51:01 +0000
@@ -65,8 +65,8 @@
         if self.debcred == 'Debet':
             self.transferred_amount = -self.transferred_amount
         self.execution_date = str2date(self.date, '%d-%m-%Y')
-        self.effective_date = str2date(self.date, '%d-%m-%Y')
-        self.statement_id = '' # self.effective_date.strftime('%Yw%W') # Set statement_id based on week number
+        self.value_date = str2date(self.date, '%d-%m-%Y')
+        self.statement_id = ''
         self.id = str(subno).zfill(4)
         # Normalize basic account numbers
         self.remote_account = self.remote_account.replace('.', '').zfill(10)
@@ -78,7 +78,7 @@
     '''
     attrnames = ['local_account', 'remote_account',
                  'remote_owner', 'transferred_amount',
-                 'execution_date', 'effective_date', 'transfer_type',
+                 'execution_date', 'value_date', 'transfer_type',
                  'reference', 'id',
                 ]
 
@@ -212,7 +212,7 @@
             msg = transaction_message(line, subno)
             if not statement_id:
                 statement_id = self.get_unique_statement_id(
-                    cr, msg.effective_date.strftime('%Yw%W'))
+                    cr, msg.execution_date.strftime('%Yw%W'))
             msg.statement_id = statement_id
             if stmnt:
                 stmnt.import_transaction(msg)

=== modified file 'account_banking_uk_hsbc/hsbc_mt940.py'
--- account_banking_uk_hsbc/hsbc_mt940.py	2012-04-30 17:11:56 +0000
+++ account_banking_uk_hsbc/hsbc_mt940.py	2014-02-17 10:51:01 +0000
@@ -40,7 +40,7 @@
 
     mapping = {
         'execution_date' : 'valuedate',
-        'effective_date' : 'valuedate',
+        'value_date' : 'valuedate',
         'local_currency' : 'currency',
         'transfer_type' : 'bookingcode',
         'reference' : 'custrefno',


Follow ups