[tryton-debian-vcs] tryton-modules-stock-forecast branch upstream updated. upstream/3.8.0-1-g08572e8

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Thu Jun 2 16:27:43 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-stock-forecast.git;a=commitdiff;h=upstream/3.8.0-1-g08572e8

commit 08572e824147b590c0399321ab2cd1241853ddbf
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Fri May 27 18:26:19 2016 +0200

    Adding upstream version 4.0.0.
    
    Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>

diff --git a/CHANGELOG b/CHANGELOG
index dce57bb..903aead 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+Version 4.0.0 - 2016-05-02
+* Bug fixes (see mercurial logs for details)
+* Add Python3 support
+
 Version 3.8.0 - 2015-11-02
 * Bug fixes (see mercurial logs for details)
 
diff --git a/COPYRIGHT b/COPYRIGHT
index 4c7ddcd..fcc5eeb 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,6 +1,6 @@
-Copyright (C) 2008-2015 Cédric Krier.
+Copyright (C) 2008-2016 Cédric Krier.
 Copyright (C) 2008-2013 Bertrand Chenal.
-Copyright (C) 2008-2015 B2CK SPRL.
+Copyright (C) 2008-2016 B2CK SPRL.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/PKG-INFO b/PKG-INFO
index 8595415..523c3ad 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond_stock_forecast
-Version: 3.8.0
+Version: 4.0.0
 Summary: Tryton module with stock forecasts
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/3.8/
+Download-URL: http://downloads.tryton.org/4.0/
 Description: trytond_stock_forecast
         ======================
         
@@ -55,6 +55,7 @@ Classifier: Intended Audience :: Manufacturing
 Classifier: License :: OSI Approved :: GNU General Public License (GPL)
 Classifier: Natural Language :: Bulgarian
 Classifier: Natural Language :: Catalan
+Classifier: Natural Language :: Chinese (Simplified)
 Classifier: Natural Language :: Czech
 Classifier: Natural Language :: Dutch
 Classifier: Natural Language :: English
@@ -68,6 +69,9 @@ Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Office/Business
diff --git a/forecast.py b/forecast.py
index 3a89ef3..67357ab 100644
--- a/forecast.py
+++ b/forecast.py
@@ -1,5 +1,6 @@
 # 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 __future__ import division
 import datetime
 from dateutil.relativedelta import relativedelta
 import itertools
@@ -102,17 +103,17 @@ class Forecast(Workflow, ModelSQL, ModelView):
     def __register__(cls, module_name):
         Location = Pool().get('stock.location')
         TableHandler = backend.get('TableHandler')
-        cursor = Transaction().cursor
+        cursor = Transaction().connection.cursor()
         sql_table = cls.__table__()
 
-        table = TableHandler(cursor, cls, module_name)
+        table = TableHandler(cls, module_name)
         migrate_warehouse = (not table.column_exist('warehouse')
             and table.column_exist('location'))
 
         super(Forecast, cls).__register__(module_name)
 
         # Add index on create_date
-        table = TableHandler(cursor, cls, module_name)
+        table = TableHandler(cls, module_name)
         table.index_action('create_date', action='add')
 
         if migrate_warehouse:
@@ -193,7 +194,7 @@ class Forecast(Workflow, ModelSQL, ModelView):
             forecast.check_date_overlap()
 
     def check_date_overlap(self):
-        cursor = Transaction().cursor
+        cursor = Transaction().connection.cursor()
         if self.state != 'done':
             return
         forcast = self.__table__()
@@ -361,7 +362,7 @@ class ForecastLine(ModelSQL, ModelView):
 
     @classmethod
     def get_quantity_executed(cls, lines, name):
-        cursor = Transaction().cursor
+        cursor = Transaction().connection.cursor()
         pool = Pool()
         Move = pool.get('stock.move')
         Location = pool.get('stock.location')
@@ -435,8 +436,8 @@ class ForecastLine(ModelSQL, ModelView):
 
         delta = to_date - from_date
         delta = delta.days + 1
-        nb_packet = int((self.quantity - self.quantity_executed)
-            / self.minimal_quantity)
+        nb_packet = ((self.quantity - self.quantity_executed)
+            // self.minimal_quantity)
         distribution = self.distribute(delta, nb_packet)
         unit_price = None
         if self.forecast.destination.type == 'customer':
@@ -484,7 +485,7 @@ class ForecastLine(ModelSQL, ModelView):
             elif delta // qty > 1:
                 i = 0
                 while i < qty:
-                    a[i * delta // qty + (delta // qty / 2)] += 1
+                    a[i * delta // qty + (delta // qty // 2)] += 1
                     i += 1
                 qty = 0
             else:
@@ -493,7 +494,7 @@ class ForecastLine(ModelSQL, ModelView):
                 qty = delta - qty
                 i = 0
                 while i < qty:
-                    a[delta - ((i * delta // qty) + (delta // qty / 2)) - 1
+                    a[delta - ((i * delta // qty) + (delta // qty // 2)) - 1
                         ] -= 1
                     i += 1
                 qty = 0
diff --git a/locale/es_EC.po b/locale/es_EC.po
index 4604c63..5f63d95 100644
--- a/locale/es_EC.po
+++ b/locale/es_EC.po
@@ -281,7 +281,7 @@ msgstr "Líneas de previsión"
 
 msgctxt "view:stock.forecast:"
 msgid "Add forecast line based on past data."
-msgstr "Añadir líneas de proyecciones basadas en fechas pasadas."
+msgstr "Agregar líneas de proyecciones basadas en fechas pasadas."
 
 msgctxt "view:stock.forecast:"
 msgid "Cancel"
diff --git a/locale/es_MX.po b/locale/es_MX.po
index 98b3b83..da84f58 100644
--- a/locale/es_MX.po
+++ b/locale/es_MX.po
@@ -263,45 +263,53 @@ msgctxt "selection:stock.forecast,state:"
 msgid "Draft"
 msgstr "Borrador"
 
+#, fuzzy
 msgctxt "view:stock.forecast.complete.ask:"
 msgid "Choose dates"
-msgstr ""
+msgstr "Seleccionar fechas"
 
+#, fuzzy
 msgctxt "view:stock.forecast.complete.choose:"
 msgid "Choose products"
-msgstr ""
+msgstr "Seleccionar productos"
 
+#, fuzzy
 msgctxt "view:stock.forecast.line:"
 msgid "Forecast Line"
-msgstr ""
+msgstr "Línea de previsión"
 
+#, fuzzy
 msgctxt "view:stock.forecast.line:"
 msgid "Forecast Lines"
-msgstr ""
+msgstr "Línea de previsión"
 
 msgctxt "view:stock.forecast:"
 msgid "Add forecast line based on past data."
 msgstr ""
 
+#, fuzzy
 msgctxt "view:stock.forecast:"
 msgid "Cancel"
-msgstr ""
+msgstr "Cancelada"
 
+#, fuzzy
 msgctxt "view:stock.forecast:"
 msgid "Complete Forecast"
-msgstr ""
+msgstr "Previsión completa"
 
 msgctxt "view:stock.forecast:"
 msgid "Confirm"
 msgstr ""
 
+#, fuzzy
 msgctxt "view:stock.forecast:"
 msgid "Forecast"
-msgstr ""
+msgstr "Previsión"
 
+#, fuzzy
 msgctxt "view:stock.forecast:"
 msgid "Forecasts"
-msgstr ""
+msgstr "Previsiones"
 
 msgctxt "view:stock.forecast:"
 msgid "Reset to Draft"
diff --git a/locale/hu_HU.po b/locale/hu_HU.po
index a144685..742b3ba 100644
--- a/locale/hu_HU.po
+++ b/locale/hu_HU.po
@@ -4,205 +4,212 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
 
 msgctxt "error:stock.forecast.complete:"
 msgid "\"From Date\" should be smaller than \"To Date\"."
-msgstr ""
+msgstr "A \"Dátumtól\" a \"Dátumig\" előtti idő legyen"
 
 msgctxt "error:stock.forecast.line:"
 msgid "Line quantity must be greater than the minimal quantity"
-msgstr ""
+msgstr "A mennyiség a soron nagyobb legyen mint a minimum mennyiség."
 
 msgctxt "error:stock.forecast.line:"
 msgid "Line quantity must be positive"
-msgstr ""
+msgstr "A mennyiség a soron egy pozitív értéknek kell lenni."
 
 msgctxt "error:stock.forecast.line:"
 msgid "Product must be unique by forecast"
-msgstr ""
+msgstr "Egy variáció csak egyszer írható be ."
 
 msgctxt "error:stock.forecast:"
 msgid "\"To Date\" must be greater than \"From Date\""
-msgstr ""
+msgstr "A \"Dátumtól\" a \"Dátumig\" előtti idő legyen"
 
 msgctxt "error:stock.forecast:"
 msgid ""
 "Forecast \"%(first)s\" overlaps with dates of forecast \"%(second)s\" in the"
 " same location."
 msgstr ""
+"Előrejelzés \"%(first)s\" átfedi a dátumokat ugyan azon a raktárhelyiségen "
+"\"%(second)s\""
 
 msgctxt "error:stock.forecast:"
 msgid "Forecast \"%s\" must be cancelled before deletion."
-msgstr ""
+msgstr "Előrejelzés \"%s\" nullázni kell, mielőtt törölve van."
 
 msgctxt "field:stock.forecast,active:"
 msgid "Active"
-msgstr ""
+msgstr "Aktív"
 
 msgctxt "field:stock.forecast,company:"
 msgid "Company"
-msgstr ""
+msgstr "Társaság"
 
 msgctxt "field:stock.forecast,create_date:"
 msgid "Create Date"
-msgstr ""
+msgstr "Létrehozás dátuma"
 
 msgctxt "field:stock.forecast,create_uid:"
 msgid "Create User"
-msgstr ""
+msgstr "Által létrehozva"
 
 msgctxt "field:stock.forecast,destination:"
 msgid "Destination"
-msgstr ""
+msgstr "Cél"
 
 msgctxt "field:stock.forecast,from_date:"
 msgid "From Date"
-msgstr ""
+msgstr "Dátumtól"
 
 msgctxt "field:stock.forecast,id:"
 msgid "ID"
-msgstr ""
+msgstr "ID"
 
 msgctxt "field:stock.forecast,lines:"
 msgid "Lines"
-msgstr ""
+msgstr "Pozíció"
 
 msgctxt "field:stock.forecast,rec_name:"
 msgid "Name"
-msgstr ""
+msgstr "Név"
 
 msgctxt "field:stock.forecast,state:"
 msgid "State"
-msgstr ""
+msgstr "Állapot"
 
 msgctxt "field:stock.forecast,to_date:"
 msgid "To Date"
-msgstr ""
+msgstr "Dátumig"
 
 msgctxt "field:stock.forecast,warehouse:"
 msgid "Location"
-msgstr ""
+msgstr "Hely"
 
 msgctxt "field:stock.forecast,write_date:"
 msgid "Write Date"
-msgstr ""
+msgstr "Utolsó módosítás dátuma"
 
 msgctxt "field:stock.forecast,write_uid:"
 msgid "Write User"
-msgstr ""
+msgstr "Által módosítva"
 
 msgctxt "field:stock.forecast.complete.ask,from_date:"
 msgid "From Date"
-msgstr ""
+msgstr "Dátumtól"
 
 msgctxt "field:stock.forecast.complete.ask,id:"
 msgid "ID"
-msgstr ""
+msgstr "ID"
 
 msgctxt "field:stock.forecast.complete.ask,to_date:"
 msgid "To Date"
-msgstr ""
+msgstr "Dátumig"
 
 msgctxt "field:stock.forecast.complete.choose,id:"
 msgid "ID"
-msgstr ""
+msgstr "ID"
 
 msgctxt "field:stock.forecast.complete.choose,products:"
 msgid "Products"
-msgstr ""
+msgstr "Termékek"
 
 msgctxt "field:stock.forecast.line,create_date:"
 msgid "Create Date"
-msgstr ""
+msgstr "Létrehozás dátuma"
 
 msgctxt "field:stock.forecast.line,create_uid:"
 msgid "Create User"
-msgstr ""
+msgstr "Által lérehozva"
 
 msgctxt "field:stock.forecast.line,forecast:"
 msgid "Forecast"
-msgstr ""
+msgstr "Előrejelzés"
 
 msgctxt "field:stock.forecast.line,id:"
 msgid "ID"
-msgstr ""
+msgstr "ID"
 
 msgctxt "field:stock.forecast.line,minimal_quantity:"
 msgid "Minimal Qty"
-msgstr ""
+msgstr "Minimum mennyiség"
 
 msgctxt "field:stock.forecast.line,moves:"
 msgid "Moves"
-msgstr ""
+msgstr "Lépések"
 
 msgctxt "field:stock.forecast.line,product:"
 msgid "Product"
-msgstr ""
+msgstr "Termék"
 
 msgctxt "field:stock.forecast.line,product_uom_category:"
 msgid "Product Uom Category"
-msgstr ""
+msgstr "Mértékegység kategória"
 
 msgctxt "field:stock.forecast.line,quantity:"
 msgid "Quantity"
-msgstr ""
+msgstr "Mennyiség"
 
 msgctxt "field:stock.forecast.line,quantity_executed:"
 msgid "Quantity Executed"
-msgstr ""
+msgstr "Mennyiség kész"
 
 msgctxt "field:stock.forecast.line,rec_name:"
 msgid "Name"
-msgstr ""
+msgstr "Név"
 
 msgctxt "field:stock.forecast.line,unit_digits:"
 msgid "Unit Digits"
-msgstr ""
+msgstr "Tizedes vessző után"
 
 msgctxt "field:stock.forecast.line,uom:"
 msgid "UOM"
-msgstr ""
+msgstr "Mértékegység"
 
 msgctxt "field:stock.forecast.line,write_date:"
 msgid "Write Date"
-msgstr ""
+msgstr "Utolsó módosítás dátuma"
 
 msgctxt "field:stock.forecast.line,write_uid:"
 msgid "Write User"
-msgstr ""
+msgstr "Által módosítva"
 
 msgctxt "field:stock.forecast.line-stock.move,create_date:"
 msgid "Create Date"
-msgstr ""
+msgstr "Létrehozás dátuma"
 
 msgctxt "field:stock.forecast.line-stock.move,create_uid:"
 msgid "Create User"
-msgstr ""
+msgstr "Által létrehozva"
 
 msgctxt "field:stock.forecast.line-stock.move,id:"
 msgid "ID"
-msgstr ""
+msgstr "ID"
 
 msgctxt "field:stock.forecast.line-stock.move,line:"
 msgid "Forecast Line"
 msgstr ""
 
+#, fuzzy
 msgctxt "field:stock.forecast.line-stock.move,move:"
 msgid "Move"
-msgstr ""
+msgstr "Lépések"
 
+#, fuzzy
 msgctxt "field:stock.forecast.line-stock.move,rec_name:"
 msgid "Name"
-msgstr ""
+msgstr "Név"
 
+#, fuzzy
 msgctxt "field:stock.forecast.line-stock.move,write_date:"
 msgid "Write Date"
-msgstr ""
+msgstr "Utolsó módosítás dátuma"
 
+#, fuzzy
 msgctxt "field:stock.forecast.line-stock.move,write_uid:"
 msgid "Write User"
-msgstr ""
+msgstr "Által módosítva"
 
+#, fuzzy
 msgctxt "model:ir.action,name:act_forecast_form"
 msgid "Forecasts"
-msgstr ""
+msgstr "Előrejelzés"
 
 msgctxt "model:ir.action,name:wizard_forecast_complete"
 msgid "Complete Forecast"
@@ -221,9 +228,10 @@ msgctxt ""
 msgid "Draft"
 msgstr ""
 
+#, fuzzy
 msgctxt "model:ir.ui.menu,name:menu_forecast_form"
 msgid "Forecasts"
-msgstr ""
+msgstr "Előrejelzés"
 
 msgctxt "model:res.group,name:group_stock_forecast"
 msgid "Stock Forecast"
@@ -293,13 +301,15 @@ msgctxt "view:stock.forecast:"
 msgid "Confirm"
 msgstr ""
 
+#, fuzzy
 msgctxt "view:stock.forecast:"
 msgid "Forecast"
-msgstr ""
+msgstr "Előrejelzés"
 
+#, fuzzy
 msgctxt "view:stock.forecast:"
 msgid "Forecasts"
-msgstr ""
+msgstr "Előrejelzés"
 
 msgctxt "view:stock.forecast:"
 msgid "Reset to Draft"
diff --git a/locale/hu_HU.po b/locale/lo_LA.po
similarity index 100%
copy from locale/hu_HU.po
copy to locale/lo_LA.po
diff --git a/locale/hu_HU.po b/locale/zh_CN.po
similarity index 100%
copy from locale/hu_HU.po
copy to locale/zh_CN.po
diff --git a/setup.py b/setup.py
index c661dc4..fcc9665 100644
--- a/setup.py
+++ b/setup.py
@@ -5,11 +5,17 @@
 from setuptools import setup
 import re
 import os
-import ConfigParser
+import io
+try:
+    from configparser import ConfigParser
+except ImportError:
+    from ConfigParser import ConfigParser
 
 
 def read(fname):
-    return open(os.path.join(os.path.dirname(__file__), fname)).read()
+    return io.open(
+        os.path.join(os.path.dirname(__file__), fname),
+        'r', encoding='utf-8').read()
 
 
 def get_require_version(name):
@@ -21,7 +27,7 @@ def get_require_version(name):
         major_version, minor_version + 1)
     return require
 
-config = ConfigParser.ConfigParser()
+config = ConfigParser()
 config.readfp(open('tryton.cfg'))
 info = dict(config.items('tryton'))
 for key in ('depends', 'extras_depend', 'xml'):
@@ -43,7 +49,7 @@ if minor_version % 2:
 
 requires = ['python-dateutil', 'python-sql >= 0.4']
 for dep in info.get('depends', []):
-    if not re.match(r'(ir|res|webdav)(\W|$)', dep):
+    if not re.match(r'(ir|res)(\W|$)', dep):
         requires.append(get_require_version('trytond_%s' % dep))
 requires.append(get_require_version('trytond'))
 
@@ -76,6 +82,7 @@ setup(name=name,
         'License :: OSI Approved :: GNU General Public License (GPL)',
         'Natural Language :: Bulgarian',
         'Natural Language :: Catalan',
+        'Natural Language :: Chinese (Simplified)',
         'Natural Language :: Czech',
         'Natural Language :: Dutch',
         'Natural Language :: English',
@@ -89,6 +96,9 @@ setup(name=name,
         'Natural Language :: Spanish',
         'Operating System :: OS Independent',
         'Programming Language :: Python :: 2.7',
+        'Programming Language :: Python :: 3.3',
+        'Programming Language :: Python :: 3.4',
+        'Programming Language :: Python :: 3.5',
         'Programming Language :: Python :: Implementation :: CPython',
         'Programming Language :: Python :: Implementation :: PyPy',
         'Topic :: Office/Business',
@@ -102,4 +112,5 @@ setup(name=name,
     """,
     test_suite='tests',
     test_loader='trytond.test_loader:Loader',
+    use_2to3=True,
     )
diff --git a/tests/__init__.py b/tests/__init__.py
index 6988ffb..5d3d1f3 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -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 .test_stock_forecast import suite
+try:
+    from trytond.modules.stock_forecast.tests.test_stock_forecast import suite
+except ImportError:
+    from .test_stock_forecast import suite
 
 __all__ = ['suite']
diff --git a/tests/test_stock_forecast.py b/tests/test_stock_forecast.py
index 1adc80c..a2cf713 100644
--- a/tests/test_stock_forecast.py
+++ b/tests/test_stock_forecast.py
@@ -1,81 +1,67 @@
 # This file is part of Tryton.  The COPYRIGHT file at the top level of
 # this repository contains the full copyright notices and license terms.
 import unittest
-import doctest
 from decimal import Decimal
 import datetime
 from dateutil.relativedelta import relativedelta
 import trytond.tests.test_tryton
-from trytond.tests.test_tryton import ModuleTestCase
-from trytond.tests.test_tryton import POOL, DB_NAME, USER, CONTEXT
+from trytond.tests.test_tryton import ModuleTestCase, with_transaction
 from trytond.transaction import Transaction
+from trytond.pool import Pool
+
+from trytond.modules.company.tests import create_company, set_company
 
 
 class StockForecastTestCase(ModuleTestCase):
     'Test StockForecast module'
     module = 'stock_forecast'
 
-    def setUp(self):
-        super(StockForecastTestCase, self).setUp()
-        self.category = POOL.get('product.category')
-        self.uom = POOL.get('product.uom')
-        self.template = POOL.get('product.template')
-        self.product = POOL.get('product.product')
-        self.location = POOL.get('stock.location')
-        self.company = POOL.get('company.company')
-        self.user = POOL.get('res.user')
-        self.forecast = POOL.get('stock.forecast')
-        self.line = POOL.get('stock.forecast.line')
-        self.move = POOL.get('stock.move')
-        self.forecast_complete = POOL.get('stock.forecast.complete',
-            type='wizard')
-
-    def test0020distribute(self):
+    @with_transaction()
+    def test_distribute(self):
         'Test distribute'
-        with Transaction().start(DB_NAME, USER, context=CONTEXT):
-            line = self.line()
-            for values, result in (
-                    ((1, 5), {0: 5}),
-                    ((4, 8), {0: 2, 1: 2, 2: 2, 3: 2}),
-                    ((2, 5), {0: 2, 1: 3}),
-                    ((10, 4), {0: 0, 1: 1, 2: 0, 3: 1, 4: 0,
-                            5: 0, 6: 1, 7: 0, 8: 1, 9: 0}),
-                    ):
-                self.assertEqual(line.distribute(*values), result)
-
-    def test0030create_moves(self):
+        pool = Pool()
+        Line = pool.get('stock.forecast.line')
+        line = Line()
+        for values, result in (
+                ((1, 5), {0: 5}),
+                ((4, 8), {0: 2, 1: 2, 2: 2, 3: 2}),
+                ((2, 5), {0: 2, 1: 3}),
+                ((10, 4), {0: 0, 1: 1, 2: 0, 3: 1, 4: 0,
+                        5: 0, 6: 1, 7: 0, 8: 1, 9: 0}),
+                ):
+            self.assertEqual(line.distribute(*values), result)
+
+    @with_transaction()
+    def test_create_moves(self):
         'Test create_moves'
-        with Transaction().start(DB_NAME, USER, context=CONTEXT):
-            category, = self.category.create([{
-                        'name': 'Test create_moves',
-                        }])
-            unit, = self.uom.search([('name', '=', 'Unit')])
-            template, = self.template.create([{
-                        'name': 'Test create_moves',
-                        'type': 'goods',
-                        'category': category.id,
-                        'cost_price_method': 'fixed',
-                        'default_uom': unit.id,
-                        'list_price': Decimal('1'),
-                        'cost_price': Decimal(0),
-                        }])
-            product, = self.product.create([{
-                        'template': template.id,
-                        }])
-            customer, = self.location.search([('code', '=', 'CUS')])
-            warehouse, = self.location.search([('code', '=', 'WH')])
-            storage, = self.location.search([('code', '=', 'STO')])
-            company, = self.company.search([
-                    ('rec_name', '=', 'Dunder Mifflin'),
-                    ])
-            self.user.write([self.user(USER)], {
-                    'main_company': company.id,
-                    'company': company.id,
-                    })
-
+        pool = Pool()
+        Uom = pool.get('product.uom')
+        Template = pool.get('product.template')
+        Product = pool.get('product.product')
+        Location = pool.get('stock.location')
+        Forecast = pool.get('stock.forecast')
+        Move = pool.get('stock.move')
+
+        unit, = Uom.search([('name', '=', 'Unit')])
+        template, = Template.create([{
+                    'name': 'Test create_moves',
+                    'type': 'goods',
+                    'cost_price_method': 'fixed',
+                    'default_uom': unit.id,
+                    'list_price': Decimal('1'),
+                    'cost_price': Decimal(0),
+                    }])
+        product, = Product.create([{
+                    'template': template.id,
+                    }])
+        customer, = Location.search([('code', '=', 'CUS')])
+        warehouse, = Location.search([('code', '=', 'WH')])
+        storage, = Location.search([('code', '=', 'STO')])
+        company = create_company()
+        with set_company(company):
             today = datetime.date.today()
 
-            forecast, = self.forecast.create([{
+            forecast, = Forecast.create([{
                         'warehouse': warehouse.id,
                         'destination': customer.id,
                         'from_date': today + relativedelta(months=1, day=1),
@@ -91,19 +77,19 @@ class StockForecastTestCase(ModuleTestCase):
                                 ),
                             ],
                         }])
-            self.forecast.confirm([forecast])
+            Forecast.confirm([forecast])
 
-            self.forecast.create_moves([forecast])
+            Forecast.create_moves([forecast])
             line, = forecast.lines
             self.assertEqual(line.quantity_executed, 0)
             self.assertEqual(len(line.moves), 5)
             self.assertEqual(sum(move.quantity for move in line.moves), 10)
 
-            self.forecast.delete_moves([forecast])
+            Forecast.delete_moves([forecast])
             line, = forecast.lines
             self.assertEqual(len(line.moves), 0)
 
-            self.move.create([{
+            Move.create([{
                         'from_location': storage.id,
                         'to_location': customer.id,
                         'product': product.id,
@@ -117,48 +103,45 @@ class StockForecastTestCase(ModuleTestCase):
             line, = forecast.lines
             self.assertEqual(line.quantity_executed, 2)
 
-            self.forecast.create_moves([forecast])
+            Forecast.create_moves([forecast])
             line, = forecast.lines
             self.assertEqual(line.quantity_executed, 2)
             self.assertEqual(len(line.moves), 4)
             self.assertEqual(sum(move.quantity for move in line.moves), 8)
 
-    def test0040complete(self):
-        '''
-        Test complete.
-        '''
-        with Transaction().start(DB_NAME, USER, context=CONTEXT):
-            category, = self.category.create([{
-                        'name': 'Test complete',
-                        }])
-            unit, = self.uom.search([('name', '=', 'Unit')])
-            template, = self.template.create([{
-                        'name': 'Test complete',
-                        'type': 'goods',
-                        'category': category.id,
-                        'cost_price_method': 'fixed',
-                        'default_uom': unit.id,
-                        'list_price': Decimal('1'),
-                        'cost_price': Decimal(0),
-                        }])
-            product, = self.product.create([{
-                        'template': template.id,
-                        }])
-            customer, = self.location.search([('code', '=', 'CUS')])
-            supplier, = self.location.search([('code', '=', 'SUP')])
-            warehouse, = self.location.search([('code', '=', 'WH')])
-            storage, = self.location.search([('code', '=', 'STO')])
-            company, = self.company.search([
-                    ('rec_name', '=', 'Dunder Mifflin'),
-                    ])
-            self.user.write([self.user(USER)], {
-                    'main_company': company.id,
-                    'company': company.id,
-                    })
-
+    @with_transaction()
+    def test_complete(self):
+        'Test complete'
+        pool = Pool()
+        Uom = pool.get('product.uom')
+        Template = pool.get('product.template')
+        Product = pool.get('product.product')
+        Location = pool.get('stock.location')
+        Forecast = pool.get('stock.forecast')
+        Move = pool.get('stock.move')
+        ForecastComplete = pool.get('stock.forecast.complete', type='wizard')
+
+        unit, = Uom.search([('name', '=', 'Unit')])
+        template, = Template.create([{
+                    'name': 'Test complete',
+                    'type': 'goods',
+                    'cost_price_method': 'fixed',
+                    'default_uom': unit.id,
+                    'list_price': Decimal('1'),
+                    'cost_price': Decimal(0),
+                    }])
+        product, = Product.create([{
+                    'template': template.id,
+                    }])
+        customer, = Location.search([('code', '=', 'CUS')])
+        supplier, = Location.search([('code', '=', 'SUP')])
+        warehouse, = Location.search([('code', '=', 'WH')])
+        storage, = Location.search([('code', '=', 'STO')])
+        company = create_company()
+        with set_company(company):
             today = datetime.date.today()
 
-            moves = self.move.create([{
+            moves = Move.create([{
                         'from_location': supplier.id,
                         'to_location': storage.id,
                         'product': product.id,
@@ -181,9 +164,9 @@ class StockForecastTestCase(ModuleTestCase):
                         'currency': company.currency.id,
                         'unit_price': Decimal('1'),
                         }])
-            self.move.do(moves)
+            Move.do(moves)
 
-            forecast, = self.forecast.create([{
+            forecast, = Forecast.create([{
                         'warehouse': warehouse.id,
                         'destination': customer.id,
                         'from_date': today + relativedelta(months=1, day=1),
@@ -192,12 +175,12 @@ class StockForecastTestCase(ModuleTestCase):
                         }])
 
             with Transaction().set_context(active_id=forecast.id):
-                session_id, _, _ = self.forecast_complete.create()
-                forecast_complete = self.forecast_complete(session_id)
-                forecast_complete.ask.from_date = (today
-                        + relativedelta(months=-1, day=1))
-                forecast_complete.ask.to_date = (today
-                        + relativedelta(months=-1, day=20))
+                session_id, _, _ = ForecastComplete.create()
+                forecast_complete = ForecastComplete(session_id)
+                forecast_complete.ask.from_date = (
+                    today + relativedelta(months=-1, day=1))
+                forecast_complete.ask.to_date = (
+                    today + relativedelta(months=-1, day=20))
                 forecast_complete.transition_complete()
 
             self.assertEqual(len(forecast.lines), 1)
@@ -210,10 +193,6 @@ class StockForecastTestCase(ModuleTestCase):
 
 def suite():
     suite = trytond.tests.test_tryton.suite()
-    from trytond.modules.company.tests import test_company
-    for test in test_company.suite():
-        if test not in suite and not isinstance(test, doctest.DocTestCase):
-            suite.addTest(test)
     suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
             StockForecastTestCase))
     return suite
diff --git a/tryton.cfg b/tryton.cfg
index 763f4ff..f7ea245 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=3.8.0
+version=4.0.0
 depends:
     company
     ir
diff --git a/trytond_stock_forecast.egg-info/PKG-INFO b/trytond_stock_forecast.egg-info/PKG-INFO
index 2cef036..67c187e 100644
--- a/trytond_stock_forecast.egg-info/PKG-INFO
+++ b/trytond_stock_forecast.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond-stock-forecast
-Version: 3.8.0
+Version: 4.0.0
 Summary: Tryton module with stock forecasts
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/3.8/
+Download-URL: http://downloads.tryton.org/4.0/
 Description: trytond_stock_forecast
         ======================
         
@@ -55,6 +55,7 @@ Classifier: Intended Audience :: Manufacturing
 Classifier: License :: OSI Approved :: GNU General Public License (GPL)
 Classifier: Natural Language :: Bulgarian
 Classifier: Natural Language :: Catalan
+Classifier: Natural Language :: Chinese (Simplified)
 Classifier: Natural Language :: Czech
 Classifier: Natural Language :: Dutch
 Classifier: Natural Language :: English
@@ -68,6 +69,9 @@ Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Office/Business
diff --git a/trytond_stock_forecast.egg-info/SOURCES.txt b/trytond_stock_forecast.egg-info/SOURCES.txt
index e32aeee..07715e5 100644
--- a/trytond_stock_forecast.egg-info/SOURCES.txt
+++ b/trytond_stock_forecast.egg-info/SOURCES.txt
@@ -51,11 +51,13 @@ locale/fr_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/pt_BR.po
 locale/ru_RU.po
 locale/sl_SI.po
+locale/zh_CN.po
 trytond_stock_forecast.egg-info/PKG-INFO
 trytond_stock_forecast.egg-info/SOURCES.txt
 trytond_stock_forecast.egg-info/dependency_links.txt
diff --git a/trytond_stock_forecast.egg-info/requires.txt b/trytond_stock_forecast.egg-info/requires.txt
index 6b7d48f..a36f526 100644
--- a/trytond_stock_forecast.egg-info/requires.txt
+++ b/trytond_stock_forecast.egg-info/requires.txt
@@ -1,6 +1,6 @@
 python-dateutil
 python-sql >= 0.4
-trytond_company >= 3.8, < 3.9
-trytond_product >= 3.8, < 3.9
-trytond_stock >= 3.8, < 3.9
-trytond >= 3.8, < 3.9
\ No newline at end of file
+trytond_company >= 4.0, < 4.1
+trytond_product >= 4.0, < 4.1
+trytond_stock >= 4.0, < 4.1
+trytond >= 4.0, < 4.1
\ No newline at end of file
-- 
tryton-modules-stock-forecast



More information about the tryton-debian-vcs mailing list