[tryton-debian-vcs] tryton-modules-account-stock-anglo-saxon branch upstream-2.6 created. a49264ee06b64d4432a38d50ef558e22c21b7dd3

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Wed Nov 27 16:57:14 UTC 2013


The following commit has been merged in the upstream-2.6 branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-account-stock-anglo-saxon.git;a=commitdiff;h=a49264ee06b64d4432a38d50ef558e22c21b7dd3
commit a49264ee06b64d4432a38d50ef558e22c21b7dd3
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Thu Oct 17 13:14:36 2013 +0200

    Adding upstream version 2.6.4.

diff --git a/CHANGELOG b/CHANGELOG
index 0883997..e478392 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 2.6.4 - 2013-10-01
+* Bug fixes (see mercurial logs for details)
+
 Version 2.6.3 - 2013-05-02
 * Bug fixes (see mercurial logs for details)
 
diff --git a/PKG-INFO b/PKG-INFO
index b3c8bbe..ad24a27 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond_account_stock_anglo_saxon
-Version: 2.6.3
+Version: 2.6.4
 Summary: Tryton module for anglo-saxon real-time stock valuation
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/invoice.py b/invoice.py
index 347e990..742dbfb 100644
--- a/invoice.py
+++ b/invoice.py
@@ -81,10 +81,17 @@ class InvoiceLine:
             type_ = 'out_supplier'
         elif self.invoice.type == 'out_credit_note':
             type_ = 'in_customer'
+        if self.quantity < 0:
+            direction, target = type_.split('_')
+            if direction == 'in':
+                direction = 'out'
+            else:
+                direction = 'in'
+            type_ = '%s_%s' % (direction, target)
 
         moves.sort(key=operator.attrgetter('effective_date'))
         cost = Move.update_anglo_saxon_quantity_product_cost(
-            self.product, moves, self.quantity, self.unit, type_)
+            self.product, moves, abs(self.quantity), self.unit, type_)
         cost = self.invoice.currency.round(cost)
 
         anglo_saxon_move_lines = self._get_anglo_saxon_move_lines(cost, type_)
diff --git a/tryton.cfg b/tryton.cfg
index 67dc30a..1e03544 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=2.6.3
+version=2.6.4
 depends:
     account
     account_invoice
diff --git a/trytond_account_stock_anglo_saxon.egg-info/PKG-INFO b/trytond_account_stock_anglo_saxon.egg-info/PKG-INFO
index f4031cf..6adfb7c 100644
--- a/trytond_account_stock_anglo_saxon.egg-info/PKG-INFO
+++ b/trytond_account_stock_anglo_saxon.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond-account-stock-anglo-saxon
-Version: 2.6.3
+Version: 2.6.4
 Summary: Tryton module for anglo-saxon real-time stock valuation
 Home-page: http://www.tryton.org/
 Author: Tryton
commit 500e47a9c93d04c350d021e7a0d8ca14449de92f
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sat May 4 02:18:49 2013 +0200

    Adding upstream version 2.6.3.

diff --git a/CHANGELOG b/CHANGELOG
index ae0a4df..0883997 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 2.6.3 - 2013-05-02
+* Bug fixes (see mercurial logs for details)
+
 Version 2.6.2 - 2013-02-12
 * Bug fixes (see mercurial logs for details)
 
diff --git a/PKG-INFO b/PKG-INFO
index 4659dff..b3c8bbe 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond_account_stock_anglo_saxon
-Version: 2.6.2
+Version: 2.6.3
 Summary: Tryton module for anglo-saxon real-time stock valuation
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/stock.py b/stock.py
index d5034a9..f99ab8f 100644
--- a/stock.py
+++ b/stock.py
@@ -32,13 +32,17 @@ class Move:
         pool = Pool()
         Uom = pool.get('product.uom')
         AccountMoveLine = pool.get('account.move.line')
+        Currency = pool.get('currency.currency')
         lines = super(Move, self)._get_account_stock_move_lines(type_)
         if (type_.endswith('supplier')
                 and self.product.cost_price_method == 'fixed'):
             cost_price = Uom.compute_price(self.product.default_uom,
                 self.cost_price, self.uom)
+            with Transaction().set_context(date=self.effective_date):
+                unit_price = Currency.compute(self.currency, self.unit_price,
+                    self.company.currency, round=False)
             amount = self.company.currency.round(
-                Decimal(str(self.quantity)) * (self.unit_price - cost_price))
+                Decimal(str(self.quantity)) * (unit_price - cost_price))
             if self.company.currency.is_zero(amount):
                 return lines
             account = self.product.account_stock_supplier_used
@@ -94,7 +98,9 @@ class Move:
         Return the cost for quantity based on lines.
         Update anglo_saxon_quantity on the concerned moves.
         '''
-        Uom = Pool().get('product.uom')
+        pool = Pool()
+        Uom = pool.get('product.uom')
+        Currency = pool.get('currency.currency')
 
         for move in moves:
             assert move.product == product, 'wrong product'
@@ -110,8 +116,11 @@ class Move:
             consumed_qty += move_qty
 
             if type_.startswith('in_'):
+                with Transaction().set_context(date=move.effective_date):
+                    unit_price = Currency.compute(move.currency,
+                        move.unit_price, move.company.currency, round=False)
                 move_cost_price = Uom.compute_price(move.uom,
-                        move.unit_price, move.product.default_uom)
+                        unit_price, move.product.default_uom)
             else:
                 move_cost_price = move.cost_price
             cost += move_cost_price * Decimal(str(move_qty))
diff --git a/tryton.cfg b/tryton.cfg
index 2502cf8..67dc30a 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=2.6.2
+version=2.6.3
 depends:
     account
     account_invoice
diff --git a/trytond_account_stock_anglo_saxon.egg-info/PKG-INFO b/trytond_account_stock_anglo_saxon.egg-info/PKG-INFO
index 6958eb8..f4031cf 100644
--- a/trytond_account_stock_anglo_saxon.egg-info/PKG-INFO
+++ b/trytond_account_stock_anglo_saxon.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond-account-stock-anglo-saxon
-Version: 2.6.2
+Version: 2.6.3
 Summary: Tryton module for anglo-saxon real-time stock valuation
 Home-page: http://www.tryton.org/
 Author: Tryton
-- 
tryton-modules-account-stock-anglo-saxon



More information about the tryton-debian-vcs mailing list