[tryton-debian-vcs] tryton-modules-account-payment-clearing branch upstream updated. upstream/4.0.2-1-gc6f8471
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Tue Dec 6 15:18:58 UTC 2016
The following commit has been merged in the upstream branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-account-payment-clearing.git;a=commitdiff;h=upstream/4.0.2-1-gc6f8471
commit c6f8471a1d7fc99bbaabd0b0bc4e88b7884738ef
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Mon Dec 5 09:34:13 2016 +0100
Adding upstream version 4.2.0.
Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>
diff --git a/CHANGELOG b/CHANGELOG
index 6b57c70..c131ba0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,8 +1,7 @@
-Version 4.0.2 - 2016-07-05
-* Bug fixes (see mercurial logs for details)
-
-Version 4.0.1 - 2016-05-11
+Version 4.2.0 - 2016-11-28
* Bug fixes (see mercurial logs for details)
+* Mark Payment as succeded or failed when imported in statement
+* Allow to link statement line to group of payments
Version 4.0.0 - 2016-05-02
* Bug fixes (see mercurial logs for details)
@@ -15,4 +14,4 @@ Version 3.6.0 - 2015-04-20
* Bug fixes (see mercurial logs for details)
* Add support for PyPy
Version 3.4.0 - 2014-10-20
-* Initial release
\ No newline at end of file
+* Initial release
diff --git a/INSTALL b/INSTALL
index 01e7407..86301d8 100644
--- a/INSTALL
+++ b/INSTALL
@@ -23,7 +23,7 @@ site-packages directory on your system.
For advanced options, please refer to the easy_install and/or the distutils
documentation:
- http://peak.telecommunity.com/DevCenter/EasyInstall
+ http://setuptools.readthedocs.io/en/latest/easy_install.html
http://docs.python.org/inst/inst.html
To use without installation, extract the archive into ``trytond/modules`` with
diff --git a/PKG-INFO b/PKG-INFO
index 2ee6823..362e929 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond_account_payment_clearing
-Version: 4.0.2
+Version: 4.2.0
Summary: Tryton module for payment clearing
Home-page: http://www.tryton.org/
Author: Tryton
Author-email: issue_tracker at tryton.org
License: GPL-3
-Download-URL: http://downloads.tryton.org/4.0/
+Download-URL: http://downloads.tryton.org/4.2/
Description: trytond_account_payment_clearing
================================
@@ -62,6 +62,7 @@ Classifier: Natural Language :: French
Classifier: Natural Language :: German
Classifier: Natural Language :: Hungarian
Classifier: Natural Language :: Italian
+Classifier: Natural Language :: Polish
Classifier: Natural Language :: Portuguese (Brazilian)
Classifier: Natural Language :: Russian
Classifier: Natural Language :: Slovenian
diff --git a/locale/bg_BG.po b/locale/bg.po
similarity index 73%
rename from locale/bg_BG.po
rename to locale/bg.po
index 24c6f81..d268bb4 100644
--- a/locale/bg_BG.po
+++ b/locale/bg.po
@@ -18,3 +18,11 @@ msgstr ""
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
msgstr "Плащане"
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr ""
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr ""
diff --git a/locale/ca_ES.po b/locale/ca.po
similarity index 72%
rename from locale/ca_ES.po
rename to locale/ca.po
index a20684a..d36846f 100644
--- a/locale/ca_ES.po
+++ b/locale/ca.po
@@ -17,3 +17,11 @@ msgstr "Diari de liquidació"
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
msgstr "Pagament"
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr "Grup de pagaments"
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr "Liquidació"
diff --git a/locale/cs_CZ.po b/locale/cs.po
similarity index 72%
rename from locale/cs_CZ.po
rename to locale/cs.po
index c8e704f..6c76404 100644
--- a/locale/cs_CZ.po
+++ b/locale/cs.po
@@ -17,3 +17,11 @@ msgstr ""
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
msgstr ""
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr ""
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr ""
diff --git a/locale/de_DE.po b/locale/de.po
similarity index 58%
rename from locale/de_DE.po
rename to locale/de.po
index 3f170b1..d01e305 100644
--- a/locale/de_DE.po
+++ b/locale/de.po
@@ -4,16 +4,24 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:account.payment,clearing_move:"
msgid "Clearing Move"
-msgstr "Abrechnungsbuchungssatz"
+msgstr "Auszifferungsbuchungssatz"
msgctxt "field:account.payment.journal,clearing_account:"
msgid "Clearing Account"
-msgstr "Abrechnungskonto"
+msgstr "Auszifferungskonto"
msgctxt "field:account.payment.journal,clearing_journal:"
msgid "Clearing Journal"
-msgstr "Abrechungsjournal"
+msgstr "Auszifferungsjournal"
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
msgstr "Zahlung"
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr "Zahlungsgruppe"
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr "Auszifferung"
diff --git a/locale/es_MX.po b/locale/es.po
similarity index 72%
rename from locale/es_MX.po
rename to locale/es.po
index 982c8a4..1229c50 100644
--- a/locale/es_MX.po
+++ b/locale/es.po
@@ -17,3 +17,11 @@ msgstr "Diario de liquidación"
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
msgstr "Pago"
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr "Grupo de pago"
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr "Liquidación"
diff --git a/locale/es_EC.po b/locale/es_419.po
similarity index 72%
rename from locale/es_EC.po
rename to locale/es_419.po
index 0d76b7c..2c552a8 100644
--- a/locale/es_EC.po
+++ b/locale/es_419.po
@@ -16,4 +16,12 @@ msgstr "Libro diario de compensación"
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
-msgstr "Pago"
+msgstr ""
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr ""
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr "Compensación"
diff --git a/locale/es_AR.po b/locale/es_AR.po
deleted file mode 100644
index 5752042..0000000
--- a/locale/es_AR.po
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-msgid ""
-msgstr "Content-Type: text/plain; charset=utf-8\n"
-
-msgctxt "field:account.payment,clearing_move:"
-msgid "Clearing Move"
-msgstr "Asiento de compensación"
-
-msgctxt "field:account.payment.journal,clearing_account:"
-msgid "Clearing Account"
-msgstr "Cuenta de compensación"
-
-msgctxt "field:account.payment.journal,clearing_journal:"
-msgid "Clearing Journal"
-msgstr "Diario de compensación"
-
-msgctxt "field:account.statement.line,payment:"
-msgid "Payment"
-msgstr "Pago"
diff --git a/locale/es_CO.po b/locale/es_CO.po
deleted file mode 100644
index c67b0fc..0000000
--- a/locale/es_CO.po
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-msgid ""
-msgstr "Content-Type: text/plain; charset=utf-8\n"
-
-msgctxt "field:account.payment,clearing_move:"
-msgid "Clearing Move"
-msgstr "Asiento de Aclaración"
-
-msgctxt "field:account.payment.journal,clearing_account:"
-msgid "Clearing Account"
-msgstr "Cuenta de Aclaración"
-
-msgctxt "field:account.payment.journal,clearing_journal:"
-msgid "Clearing Journal"
-msgstr "Libro de Aclaración"
-
-msgctxt "field:account.statement.line,payment:"
-msgid "Payment"
-msgstr "Pago"
diff --git a/locale/es_ES.po b/locale/es_ES.po
deleted file mode 100644
index 982c8a4..0000000
--- a/locale/es_ES.po
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-msgid ""
-msgstr "Content-Type: text/plain; charset=utf-8\n"
-
-msgctxt "field:account.payment,clearing_move:"
-msgid "Clearing Move"
-msgstr "Asiento de liquidación"
-
-msgctxt "field:account.payment.journal,clearing_account:"
-msgid "Clearing Account"
-msgstr "Cuenta de liquidación"
-
-msgctxt "field:account.payment.journal,clearing_journal:"
-msgid "Clearing Journal"
-msgstr "Diario de liquidación"
-
-msgctxt "field:account.statement.line,payment:"
-msgid "Payment"
-msgstr "Pago"
diff --git a/locale/fr_FR.po b/locale/fr.po
similarity index 72%
rename from locale/fr_FR.po
rename to locale/fr.po
index a26506b..3a3beb3 100644
--- a/locale/fr_FR.po
+++ b/locale/fr.po
@@ -17,3 +17,11 @@ msgstr "Journal de compensation"
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
msgstr "Paiement"
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr "Groupe de paiement"
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr "Compensation"
diff --git a/locale/hu_HU.po b/locale/hu_HU.po
index c8e704f..6c76404 100644
--- a/locale/hu_HU.po
+++ b/locale/hu_HU.po
@@ -17,3 +17,11 @@ msgstr ""
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
msgstr ""
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr ""
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr ""
diff --git a/locale/it_IT.po b/locale/it_IT.po
index c8e704f..38d4a44 100644
--- a/locale/it_IT.po
+++ b/locale/it_IT.po
@@ -4,16 +4,24 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:account.payment,clearing_move:"
msgid "Clearing Move"
-msgstr ""
+msgstr "Movimento di compensazione"
msgctxt "field:account.payment.journal,clearing_account:"
msgid "Clearing Account"
-msgstr ""
+msgstr "Conto di compensazione"
msgctxt "field:account.payment.journal,clearing_journal:"
msgid "Clearing Journal"
-msgstr ""
+msgstr "Registro di compensazione"
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
-msgstr ""
+msgstr "Pagamento"
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr "Raggruppamento pagamenti"
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr "Compensazione"
diff --git a/locale/ja_JP.po b/locale/ja_JP.po
index c8e704f..6c76404 100644
--- a/locale/ja_JP.po
+++ b/locale/ja_JP.po
@@ -17,3 +17,11 @@ msgstr ""
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
msgstr ""
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr ""
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr ""
diff --git a/locale/lo_LA.po b/locale/lo.po
similarity index 78%
rename from locale/lo_LA.po
rename to locale/lo.po
index 6e2caf5..0a538ae 100644
--- a/locale/lo_LA.po
+++ b/locale/lo.po
@@ -17,3 +17,11 @@ msgstr "ບັນຊີສະສາງປະຈຳວັນ"
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
msgstr "ການຈ່າຍ"
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr ""
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr ""
diff --git a/locale/hu_HU.po b/locale/lt.po
similarity index 72%
copy from locale/hu_HU.po
copy to locale/lt.po
index c8e704f..6c76404 100644
--- a/locale/hu_HU.po
+++ b/locale/lt.po
@@ -17,3 +17,11 @@ msgstr ""
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
msgstr ""
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr ""
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr ""
diff --git a/locale/lt_LT.po b/locale/lt_LT.po
deleted file mode 100644
index c8e704f..0000000
--- a/locale/lt_LT.po
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-msgid ""
-msgstr "Content-Type: text/plain; charset=utf-8\n"
-
-msgctxt "field:account.payment,clearing_move:"
-msgid "Clearing Move"
-msgstr ""
-
-msgctxt "field:account.payment.journal,clearing_account:"
-msgid "Clearing Account"
-msgstr ""
-
-msgctxt "field:account.payment.journal,clearing_journal:"
-msgid "Clearing Journal"
-msgstr ""
-
-msgctxt "field:account.statement.line,payment:"
-msgid "Payment"
-msgstr ""
diff --git a/locale/nl_NL.po b/locale/nl.po
similarity index 73%
rename from locale/nl_NL.po
rename to locale/nl.po
index e1565cc..d5cdbba 100644
--- a/locale/nl_NL.po
+++ b/locale/nl.po
@@ -18,3 +18,11 @@ msgstr ""
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
msgstr "Betaling"
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr ""
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr ""
diff --git a/locale/hu_HU.po b/locale/pl.po
similarity index 72%
copy from locale/hu_HU.po
copy to locale/pl.po
index c8e704f..6c76404 100644
--- a/locale/hu_HU.po
+++ b/locale/pl.po
@@ -17,3 +17,11 @@ msgstr ""
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
msgstr ""
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr ""
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr ""
diff --git a/locale/pt_BR.po b/locale/pt_BR.po
index 5d9efb8..e4f3383 100644
--- a/locale/pt_BR.po
+++ b/locale/pt_BR.po
@@ -17,3 +17,11 @@ msgstr "Diário de Compensação"
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
msgstr "Pagamento"
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr ""
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr ""
diff --git a/locale/ru_RU.po b/locale/ru.po
similarity index 73%
rename from locale/ru_RU.po
rename to locale/ru.po
index bf62501..d54ac38 100644
--- a/locale/ru_RU.po
+++ b/locale/ru.po
@@ -18,3 +18,11 @@ msgstr ""
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
msgstr "Оплата"
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr ""
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr ""
diff --git a/locale/sl_SI.po b/locale/sl.po
similarity index 73%
rename from locale/sl_SI.po
rename to locale/sl.po
index 40ebcef..f56c3e4 100644
--- a/locale/sl_SI.po
+++ b/locale/sl.po
@@ -17,3 +17,11 @@ msgstr "Klirinški dnevnik"
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
msgstr "Plačilo"
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr "Plačilna skupina"
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr ""
diff --git a/locale/zh_CN.po b/locale/zh_CN.po
index c8e704f..6c76404 100644
--- a/locale/zh_CN.po
+++ b/locale/zh_CN.po
@@ -17,3 +17,11 @@ msgstr ""
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
msgstr ""
+
+msgctxt "field:account.statement.line,payment_group:"
+msgid "Payment Group"
+msgstr ""
+
+msgctxt "view:account.payment.journal:"
+msgid "Clearing"
+msgstr ""
diff --git a/setup.py b/setup.py
index b1f7370..9ddde83 100644
--- a/setup.py
+++ b/setup.py
@@ -97,6 +97,7 @@ setup(name=name,
'Natural Language :: German',
'Natural Language :: Hungarian',
'Natural Language :: Italian',
+ 'Natural Language :: Polish',
'Natural Language :: Portuguese (Brazilian)',
'Natural Language :: Russian',
'Natural Language :: Slovenian',
diff --git a/statement.py b/statement.py
index a82e794..c123d43 100644
--- a/statement.py
+++ b/statement.py
@@ -16,9 +16,33 @@ class Statement:
def create_move(cls, statements):
pool = Pool()
MoveLine = pool.get('account.move.line')
+ Payment = pool.get('account.payment')
moves = super(Statement, cls).create_move(statements)
+ to_success = []
+ to_fail = []
+ for move, statement, lines in moves:
+ for line in lines:
+ if line.payment:
+ payments = [line.payment]
+ kind = line.payment.kind
+ elif line.payment_group:
+ payments = line.payment_group.payments
+ kind = line.payment_group.kind
+ else:
+ continue
+ if (kind == 'receivable') == (line.amount >= 0):
+ to_success.extend(payments)
+ else:
+ to_fail.extend(payments)
+ # The failing should be done last because success is usually not a
+ # definitive state
+ if to_success:
+ Payment.succeed(to_success)
+ if to_fail:
+ Payment.fail(to_fail)
+
for move, statement, lines in moves:
assert len({l.payment for l in lines}) == 1
line = lines[0]
@@ -45,15 +69,41 @@ class StatementLine:
payment = fields.Many2One('account.payment', 'Payment',
domain=[
If(Bool(Eval('party')), [('party', '=', Eval('party'))], []),
- ('state', 'in', ['processing', 'succeeded']),
+ ('state', 'in', ['processing', 'succeeded', 'failed']),
],
- depends=['party'])
+ states={
+ 'invisible': Bool(Eval('payment_group')) | Bool(Eval('invoice')),
+ 'readonly': Eval('statement_state') != 'draft',
+ },
+ depends=['party', 'statement_state'])
+ payment_group = fields.Many2One(
+ 'account.payment.group', "Payment Group",
+ domain=[
+ ('company', '=', Eval('_parent_statement', {}).get('company', -1)),
+ ],
+ states={
+ 'invisible': Bool(Eval('payment')) | Bool(Eval('invoice')),
+ 'readonly': Eval('statement_state') != 'draft',
+ },
+ depends=['statement_state'])
+
+ @classmethod
+ def __setup__(cls):
+ super(StatementLine, cls).__setup__()
+ invoice_invisible = Bool(Eval('payment')) | Bool(Eval('payment_group'))
+ if 'invisible' in cls.invoice.states:
+ cls.invoice.states['invisible'] |= invoice_invisible
+ else:
+ cls.invoice.states['invisible'] = invoice_invisible
@classmethod
def copy(cls, lines, default=None):
if default is None:
default = {}
+ else:
+ default = default.copy()
default.setdefault('payment', None)
+ default.setdefault('payment_group')
return super(StatementLine, cls).copy(lines, default=default)
@fields.depends('payment', 'party', 'account', '_parent_statement.journal')
@@ -64,9 +114,7 @@ class StatementLine:
if not self.party:
self.party = self.payment.party
clearing_account = self.payment.journal.clearing_account
- if (not self.account
- and self.payment.clearing_move
- and clearing_account):
+ if not self.account and clearing_account:
self.account = clearing_account
if self.statement and self.statement.journal:
with Transaction().set_context(date=self.payment.date):
@@ -76,20 +124,33 @@ class StatementLine:
if self.payment.kind == 'payable':
self.amount *= -1
+ @fields.depends('payment_group', 'account')
+ def on_change_payment_group(self):
+ if self.payment_group:
+ self.party = None
+ clearing_account = self.payment_group.journal.clearing_account
+ if not self.account and clearing_account:
+ self.account = clearing_account
+
@fields.depends('party', 'payment')
def on_change_party(self):
super(StatementLine, self).on_change_party()
if self.payment:
if self.payment.party != self.party:
self.payment = None
+ self.payment_group = None
- @fields.depends('account', 'payment')
+ @fields.depends('account', 'payment', 'payment_group')
def on_change_account(self):
super(StatementLine, self).on_change_account()
if self.payment:
clearing_account = self.payment.journal.clearing_account
- if self.account != clearing_account:
- self.payment = None
+ elif self.payment_group:
+ clearing_account = self.payment_group.journal.clearing_account
+ else:
+ return
+ if self.account != clearing_account:
+ self.payment = None
@classmethod
def post_move(cls, lines):
diff --git a/tests/scenario_account_negative_payment_clearing.rst b/tests/scenario_account_negative_payment_clearing.rst
index 8cd9088..2a0966b 100644
--- a/tests/scenario_account_negative_payment_clearing.rst
+++ b/tests/scenario_account_negative_payment_clearing.rst
@@ -6,7 +6,8 @@ Imports::
>>> import datetime
>>> from dateutil.relativedelta import relativedelta
>>> from decimal import Decimal
- >>> from proteus import config, Model, Wizard
+ >>> from proteus import Model, Wizard
+ >>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.company.tests.tools import create_company, \
... get_company
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
@@ -15,21 +16,9 @@ Imports::
... set_fiscalyear_invoice_sequences
>>> today = datetime.date.today()
-Create database::
+Install account_payment_clearing and account_statement::
- >>> config = config.set_trytond()
- >>> config.pool.test = True
-
-Install account_payment_clearing::
-
- >>> Module = Model.get('ir.module')
- >>> account_payment_module, = Module.find(
- ... [('name', '=', 'account_payment_clearing')])
- >>> account_payment_module.click('install')
- >>> account_statement_module, = Module.find(
- ... [('name', '=', 'account_statement')])
- >>> account_statement_module.click('install')
- >>> Wizard('ir.module.install_upgrade').execute('upgrade')
+ >>> config = activate_modules(['account_payment_clearing', 'account_statement'])
Create company::
@@ -51,8 +40,12 @@ Create chart of accounts::
>>> cash = accounts['cash']
>>> Account = Model.get('account.account')
- >>> bank_clearing = Account(name='Bank Clearing', type=payable.type,
- ... reconcile=True, deferral=True, parent=payable.parent, kind='other')
+ >>> bank_clearing = Account(parent=payable.parent)
+ >>> bank_clearing.name = 'Bank Clearing'
+ >>> bank_clearing.type = payable.type
+ >>> bank_clearing.reconcile = True
+ >>> bank_clearing.deferral = True
+ >>> bank_clearing.kind = 'other'
>>> bank_clearing.save()
>>> Journal = Model.get('account.journal')
@@ -91,7 +84,7 @@ Pay the line::
>>> line, = [l for l in move.lines if l.account == payable]
>>> pay_line = Wizard('account.move.line.pay', [line])
>>> pay_line.form.journal = payment_journal
- >>> pay_line.execute('pay')
+ >>> pay_line.execute('start')
>>> payment, = Payment.find([('state', '=', 'draft')])
>>> payment.amount
Decimal('50.00')
diff --git a/tests/scenario_account_payment_clearing.rst b/tests/scenario_account_payment_clearing.rst
index 9262d3f..7d3408a 100644
--- a/tests/scenario_account_payment_clearing.rst
+++ b/tests/scenario_account_payment_clearing.rst
@@ -6,7 +6,9 @@ Imports::
>>> import datetime
>>> from dateutil.relativedelta import relativedelta
>>> from decimal import Decimal
- >>> from proteus import config, Model, Wizard
+ >>> from proteus import Model, Wizard
+ >>> from trytond.tests.tools import activate_modules
+ >>> from trytond.modules.currency.tests.tools import get_currency
>>> from trytond.modules.company.tests.tools import create_company, \
... get_company
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
@@ -15,21 +17,9 @@ Imports::
... set_fiscalyear_invoice_sequences
>>> today = datetime.date.today()
-Create database::
+Install account_payment_clearing and account_statement::
- >>> config = config.set_trytond()
- >>> config.pool.test = True
-
-Install account_payment_clearing::
-
- >>> Module = Model.get('ir.module')
- >>> account_payment_module, = Module.find(
- ... [('name', '=', 'account_payment_clearing')])
- >>> account_payment_module.click('install')
- >>> account_statement_module, = Module.find(
- ... [('name', '=', 'account_statement')])
- >>> account_statement_module.click('install')
- >>> Wizard('ir.module.install_upgrade').execute('upgrade')
+ >>> config = activate_modules(['account_payment_clearing', 'account_statement'])
Create company::
@@ -51,8 +41,12 @@ Create chart of accounts::
>>> cash = accounts['cash']
>>> Account = Model.get('account.account')
- >>> bank_clearing = Account(name='Bank Clearing', type=payable.type,
- ... reconcile=True, deferral=True, parent=payable.parent, kind='other')
+ >>> bank_clearing = Account(parent=payable.parent)
+ >>> bank_clearing.name = 'Bank Clearing'
+ >>> bank_clearing.type = payable.type
+ >>> bank_clearing.reconcile = True
+ >>> bank_clearing.deferral = True
+ >>> bank_clearing.kind = 'other'
>>> bank_clearing.save()
>>> Journal = Model.get('account.journal')
@@ -91,7 +85,7 @@ Partially pay the line::
>>> line, = [l for l in move.lines if l.account == payable]
>>> pay_line = Wizard('account.move.line.pay', [line])
>>> pay_line.form.journal = payment_journal
- >>> pay_line.execute('pay')
+ >>> pay_line.execute('start')
>>> payment, = Payment.find()
>>> payment.amount = Decimal('30.0')
>>> payment.click('approve')
@@ -137,7 +131,7 @@ Pay the line::
>>> line, = [l for l in move.lines if l.account == payable]
>>> pay_line = Wizard('account.move.line.pay', [line])
>>> pay_line.form.journal = payment_journal
- >>> pay_line.execute('pay')
+ >>> pay_line.execute('start')
>>> payment, = Payment.find([('state', '=', 'draft')])
>>> payment.amount
Decimal('50.00')
@@ -272,3 +266,137 @@ Validate statement::
>>> bank_clearing.reload()
>>> bank_clearing.balance
Decimal('0.00')
+
+Create a statement that reimburse the payment group::
+
+ >>> statement = Statement(name='test',
+ ... journal=statement_journal,
+ ... start_balance=Decimal('-50.00'),
+ ... end_balance=Decimal('0.00'),
+ ... )
+ >>> line = statement.lines.new(date=today)
+ >>> line.payment_group = payment.group
+ >>> line.account == bank_clearing
+ True
+ >>> line.amount = Decimal('50.00')
+
+ >>> statement.click('validate_statement')
+ >>> statement.state
+ u'validated'
+
+Payment must be failed::
+
+ >>> payment.reload()
+ >>> payment.state
+ u'failed'
+
+
+Payment in a foreign currency
+-----------------------------
+
+Create a payment journal in Euro::
+
+ >>> euro = get_currency('EUR')
+ >>> euro_payment_journal = PaymentJournal(
+ ... name='Euro Payments', process_method='manual', currency=euro,
+ ... clearing_journal=expense, clearing_account=bank_clearing)
+ >>> euro_payment_journal.save()
+
+Create a payable move::
+
+ >>> move = Move()
+ >>> move.journal = expense
+ >>> line = move.lines.new(
+ ... account=payable, party=supplier, credit=Decimal('20.00'),
+ ... amount_second_currency=Decimal('-40.00'), second_currency=euro)
+ >>> line = move.lines.new(
+ ... account=expense, debit=Decimal('20.00'),
+ ... amount_second_currency=Decimal('40.00'), second_currency=euro)
+ >>> move.click('post')
+
+Pay the line::
+
+ >>> line, = [l for l in move.lines if l.account == payable]
+ >>> pay_line = Wizard('account.move.line.pay', [line])
+ >>> pay_line.form.journal = euro_payment_journal
+ >>> pay_line.execute('start')
+ >>> payment, = Payment.find([('state', '=', 'draft')])
+ >>> payment.amount
+ Decimal('40.00')
+ >>> payment.click('approve')
+ >>> process_payment = Wizard('account.payment.process', [payment])
+ >>> process_payment.execute('process')
+ >>> payment.reload()
+ >>> payment.state
+ u'processing'
+
+Succeed payment::
+
+ >>> payment.click('succeed')
+ >>> debit_line, = [l for l in payment.clearing_move.lines if l.debit > 0]
+ >>> debit_line.debit
+ Decimal('20.00')
+ >>> debit_line.amount_second_currency
+ Decimal('40.00')
+
+Validate Statement with processing payment
+--------------------------------------------
+
+Create a payable move::
+
+ >>> move = Move()
+ >>> move.journal = expense
+ >>> line = move.lines.new(account=payable, party=supplier,
+ ... credit=Decimal('50.00'))
+ >>> line = move.lines.new(account=expense, debit=Decimal('50.00'))
+ >>> move.click('post')
+
+Create a processing payment for the move::
+
+ >>> Payment = Model.get('account.payment')
+ >>> line, = [l for l in move.lines if l.account == payable]
+ >>> pay_line = Wizard('account.move.line.pay', [line])
+ >>> pay_line.form.journal = payment_journal
+ >>> pay_line.execute('start')
+ >>> payment, = Payment.find([('line', '=', line.id)])
+ >>> payment.click('approve')
+ >>> payment.state
+ u'approved'
+ >>> process_payment = Wizard('account.payment.process', [payment])
+ >>> process_payment.execute('process')
+ >>> payment.reload()
+ >>> payment.state
+ u'processing'
+
+Create statement for the payment::
+
+ >>> statement = Statement(name='test',
+ ... journal=statement_journal,
+ ... start_balance=Decimal('0.00'),
+ ... end_balance=Decimal('-50.00'))
+ >>> line = statement.lines.new(date=today)
+ >>> line.payment = payment
+ >>> line.party == supplier
+ True
+ >>> line.account == bank_clearing
+ True
+ >>> line.amount
+ Decimal('-50.00')
+ >>> statement.save()
+
+Validate statement and check the payment is confirmed::
+
+ >>> statement.click('validate_statement')
+ >>> statement.state
+ u'validated'
+ >>> line, = statement.lines
+ >>> move_line, = [l for l in line.move.lines
+ ... if l.account == bank_clearing]
+ >>> bool(move_line.reconciliation)
+ True
+ >>> payment.reload()
+ >>> payment.state
+ u'succeeded'
+ >>> debit_line, = [l for l in payment.clearing_move.lines if l.debit > 0]
+ >>> debit_line.debit
+ Decimal('50.00')
diff --git a/tests/test_account_payment_clearing.py b/tests/test_account_payment_clearing.py
index fcbb467..030b878 100644
--- a/tests/test_account_payment_clearing.py
+++ b/tests/test_account_payment_clearing.py
@@ -4,7 +4,7 @@ import unittest
import doctest
import trytond.tests.test_tryton
from trytond.tests.test_tryton import ModuleTestCase
-from trytond.tests.test_tryton import doctest_setup, doctest_teardown
+from trytond.tests.test_tryton import doctest_teardown
from trytond.tests.test_tryton import doctest_checker
@@ -19,12 +19,12 @@ def suite():
AccountPaymentTestCase))
suite.addTests(doctest.DocFileSuite(
'scenario_account_payment_clearing.rst',
- setUp=doctest_setup, tearDown=doctest_teardown, encoding='utf-8',
+ tearDown=doctest_teardown, encoding='utf-8',
checker=doctest_checker,
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
suite.addTests(doctest.DocFileSuite(
'scenario_account_negative_payment_clearing.rst',
- setUp=doctest_setup, tearDown=doctest_teardown, encoding='utf-8',
+ tearDown=doctest_teardown, encoding='utf-8',
checker=doctest_checker,
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
return suite
diff --git a/tryton.cfg b/tryton.cfg
index ff5b870..c5ad434 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
[tryton]
-version=4.0.2
+version=4.2.0
depends:
account_payment
ir
diff --git a/trytond_account_payment_clearing.egg-info/PKG-INFO b/trytond_account_payment_clearing.egg-info/PKG-INFO
index 411d387..95473ee 100644
--- a/trytond_account_payment_clearing.egg-info/PKG-INFO
+++ b/trytond_account_payment_clearing.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond-account-payment-clearing
-Version: 4.0.2
+Version: 4.2.0
Summary: Tryton module for payment clearing
Home-page: http://www.tryton.org/
Author: Tryton
Author-email: issue_tracker at tryton.org
License: GPL-3
-Download-URL: http://downloads.tryton.org/4.0/
+Download-URL: http://downloads.tryton.org/4.2/
Description: trytond_account_payment_clearing
================================
@@ -62,6 +62,7 @@ Classifier: Natural Language :: French
Classifier: Natural Language :: German
Classifier: Natural Language :: Hungarian
Classifier: Natural Language :: Italian
+Classifier: Natural Language :: Polish
Classifier: Natural Language :: Portuguese (Brazilian)
Classifier: Natural Language :: Russian
Classifier: Natural Language :: Slovenian
diff --git a/trytond_account_payment_clearing.egg-info/SOURCES.txt b/trytond_account_payment_clearing.egg-info/SOURCES.txt
index 1e7d91e..a3cde23 100644
--- a/trytond_account_payment_clearing.egg-info/SOURCES.txt
+++ b/trytond_account_payment_clearing.egg-info/SOURCES.txt
@@ -15,25 +15,23 @@ tryton.cfg
./statement.py
./statement.xml
./tryton.cfg
-./locale/bg_BG.po
-./locale/ca_ES.po
-./locale/cs_CZ.po
-./locale/de_DE.po
-./locale/es_AR.po
-./locale/es_CO.po
-./locale/es_EC.po
-./locale/es_ES.po
-./locale/es_MX.po
-./locale/fr_FR.po
+./locale/bg.po
+./locale/ca.po
+./locale/cs.po
+./locale/de.po
+./locale/es.po
+./locale/es_419.po
+./locale/fr.po
./locale/hu_HU.po
./locale/it_IT.po
./locale/ja_JP.po
-./locale/lo_LA.po
-./locale/lt_LT.po
-./locale/nl_NL.po
+./locale/lo.po
+./locale/lt.po
+./locale/nl.po
+./locale/pl.po
./locale/pt_BR.po
-./locale/ru_RU.po
-./locale/sl_SI.po
+./locale/ru.po
+./locale/sl.po
./locale/zh_CN.po
./tests/__init__.py
./tests/scenario_account_negative_payment_clearing.rst
@@ -44,25 +42,23 @@ tryton.cfg
./view/statement_line_form.xml
./view/statement_line_tree.xml
doc/index.rst
-locale/bg_BG.po
-locale/ca_ES.po
-locale/cs_CZ.po
-locale/de_DE.po
-locale/es_AR.po
-locale/es_CO.po
-locale/es_EC.po
-locale/es_ES.po
-locale/es_MX.po
-locale/fr_FR.po
+locale/bg.po
+locale/ca.po
+locale/cs.po
+locale/de.po
+locale/es.po
+locale/es_419.po
+locale/fr.po
locale/hu_HU.po
locale/it_IT.po
locale/ja_JP.po
-locale/lo_LA.po
-locale/lt_LT.po
-locale/nl_NL.po
+locale/lo.po
+locale/lt.po
+locale/nl.po
+locale/pl.po
locale/pt_BR.po
-locale/ru_RU.po
-locale/sl_SI.po
+locale/ru.po
+locale/sl.po
locale/zh_CN.po
tests/scenario_account_negative_payment_clearing.rst
tests/scenario_account_payment_clearing.rst
diff --git a/trytond_account_payment_clearing.egg-info/requires.txt b/trytond_account_payment_clearing.egg-info/requires.txt
index c934446..d86b9c3 100644
--- a/trytond_account_payment_clearing.egg-info/requires.txt
+++ b/trytond_account_payment_clearing.egg-info/requires.txt
@@ -1,2 +1,2 @@
-trytond_account_payment >= 4.0, < 4.1
-trytond >= 4.0, < 4.1
+trytond_account_payment >= 4.2, < 4.3
+trytond >= 4.2, < 4.3
diff --git a/view/payment_journal_form.xml b/view/payment_journal_form.xml
index 9b7da18..17c2d36 100644
--- a/view/payment_journal_form.xml
+++ b/view/payment_journal_form.xml
@@ -3,6 +3,7 @@
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form/field[@name='process_method']" position="after">
+ <separator id="clearing" string="Clearing" colspan="4"/>
<label name="clearing_account"/>
<field name="clearing_account"/>
<label name="clearing_journal"/>
diff --git a/view/statement_line_form.xml b/view/statement_line_form.xml
index f53ecc3..1e18e17 100644
--- a/view/statement_line_form.xml
+++ b/view/statement_line_form.xml
@@ -3,7 +3,10 @@
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form/field[@name='invoice']" position="after">
+ <newline/>
<label name="payment"/>
<field name="payment"/>
+ <label name="payment_group"/>
+ <field name="payment_group"/>
</xpath>
</data>
diff --git a/view/statement_line_tree.xml b/view/statement_line_tree.xml
index 9ef9faa..4e97148 100644
--- a/view/statement_line_tree.xml
+++ b/view/statement_line_tree.xml
@@ -4,5 +4,6 @@ this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/tree/field[@name='invoice']" position="after">
<field name="payment"/>
+ <field name="payment_group"/>
</xpath>
</data>
--
tryton-modules-account-payment-clearing
More information about the tryton-debian-vcs
mailing list