mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[ADD] allow transaction without remote_account
[ADD] get some information for unstructured mt940
This commit is contained in:
@@ -20,10 +20,16 @@
|
||||
##############################################################################
|
||||
import re
|
||||
from openerp.tools.translate import _
|
||||
from openerp.addons.account_banking.parsers.models import parser
|
||||
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'
|
||||
@@ -33,6 +39,9 @@ class IngMT940Parser(MT940, parser):
|
||||
'^(?P<date>\d{6})(?P<sign>[CD])(?P<amount>\d+,\d{2})N(?P<type>\d{3})'
|
||||
'(?P<reference>\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' % (
|
||||
@@ -85,4 +94,7 @@ class IngMT940Parser(MT940, parser):
|
||||
self.current_transaction.reference = ''.join(
|
||||
subfields[self.current_transaction.reference])
|
||||
|
||||
if not subfields:
|
||||
self.current_transaction.message = data
|
||||
|
||||
self.current_transaction = None
|
||||
|
||||
Reference in New Issue
Block a user