[tryton-debian-vcs] tryton-modules-product-cost-history branch upstream updated. upstream/2.8.0-1-g8718106

git repository hosting tryton-debian-vcs at m9s.biz
Mon Nov 25 19:36:00 UTC 2013


The following commit has been merged in the upstream branch:
http://debian.tryton.org/gitweb/?p=packages/tryton-modules-product-cost-history.git;a=commitdiff;h=upstream/2.8.0-1-g8718106

commit 8718106663e4adc4511b5ad6ecb98488e270e8a1
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sun Nov 24 17:27:30 2013 +0100

    Adding upstream version 3.0.0.

diff --git a/CHANGELOG b/CHANGELOG
index 38aa565..f66fd20 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 3.0.0 - 2013-10-21
+* Bug fixes (see mercurial logs for details)
+
 Version 2.8.0 - 2013-04-22
 * Bug fixes (see mercurial logs for details)
 
diff --git a/INSTALL b/INSTALL
index 70ae5c1..b275167 100644
--- a/INSTALL
+++ b/INSTALL
@@ -6,6 +6,7 @@ Prerequisites
 
  * Python 2.6 or later (http://www.python.org/)
  * trytond (http://www.tryton.org/)
+ * python-sql (http://code.google.com/p/python-sql/)
  * trytond_product (http://www.tryton.org/)
 
 Installation
diff --git a/PKG-INFO b/PKG-INFO
index ec2473f..a701ca7 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond_product_cost_history
-Version: 2.8.0
+Version: 3.0.0
 Summary: Tryton module to historize product cost
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: UNKNOWN
 License: GPL-3
-Download-URL: http://downloads.tryton.org/2.8/
+Download-URL: http://downloads.tryton.org/3.0/
 Description: trytond_product_cost_history
         ============================
         
@@ -59,6 +59,7 @@ Classifier: Natural Language :: English
 Classifier: Natural Language :: French
 Classifier: Natural Language :: German
 Classifier: Natural Language :: Russian
+Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.6
diff --git a/locale/fr_FR.po b/locale/fr_FR.po
index c7f225b..db222a1 100644
--- a/locale/fr_FR.po
+++ b/locale/fr_FR.po
@@ -4,7 +4,7 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
 
 msgctxt "field:product.product.cost_history,cost_price:"
 msgid "Cost Price"
-msgstr "Prix de Revient"
+msgstr "Prix de revient"
 
 msgctxt "field:product.product.cost_history,create_date:"
 msgid "Create Date"
@@ -53,7 +53,3 @@ msgstr "Historique du coût du produit"
 msgctxt "view:product.product.cost_history:"
 msgid "Product Cost History"
 msgstr "Historique du coût du produit"
-
-msgctxt "view:product.product.cost_history:"
-msgid "Product Cost History"
-msgstr "Historique du coût du produit"
diff --git a/locale/fr_FR.po b/locale/sl_SI.po
similarity index 71%
copy from locale/fr_FR.po
copy to locale/sl_SI.po
index c7f225b..b5b16dd 100644
--- a/locale/fr_FR.po
+++ b/locale/sl_SI.po
@@ -4,19 +4,19 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
 
 msgctxt "field:product.product.cost_history,cost_price:"
 msgid "Cost Price"
-msgstr "Prix de Revient"
+msgstr "Nabavna cena"
 
 msgctxt "field:product.product.cost_history,create_date:"
 msgid "Create Date"
-msgstr "Date de création"
+msgstr "Ustvarjeno"
 
 msgctxt "field:product.product.cost_history,create_uid:"
 msgid "Create User"
-msgstr "Créé par"
+msgstr "Ustvaril"
 
 msgctxt "field:product.product.cost_history,date:"
 msgid "Date"
-msgstr "Date"
+msgstr "Datum"
 
 msgctxt "field:product.product.cost_history,id:"
 msgid "ID"
@@ -24,36 +24,32 @@ msgstr "ID"
 
 msgctxt "field:product.product.cost_history,rec_name:"
 msgid "Name"
-msgstr "Nom"
+msgstr "Ime"
 
 msgctxt "field:product.product.cost_history,template:"
 msgid "Product"
-msgstr "Produit"
+msgstr "Izdelek"
 
 msgctxt "field:product.product.cost_history,write_date:"
 msgid "Write Date"
-msgstr "Date de mise à jour"
+msgstr "Zapisano"
 
 msgctxt "field:product.product.cost_history,write_uid:"
 msgid "Write User"
-msgstr "Mis à jour par"
+msgstr "Zapisal"
 
 msgctxt "model:ir.action,name:act_product_cost_history_form"
 msgid "Product Cost History"
-msgstr "Historique du coût du produit"
+msgstr "Zgodovina cen izdelka"
 
 msgctxt "model:ir.action,name:wizard_product_cost_history_open"
 msgid "Cost History"
-msgstr "Historique de coût"
+msgstr "Zgodovina cen"
 
 msgctxt "model:product.product.cost_history,name:"
 msgid "History of Product Cost"
-msgstr "Historique du coût du produit"
+msgstr "Zgodovina cen izdelka"
 
 msgctxt "view:product.product.cost_history:"
 msgid "Product Cost History"
-msgstr "Historique du coût du produit"
-
-msgctxt "view:product.product.cost_history:"
-msgid "Product Cost History"
-msgstr "Historique du coût du produit"
+msgstr "Zgodovina cen izdelka"
diff --git a/product.py b/product.py
index 2886939..489e079 100644
--- a/product.py
+++ b/product.py
@@ -1,5 +1,10 @@
 #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 sql import Column
+from sql.aggregate import Max
+from sql.conditionals import Coalesce
+from sql.functions import Trim, Substring
+
 from trytond.model import ModelView, ModelSQL, fields
 from trytond.wizard import Wizard, StateAction
 from trytond.pyson import PYSONEncoder
@@ -22,28 +27,32 @@ class ProductCostHistory(ModelSQL, ModelView):
         super(ProductCostHistory, cls).__setup__()
         cls._order.insert(0, ('date', 'DESC'))
 
-    @staticmethod
-    def table_query():
+    @classmethod
+    def table_query(cls):
         pool = Pool()
         Property = pool.get('ir.property')
         Field = pool.get('ir.model.field')
-        return ('SELECT '
-                'MAX(h.__id) AS id, '
-                'MAX(h.create_uid) AS create_uid, '
-                'MAX(h.create_date) AS create_date, '
-                'MAX(h.write_uid) AS write_uid, '
-                'MAX(h.write_date) AS write_date, '
-                'COALESCE(h.write_date, h.create_date) AS date, '
-                'CAST(TRIM(\',\' FROM SUBSTRING(h.res FROM \',.*\')) AS '
-                    'INTEGER) AS template, '
-                'CAST(TRIM(\',\' FROM h.value) AS NUMERIC) AS cost_price '
-            'FROM "' + Property._table + '__history" h '
-                'JOIN "' + Field._table + '" f ON (f.id = h.field) '
-            'WHERE f.name = \'cost_price\' '
-                'AND h.res LIKE \'product.template,%%\' '
-            'GROUP BY h.id, COALESCE(h.write_date, h.create_date), h.res, '
-                'h.value',
-            [])
+        property_history = Property.__table_history__()
+        field = Field.__table__()
+        return property_history.join(field,
+            condition=field.id == property_history.field
+            ).select(Max(Column(property_history, '__id')).as_('id'),
+                Max(property_history.create_uid).as_('create_uid'),
+                Max(property_history.create_date).as_('create_date'),
+                Max(property_history.write_uid).as_('write_uid'),
+                Max(property_history.write_date).as_('write_date'),
+                Coalesce(property_history.write_date,
+                    property_history.create_date).as_('date'),
+                Trim(Substring(property_history.res, ',.*'), 'LEADING', ','
+                    ).cast(cls.template.sql_type().base).as_('template'),
+                Trim(property_history.value, 'LEADING', ','
+                    ).cast(cls.cost_price.sql_type().base).as_('cost_price'),
+                where=(field.name == 'cost_price')
+                & property_history.res.like('product.template,%'),
+                group_by=(property_history.id,
+                    Coalesce(property_history.write_date,
+                        property_history.create_date),
+                    property_history.res, property_history.value))
 
 
 class OpenProductCostHistory(Wizard):
diff --git a/setup.py b/setup.py
index d6f0ae7..ca4d9a1 100644
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,7 @@ major_version, minor_version, _ = info.get('version', '0.0.1').split('.', 2)
 major_version = int(major_version)
 minor_version = int(minor_version)
 
-requires = []
+requires = ['python-sql']
 for dep in info.get('depends', []):
     if not re.match(r'(ir|res|webdav)(\W|$)', dep):
         requires.append('trytond_%s >= %s.%s, < %s.%s' %
@@ -63,6 +63,7 @@ setup(name='trytond_product_cost_history',
         'Natural Language :: French',
         'Natural Language :: German',
         'Natural Language :: Russian',
+        'Natural Language :: Slovenian',
         'Natural Language :: Spanish',
         'Operating System :: OS Independent',
         'Programming Language :: Python :: 2.6',
diff --git a/tests/__init__.py b/tests/__init__.py
index a1e1c5f..b651e41 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -2,3 +2,5 @@
 #this repository contains the full copyright notices and license terms.
 
 from .test_product_cost_history import suite
+
+__all__ = ['suite']
diff --git a/tryton.cfg b/tryton.cfg
index 72c0e73..9860507 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=2.8.0
+version=3.0.0
 depends:
     ir
     product
diff --git a/trytond_product_cost_history.egg-info/PKG-INFO b/trytond_product_cost_history.egg-info/PKG-INFO
index ce47c6c..7b6670a 100644
--- a/trytond_product_cost_history.egg-info/PKG-INFO
+++ b/trytond_product_cost_history.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond-product-cost-history
-Version: 2.8.0
+Version: 3.0.0
 Summary: Tryton module to historize product cost
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: UNKNOWN
 License: GPL-3
-Download-URL: http://downloads.tryton.org/2.8/
+Download-URL: http://downloads.tryton.org/3.0/
 Description: trytond_product_cost_history
         ============================
         
@@ -59,6 +59,7 @@ Classifier: Natural Language :: English
 Classifier: Natural Language :: French
 Classifier: Natural Language :: German
 Classifier: Natural Language :: Russian
+Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.6
diff --git a/trytond_product_cost_history.egg-info/SOURCES.txt b/trytond_product_cost_history.egg-info/SOURCES.txt
index 21c03af..74eb186 100644
--- a/trytond_product_cost_history.egg-info/SOURCES.txt
+++ b/trytond_product_cost_history.egg-info/SOURCES.txt
@@ -23,6 +23,7 @@ locale/es_ES.po
 locale/fr_FR.po
 locale/nl_NL.po
 locale/ru_RU.po
+locale/sl_SI.po
 trytond_product_cost_history.egg-info/PKG-INFO
 trytond_product_cost_history.egg-info/SOURCES.txt
 trytond_product_cost_history.egg-info/dependency_links.txt
diff --git a/trytond_product_cost_history.egg-info/requires.txt b/trytond_product_cost_history.egg-info/requires.txt
index fd5ae88..a1fea53 100644
--- a/trytond_product_cost_history.egg-info/requires.txt
+++ b/trytond_product_cost_history.egg-info/requires.txt
@@ -1,2 +1,3 @@
-trytond_product >= 2.8, < 2.9
-trytond >= 2.8, < 2.9
\ No newline at end of file
+python-sql
+trytond_product >= 3.0, < 3.1
+trytond >= 3.0, < 3.1
\ No newline at end of file
-- 
tryton-modules-product-cost-history



More information about the tryton-debian-vcs mailing list