Use value date of camt.054 as clearing date
issue4520 review8891002
This commit is contained in:
1 parent
c9946699ff
commit
47c50b20a4
6 files changed
+28
-2
No files matched your search
@@ -1,3 +1,4 @@
|
||||
* Use value date of camt.054 as clearing date
|
||||
* Allow to re-generate message of a payment group
|
||||
* Use right sequence type in case of previous rejected payments
|
||||
* Add pain.001.003.03 and pain.008.003.02 flavors
|
||||
|
||||
@@ -6,6 +6,7 @@ Prerequisites
|
||||
|
||||
* Python 2.7 or later (http://www.python.org/)
|
||||
* Genshi (http://genshi.edgewall.org/)
|
||||
* python-dateutil (https://dateutil.readthedocs.org/)
|
||||
* trytond (http://www.tryton.org/)
|
||||
* trytond_party (http://www.tryton.org/)
|
||||
* trytond_account_payment (http://www.tryton.org/)
|
||||
|
||||
@@ -296,6 +296,11 @@ class Payment:
|
||||
and self.sepa_return_reason_code
|
||||
and self.sepa_return_reason_information == '/RTYP/RJCT')
|
||||
|
||||
def create_clearing_move(self, date=None):
|
||||
if not date:
|
||||
date = Transaction().context.get('date_value')
|
||||
return super(Payment, self).create_clearing_move(date=date)
|
||||
|
||||
|
||||
class Mandate(Workflow, ModelSQL, ModelView):
|
||||
'SEPA Mandate'
|
||||
|
||||
+18
-1
@@ -1,6 +1,9 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from lxml import etree
|
||||
from dateutil.parser import parse
|
||||
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
__all__ = ['SEPAHandler', 'CAMT054']
|
||||
|
||||
@@ -39,7 +42,9 @@ class CAMT054(SEPAHandler):
|
||||
self.Payment.save(payments)
|
||||
self.Payment.fail(payments)
|
||||
else:
|
||||
self.Payment.succeed(payments)
|
||||
date_value = self.date_value(element)
|
||||
with Transaction().set_context(date_value=date_value):
|
||||
self.Payment.succeed(payments)
|
||||
|
||||
def get_payment_kind(self, element):
|
||||
tag = etree.QName(element)
|
||||
@@ -73,6 +78,18 @@ class CAMT054(SEPAHandler):
|
||||
])
|
||||
return payments
|
||||
|
||||
def date_value(self, element):
|
||||
tag = etree.QName(element)
|
||||
date = element.find('./{%(ns)s}ValDt/{%(ns)s}Dt'
|
||||
% {'ns': tag.namespace})
|
||||
if date:
|
||||
return parse(date.text)
|
||||
else:
|
||||
datetime = element.find('./{%(ns)s}ValDt/{%(ns)s}DtTm'
|
||||
% {'ns': tag.namespace})
|
||||
if datetime:
|
||||
return parse(datetime.text).date()
|
||||
|
||||
def is_returned(self, element):
|
||||
tag = etree.QName(element)
|
||||
details = element.find('./{%s}NtryDtls' % tag.namespace)
|
||||
|
||||
@@ -41,7 +41,7 @@ if minor_version % 2:
|
||||
'hg+http://hg.tryton.org/modules/%s#egg=%s-%s' % (
|
||||
name[8:], name, version))
|
||||
|
||||
requires = ['Genshi', 'lxml']
|
||||
requires = ['Genshi', 'lxml', 'python-dateutil']
|
||||
for dep in info.get('depends', []):
|
||||
if not re.match(r'(ir|res|webdav)(\W|$)', dep):
|
||||
requires.append(get_require_version('trytond_%s' % dep))
|
||||
|
||||
@@ -6,6 +6,8 @@ depends:
|
||||
ir
|
||||
bank
|
||||
party
|
||||
extra_depends:
|
||||
account_payment_clearing
|
||||
xml:
|
||||
payment.xml
|
||||
party.xml
|
||||
|
||||
Reference in new issue
Block a user