[tryton-debian-vcs] tryton-modules-account-payment-clearing branch debian updated. debian/4.0.1-1-3-gff28839

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Tue Jul 12 13:03:09 UTC 2016


The following commit has been merged in the debian branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-account-payment-clearing.git;a=commitdiff;h=debian/4.0.1-1-3-gff28839

commit ff28839f45d8c0857e7a3ebb42273a901f346e95
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Mon Jul 11 20:05:17 2016 +0200

    Releasing debian version 4.0.2-1.
    
    Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>

diff --git a/debian/changelog b/debian/changelog
index a2d7b9e..c181c50 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+tryton-modules-account-payment-clearing (4.0.2-1) unstable; urgency=medium
+
+  * Updating to Standards-Version: 3.9.8, no changes needed.
+  * Merging upstream version 4.0.2.
+
+ -- Mathias Behrle <mathiasb at m9s.biz>  Mon, 11 Jul 2016 20:05:17 +0200
+
 tryton-modules-account-payment-clearing (4.0.1-1) unstable; urgency=medium
 
   * Merging upstream version 4.0.0.
commit 2394e275b477a4b8040d54cb7fbbc23f9389e667
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Mon Jul 11 20:05:17 2016 +0200

    Merging upstream version 4.0.2.

diff --git a/CHANGELOG b/CHANGELOG
index 61a74a2..6b57c70 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 4.0.2 - 2016-07-05
+* Bug fixes (see mercurial logs for details)
+
 Version 4.0.1 - 2016-05-11
 * Bug fixes (see mercurial logs for details)
 
diff --git a/PKG-INFO b/PKG-INFO
index 3aa9fea..2ee6823 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond_account_payment_clearing
-Version: 4.0.1
+Version: 4.0.2
 Summary: Tryton module for payment clearing
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/payment.py b/payment.py
index 48474c8..1421092 100644
--- a/payment.py
+++ b/payment.py
@@ -5,6 +5,7 @@ from collections import defaultdict
 from trytond.pool import PoolMeta, Pool
 from trytond.model import ModelView, Workflow, fields
 from trytond.pyson import Eval, Bool
+from trytond.transaction import Transaction
 
 __all__ = ['Journal', 'Payment']
 
@@ -67,6 +68,7 @@ class Payment:
         pool = Pool()
         Move = pool.get('account.move')
         Line = pool.get('account.move.line')
+        Currency = pool.get('currency.currency')
         Period = pool.get('account.period')
         Date = pool.get('ir.date')
 
@@ -82,27 +84,37 @@ class Payment:
             date = Date.today()
         period = Period.find(self.company.id, date=date)
 
+        local_currency = self.journal.currency == self.company.currency
+        if not local_currency:
+            with Transaction().set_context(date=self.date):
+                local_amount = Currency.compute(
+                    self.journal.currency, self.amount, self.company.currency)
+        else:
+            local_amount = self.amount
+
         move = Move(journal=self.journal.clearing_journal, origin=self,
             date=date, period=period)
         line = Line()
         if self.kind == 'payable':
-            line.debit, line.credit = self.amount, 0
+            line.debit, line.credit = local_amount, 0
         else:
-            line.debit, line.credit = 0, self.amount
+            line.debit, line.credit = 0, local_amount
         line.account = self.line.account
-        line.amount_second_currency = (-self.line.amount_second_currency
-            if self.line.amount_second_currency else None)
-        line.second_currency = self.line.second_currency
+        if not local_currency:
+            line.amount_second_currency = self.amount
+            line.second_currency = self.journal.currency
+
         line.party = (self.line.party
             if self.line.account.party_required else None)
         counterpart = Line()
         if self.kind == 'payable':
-            counterpart.debit, counterpart.credit = 0, self.amount
+            counterpart.debit, counterpart.credit = 0, local_amount
         else:
-            counterpart.debit, counterpart.credit = self.amount, 0
+            counterpart.debit, counterpart.credit = local_amount, 0
         counterpart.account = self.journal.clearing_account
-        counterpart.amount_second_currency = self.line.amount_second_currency
-        counterpart.second_currency = self.line.second_currency
+        if not local_currency:
+            counterpart.amount_second_currency = -self.amount
+            counterpart.second_currency = self.journal.currency
         move.lines = (line, counterpart)
         return move
 
diff --git a/tryton.cfg b/tryton.cfg
index 34ce850..ff5b870 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=4.0.1
+version=4.0.2
 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 8713192..411d387 100644
--- a/trytond_account_payment_clearing.egg-info/PKG-INFO
+++ b/trytond_account_payment_clearing.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond-account-payment-clearing
-Version: 4.0.1
+Version: 4.0.2
 Summary: Tryton module for payment clearing
 Home-page: http://www.tryton.org/
 Author: Tryton
-- 
tryton-modules-account-payment-clearing



More information about the tryton-debian-vcs mailing list