[Python-modules-commits] [python-odoorpc] 01/05: Import python-odoorpc_0.4.1.orig.tar.gz

Wolfgang Borgert debacle at moszumanska.debian.org
Sun Nov 29 00:29:39 UTC 2015


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to branch master
in repository python-odoorpc.

commit 8b193f3b4d3c8c9b20f0b80ec6ce2ea28df03fbc
Author: W. Martin Borgert <debacle at debian.org>
Date:   Sat Nov 28 01:11:08 2015 +0100

    Import python-odoorpc_0.4.1.orig.tar.gz
---
 .travis.yml                           | 27 ++++++++++++++------
 CHANGELOG                             | 13 ++++++++++
 README.rst                            | 17 +++++++------
 bump_version.sh                       |  9 +++++++
 doc/source/index.rst                  | 17 +++++++------
 doc/source/ref_env.rst                |  2 +-
 odoorpc/__init__.py                   |  2 +-
 odoorpc/db.py                         | 10 +++++---
 odoorpc/env.py                        | 14 ++++++++++-
 odoorpc/fields.py                     |  2 +-
 odoorpc/models.py                     |  2 +-
 odoorpc/odoo.py                       | 31 ++++++++++-------------
 odoorpc/report.py                     | 14 ++++++-----
 odoorpc/rpc/__init__.py               |  2 +-
 odoorpc/rpc/jsonrpclib.py             | 12 ++++++---
 odoorpc/session.py                    |  2 +-
 odoorpc/tests/__init__.py             | 10 +++++---
 odoorpc/tests/test_env.py             |  4 +++
 odoorpc/tests/test_field_integer.py   | 46 +++++++++++++++++------------------
 odoorpc/tests/test_field_reference.py | 20 +++++++--------
 odoorpc/tests/test_report.py          |  6 +++--
 odoorpc/tests/test_timeout.py         |  2 +-
 odoorpc/tests/test_workflow.py        |  2 ++
 setup.py                              |  3 ++-
 24 files changed, 166 insertions(+), 103 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index bd1ee12..4880f3e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,20 +4,31 @@ python:
   - "3.2"
   - "3.3"
   - "3.4"
+  - "3.5"
   - "pypy"
 
-install:
+env:
+  - ODOO_BRANCH=8.0 ORPC_TEST_VERSION=$ODOO_BRANCH
+  - ODOO_BRANCH=9.0 ORPC_TEST_VERSION=$ODOO_BRANCH
+
+before_install:
+  # Install wkhtmltox
   - "wget http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-precise-amd64.deb"
   - "sudo dpkg -i wkhtmltox-0.12.1_linux-precise-amd64.deb || true"
-  - "wget http://nightly.odoo.com/8.0/nightly/deb/odoo_8.0.latest_all.deb"
-  - "sudo dpkg -i odoo_8.0.latest_all.deb || true"
   - "sudo apt-get update && sudo apt-get install -f -y"
-  - "sudo invoke-rc.d odoo stop"
-  - pip install sphinx
+  # Install Odoo on the system (outside the virtualenv)
+  - "sudo git clone --depth=1 -b $ODOO_BRANCH https://github.com/odoo/odoo.git /opt/odoo"
+  - "sudo apt-get install python-pip"
+  - "sudo /usr/bin/pip install -r /opt/odoo/requirements.txt"
+  - "echo $PWD"
+  - "cd /opt/odoo && sudo /usr/bin/python setup.py install"
+  - "cd $TRAVIS_BUILD_DIR"
+  # Start Odoo
+  - "nohup /usr/bin/python2.7 /usr/local/bin/openerp-server -r $USER --addons-path=/opt/odoo/addons &"
 
-before_script:
-  - nohup /usr/bin/openerp-server -r $USER --addons-path=/usr/lib/python2.7/dist-packages/openerp/addons &
-  - sleep 5
+install:
+  # OdooRPC dependencies
+  - pip install sphinx
 
 script:
   - python -m unittest discover -v
diff --git a/CHANGELOG b/CHANGELOG
index 6189c5c..d59e609 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,16 @@
+0.4.1
+=====
+- IMP: New feature, check if a model exists in the Odoo database (see the
+  README or Quick Start section in the documentation)
+- IMP: Support added for Jython 270
+- FIX: Some methods in Odoo 9 return no result (issue #12)
+
+0.4.0
+=====
+- IMP: Support added for Odoo 9.0
+- IMP: Support added for Python 3.5
+- IMP: The 'data' parameter of the 'ODOO.http()' method is now optional
+
 0.3.0
 =====
 - FIX: 'ODOO.exec_workflow()' method now works correctly (issue #7)
diff --git a/README.rst b/README.rst
index daf22fc..6e26a97 100644
--- a/README.rst
+++ b/README.rst
@@ -57,12 +57,13 @@ How does it work? See below:
     print(user_data)
 
     # Use all methods of a model
-    Order = odoo.env['sale.order']
-    order_ids = Order.search([])
-    for order in Order.browse(order_ids):
-        print(order.name)
-        products = [line.product_id.name for line in order.order_line]
-        print(products)
+    if 'sale.order' in odoo.env:
+        Order = odoo.env['sale.order']
+        order_ids = Order.search([])
+        for order in Order.browse(order_ids):
+            print(order.name)
+            products = [line.product_id.name for line in order.order_line]
+            print(products)
 
     # Update data through a record
     user.name = "Brian Jones"
@@ -72,13 +73,13 @@ See the documentation for more details and features.
 Supported Odoo server versions
 ------------------------------
 
-`OdooRPC` has been tested on `Odoo` server 8.0.
+`OdooRPC` has been tested on `Odoo` 8.0 and 9.0.
 It should work on next versions if `Odoo` keeps a stable API.
 
 Supported Python versions
 -------------------------
 
-`OdooRPC` support Python 2.7, 3.2, 3.3 and 3.4.
+`OdooRPC` support Python 2.7, 3.2, 3.3, 3.4 and 3.5.
 
 License
 -------
diff --git a/bump_version.sh b/bump_version.sh
new file mode 100755
index 0000000..d0574b4
--- /dev/null
+++ b/bump_version.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+# Update the version and commit:
+#
+#   $ ./bump_version.sh X.Y.Z
+#
+HERE=$(dirname $(readlink -m $0))
+sed -i "s/^__version__.*/__version__ = '$1'/" $HERE/odoorpc/__init__.py
+sed -i "s/^version =.*/version = '$1'/" $HERE/setup.py
+git ci -a -m "[IMP] Bump version to $1"
diff --git a/doc/source/index.rst b/doc/source/index.rst
index a8e82b1..4910266 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -50,12 +50,13 @@ How does it work? See below::
     print(user_data)
 
     # Use all methods of a model
-    Order = odoo.env['sale.order']
-    order_ids = Order.search([])
-    for order in Order.browse(order_ids):
-        print(order.name)
-        products = [line.product_id.name for line in order.order_line]
-        print(products)
+    if 'sale.order' in odoo.env:
+        Order = odoo.env['sale.order']
+        order_ids = Order.search([])
+        for order in Order.browse(order_ids):
+            print(order.name)
+            products = [line.product_id.name for line in order.order_line]
+            print(products)
 
     # Update data through a record
     user.name = "Brian Jones"
@@ -78,13 +79,13 @@ Contents
 Supported Odoo server versions
 ------------------------------
 
-`OdooRPC` has been tested on `Odoo` server 8.0.
+`OdooRPC` has been tested on `Odoo` 8.0 and 9.0.
 It should work on next versions if `Odoo` keeps a stable API.
 
 Supported Python versions
 -------------------------
 
-`OdooRPC` support Python 2.7, 3.2, 3.3 and 3.4.
+`OdooRPC` support Python 2.7, 3.2, 3.3, 3.4 and 3.5.
 
 License
 -------
diff --git a/doc/source/ref_env.rst b/doc/source/ref_env.rst
index 2381fbc..c1fcffa 100644
--- a/doc/source/ref_env.rst
+++ b/doc/source/ref_env.rst
@@ -3,5 +3,5 @@ odoorpc.env
 
 .. automodule:: odoorpc.env
     :members:
-    :special-members: __getitem__
+    :special-members: __getitem__, __contains__
     :exclude-members: commit, dirty, invalidate
diff --git a/odoorpc/__init__.py b/odoorpc/__init__.py
index 32a53b3..5ea79fc 100644
--- a/odoorpc/__init__.py
+++ b/odoorpc/__init__.py
@@ -28,7 +28,7 @@ automated jobs that communicate with a `Odoo` server.
 __author__ = 'ABF Osiell - Sebastien Alix'
 __email__ = 'sebastien.alix at osiell.com'
 __licence__ = 'LGPL v3'
-__version__ = '0.3.0'
+__version__ = '0.4.1'
 
 __all__ = ['ODOO', 'error']
 
diff --git a/odoorpc/db.py b/odoorpc/db.py
index 990f36a..0d3da8b 100644
--- a/odoorpc/db.py
+++ b/odoorpc/db.py
@@ -23,7 +23,7 @@ import base64
 import io
 import sys
 # Python 2
-if sys.version_info.major < 3:
+if sys.version_info[0] < 3:
     def encode2bytes(data):
         return data
 # Python >= 3
@@ -32,6 +32,7 @@ else:
         return bytes(data, 'ascii')
 
 from odoorpc import error
+from odoorpc.tools import v
 
 
 class DB(object):
@@ -52,7 +53,7 @@ class DB(object):
     def __init__(self, odoo):
         self._odoo = odoo
 
-    def dump(self, password, db):
+    def dump(self, password, db, format_='zip'):
         """Backup the `db` database. Returns the dump as a binary ZIP file
         containing the SQL dump file alongside the filestore directory (if any).
 
@@ -120,11 +121,14 @@ class DB(object):
         :raise: :class:`odoorpc.error.RPCError` (access denied / wrong database)
         :raise: `urllib.error.URLError` (connection error)
         """
+        args = [password, db]
+        if v(self._odoo.version)[0] >= 9:
+            args.append(format_)
         data = self._odoo.json(
             '/jsonrpc',
             {'service': 'db',
              'method': 'dump',
-             'args': [password, db]})
+             'args': args})
         # Encode to bytes forced to be compatible with Python 3.2
         # (its 'base64.standard_b64decode()' function only accepts bytes)
         result = encode2bytes(data['result'])
diff --git a/odoorpc/env.py b/odoorpc/env.py
index 5f6ca4a..efde78d 100644
--- a/odoorpc/env.py
+++ b/odoorpc/env.py
@@ -281,6 +281,18 @@ class Environment(object):
         env._registry = self._registry
         return env
 
+    def __contains__(self, model):
+        """Check if the given `model` exists on the server.
+
+        >>> 'res.partner' in odoo.env
+        True
+
+        :return: `True` or `False`
+        """
+        model_exists = self._odoo.execute('ir.model', 'search',
+                                          [('model', '=', model)])
+        return bool(model_exists)
+
     def _create_model_class(self, model):
         """Generate the model proxy class.
 
@@ -288,7 +300,7 @@ class Environment(object):
         """
         cls_name = model.replace('.', '_')
         # Hack for Python 2 (no need to do this for Python 3)
-        if sys.version_info.major < 3:
+        if sys.version_info[0] < 3:
             if isinstance(cls_name, unicode):
                 cls_name = cls_name.encode('utf-8')
         # Retrieve server fields info and generate corresponding local fields
diff --git a/odoorpc/fields.py b/odoorpc/fields.py
index 6fd2e6a..a5ca402 100644
--- a/odoorpc/fields.py
+++ b/odoorpc/fields.py
@@ -41,7 +41,7 @@ def is_int(value):
 
 
 # Python 2
-if sys.version_info.major < 3:
+if sys.version_info[0] < 3:
     def is_string(value):
         """Return `True` if ``value`` is a string."""
         return isinstance(value, basestring)
diff --git a/odoorpc/models.py b/odoorpc/models.py
index 38f1943..67a85f8 100644
--- a/odoorpc/models.py
+++ b/odoorpc/models.py
@@ -29,7 +29,7 @@ import sys
 from odoorpc import error
 
 # Python 2
-if sys.version_info.major < 3:
+if sys.version_info[0] < 3:
     NORMALIZED_TYPES = (int, long, str, unicode)
 # Python >= 3
 else:
diff --git a/odoorpc/odoo.py b/odoorpc/odoo.py
index 8484144..ffaca4f 100644
--- a/odoorpc/odoo.py
+++ b/odoorpc/odoo.py
@@ -125,6 +125,9 @@ class ODOO(object):
           be sent automatically to every call of a
           :class:`model <odoorpc.models.Model>` method (default: `True`):
 
+        .. doctest::
+            :options: +SKIP
+
             >>> odoo.env.context['lang'] = 'fr_FR'
             >>> Product = odoo.env['product.product']
             >>> Product.name_get([2])   # Context sent by default ('lang': 'fr_FR' here)
@@ -145,8 +148,11 @@ class ODOO(object):
     def version(self):
         """The version of the server.
 
-        >>> odoo.version
-        '8.0'
+        .. doctest::
+            :options: +SKIP
+
+            >>> odoo.version
+            '8.0'
         """
         return self._connector.version
 
@@ -261,7 +267,7 @@ class ODOO(object):
                 data['error'])
         return data
 
-    def http(self, url, data, headers=None):
+    def http(self, url, data=None, headers=None):
         """Low level method to execute raw HTPP queries.
 
         .. note::
@@ -278,19 +284,8 @@ class ODOO(object):
         E.g., the HTTP raw query to backup a database on `Odoo 8.0`:
 
         .. doctest::
-            :options: +SKIP
-
-            >>> response = odoo.http(
-            ...     'web/database/backup',
-            ...     'token=foo&backup_pwd=admin&backup_db=db_name')
-            >>> binary_data = response.read()
-
-        .. doctest::
-            :hide:
 
-            >>> response = odoo.http(
-            ...     'web/database/backup',
-            ...     'token=foo&backup_pwd=%s&backup_db=%s' % (SUPER_PWD, DB))
+            >>> response = odoo.http('web/binary/company_logo')
             >>> binary_data = response.read()
 
         *Python 2:*
@@ -422,7 +417,7 @@ class ODOO(object):
             {'service': 'object',
              'method': 'execute',
              'args': args_to_send})
-        return data['result']
+        return data.get('result')
 
     def execute_kw(self, model, method, args=None, kwargs=None):
         """Execute the `method` of `model`.
@@ -471,7 +466,7 @@ class ODOO(object):
             {'service': 'object',
              'method': 'execute_kw',
              'args': args_to_send})
-        return data['result']
+        return data.get('result')
 
     def exec_workflow(self, model, record_id, signal):
         """Execute the workflow `signal` on
@@ -498,7 +493,7 @@ class ODOO(object):
             {'service': 'object',
              'method': 'exec_workflow',
              'args': args_to_send})
-        return data['result']
+        return data.get('result')
 
     # ---------------------- #
     # -- Session methods  -- #
diff --git a/odoorpc/report.py b/odoorpc/report.py
index 4d1cfea..07cd0e8 100644
--- a/odoorpc/report.py
+++ b/odoorpc/report.py
@@ -25,7 +25,7 @@ import base64
 import io
 import sys
 # Python 2
-if sys.version_info.major < 3:
+if sys.version_info[0] < 3:
     def encode2bytes(data):
         return data
 # Python >= 3
@@ -128,7 +128,10 @@ class Report(object):
             :options: +SKIP
 
             >>> odoo.report.list()['account.invoice']
-            [{'name': 'Invoices',
+            [{'name': u'Duplicates',
+              'report_name': u'account.account_invoice_report_duplicate_main',
+              'report_type': u'qweb-pdf'},
+             {'name': 'Invoices',
               'report_type': 'qweb-pdf',
               'report_name': 'account.report_invoice'}]
 
@@ -136,10 +139,9 @@ class Report(object):
             :hide:
 
             >>> from pprint import pprint as pp
-            >>> pp(odoo.report.list()['account.invoice'])
-            [{'name': 'Invoices',
-              'report_name': 'account.report_invoice',
-              'report_type': 'qweb-pdf'}]
+            >>> any(data['report_name'] == 'account.report_invoice'
+            ...     for data in odoo.report.list()['account.invoice'])
+            True
 
         *Python 2:*
 
diff --git a/odoorpc/rpc/__init__.py b/odoorpc/rpc/__init__.py
index 6007311..c328c89 100644
--- a/odoorpc/rpc/__init__.py
+++ b/odoorpc/rpc/__init__.py
@@ -26,7 +26,7 @@ These methods can be accessed from the connectors of this module.
 """
 import sys
 # Python 2
-if sys.version_info.major < 3:
+if sys.version_info[0] < 3:
     from urllib2 import build_opener, HTTPCookieProcessor
     from cookielib import CookieJar
 # Python >= 3
diff --git a/odoorpc/rpc/jsonrpclib.py b/odoorpc/rpc/jsonrpclib.py
index 66b9aa2..7748ef1 100644
--- a/odoorpc/rpc/jsonrpclib.py
+++ b/odoorpc/rpc/jsonrpclib.py
@@ -23,7 +23,7 @@ import json
 import random
 import sys
 # Python 2
-if sys.version_info.major < 3:
+if sys.version_info[0] < 3:
     from urllib2 import build_opener, HTTPCookieProcessor, Request
     from cookielib import CookieJar
 
@@ -98,9 +98,13 @@ class ProxyHTTP(Proxy):
     """The :class:`ProxyHTTP` class provides a dynamic access
     to all HTTP methods.
     """
-    def __call__(self, url, data, headers=None):
-        request = Request(url='/'.join([self._root_url, url]),
-                          data=encode_data(data))
+    def __call__(self, url, data=None, headers=None):
+        kwargs = {
+            'url': '/'.join([self._root_url, url]),
+        }
+        if data:
+            kwargs['data'] = encode_data(data)
+        request = Request(**kwargs)
         if headers:
             for hkey in headers:
                 hvalue = headers[hkey]
diff --git a/odoorpc/session.py b/odoorpc/session.py
index 1420219..bc04da8 100644
--- a/odoorpc/session.py
+++ b/odoorpc/session.py
@@ -25,7 +25,7 @@ import os
 import stat
 import sys
 # Python 2
-if sys.version_info.major < 3:
+if sys.version_info[0] < 3:
     from ConfigParser import SafeConfigParser as ConfigParser
 # Python >= 3
 else:
diff --git a/odoorpc/tests/__init__.py b/odoorpc/tests/__init__.py
index e0ccba2..d7fd2b8 100644
--- a/odoorpc/tests/__init__.py
+++ b/odoorpc/tests/__init__.py
@@ -42,13 +42,15 @@ class LoginTestCase(BaseTestCase):
     def setUp(self):
         BaseTestCase.setUp(self)
         self.odoo.login(self.env['db'], self.env['user'], self.env['pwd'])
-        self.user = self.odoo.env.user
-        self.user_obj = self.odoo.env['res.users']
-        # Install 'sale' module
+        # Install 'sale' and 'crm' modules
         self.odoo.config['timeout'] = 600
         module_obj = self.odoo.env['ir.module.module']
-        module_ids = module_obj.search([('name', 'in', ['sale', 'crm'])])
+        module_ids = module_obj.search([('name', 'in', ['sale', 'crm_claim'])])
         module_obj.button_immediate_install(module_ids)
         self.odoo.config['timeout'] = 120
+        # Get user record and model after the installation of modules
+        # to get all available fields (avoiding test failures)
+        self.user = self.odoo.env.user
+        self.user_obj = self.odoo.env['res.users']
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/odoorpc/tests/test_env.py b/odoorpc/tests/test_env.py
index aef06a3..63244dc 100644
--- a/odoorpc/tests/test_env.py
+++ b/odoorpc/tests/test_env.py
@@ -72,4 +72,8 @@ class TestEnvironment(LoginTestCase):
         self.assertEqual(record._name, 'res.lang')
         self.assertEqual(record.code, 'en_US')
 
+    def test_env_contains(self):
+        self.assertIn('res.partner', self.odoo.env)
+        self.assertNotIn('does.not.exist', self.odoo.env)
+
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/odoorpc/tests/test_field_integer.py b/odoorpc/tests/test_field_integer.py
index ecbc057..a4bb613 100644
--- a/odoorpc/tests/test_field_integer.py
+++ b/odoorpc/tests/test_field_integer.py
@@ -9,33 +9,33 @@ class TestFieldInteger(LoginTestCase):
         self.assertIsInstance(self.user.id, int)
 
     def test_field_integer_write(self):
-        cur_obj = self.odoo.env['res.currency']
-        cur = cur_obj.browse(1)
-        backup = cur.accuracy
+        cron_obj = self.odoo.env['ir.cron']
+        cron = cron_obj.browse(cron_obj.search([])[0])
+        backup = cron.priority
         # False
-        cur.accuracy = False
-        data = cur.read(['accuracy'])[0]
-        self.assertEqual(data['accuracy'], 0)
-        self.assertEqual(cur.accuracy, 0)
+        cron.priority = False
+        data = cron.read(['priority'])[0]
+        self.assertEqual(data['priority'], 0)
+        self.assertEqual(cron.priority, 0)
         # None
-        cur.accuracy = None
-        data = cur.read(['accuracy'])[0]
-        self.assertEqual(data['accuracy'], 0)
-        self.assertEqual(cur.accuracy, 0)
+        cron.priority = None
+        data = cron.read(['priority'])[0]
+        self.assertEqual(data['priority'], 0)
+        self.assertEqual(cron.priority, 0)
         # 0
-        cur.accuracy = 0
-        data = cur.read(['accuracy'])[0]
-        self.assertEqual(data['accuracy'], 0)
-        self.assertEqual(cur.accuracy, 0)
+        cron.priority = 0
+        data = cron.read(['priority'])[0]
+        self.assertEqual(data['priority'], 0)
+        self.assertEqual(cron.priority, 0)
         # 100
-        cur.accuracy = 100
-        data = cur.read(['accuracy'])[0]
-        self.assertEqual(data['accuracy'], 100)
-        self.assertEqual(cur.accuracy, 100)
+        cron.priority = 100
+        data = cron.read(['priority'])[0]
+        self.assertEqual(data['priority'], 100)
+        self.assertEqual(cron.priority, 100)
         # Restore original value
-        cur.accuracy = backup
-        data = cur.read(['accuracy'])[0]
-        self.assertEqual(data['accuracy'], backup)
-        self.assertEqual(cur.accuracy, backup)
+        cron.priority = backup
+        data = cron.read(['priority'])[0]
+        self.assertEqual(data['priority'], backup)
+        self.assertEqual(cron.priority, backup)
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/odoorpc/tests/test_field_reference.py b/odoorpc/tests/test_field_reference.py
index d98ff44..5c0e52f 100644
--- a/odoorpc/tests/test_field_reference.py
+++ b/odoorpc/tests/test_field_reference.py
@@ -7,20 +7,20 @@ from odoorpc.models import Model
 class TestFieldReference(LoginTestCase):
 
     def test_field_reference_read(self):
-        Lead = self.odoo.env['crm.lead']
-        lead_id = Lead.search([])[0]
+        Claim = self.odoo.env['crm.claim']
+        claim_id = Claim.search([])[0]
         # Test field containing a value
         self.odoo.execute(
-            'crm.lead', 'write', [lead_id], {'ref': 'res.partner,1'})
-        lead = Lead.browse(lead_id)
-        self.assertIsInstance(lead.ref, Model)
-        self.assertEqual(lead.ref._name, 'res.partner')
-        self.assertEqual(lead.ref.id, 1)
+            'crm.claim', 'write', [claim_id], {'ref': 'res.partner,1'})
+        claim = Claim.browse(claim_id)
+        self.assertIsInstance(claim.ref, Model)
+        self.assertEqual(claim.ref._name, 'res.partner')
+        self.assertEqual(claim.ref.id, 1)
         # Test if empty field returns False (unable to guess the model to use)
         self.odoo.execute(
-            'crm.lead', 'write', [lead_id], {'ref': None})
-        lead = Lead.browse(lead_id)
-        self.assertEqual(lead.ref, False)
+            'crm.claim', 'write', [claim_id], {'ref': None})
+        claim = Claim.browse(claim_id)
+        self.assertEqual(claim.ref, False)
 
     def test_field_reference_write(self):
         # TODO
diff --git a/odoorpc/tests/test_report.py b/odoorpc/tests/test_report.py
index 0cef02d..fb7b432 100644
--- a/odoorpc/tests/test_report.py
+++ b/odoorpc/tests/test_report.py
@@ -32,7 +32,9 @@ class TestReport(LoginTestCase):
     def test_report_list(self):
         res = self.odoo.report.list()
         self.assertIsInstance(res, dict)
-        self.assertIn('res.company', res)
-        self.assertIn('preview.report', res['res.company'][0]['report_name'])
+        self.assertIn('account.invoice', res)
+        self.assertTrue(
+            any('account.report_invoice' in data['report_name']
+                for data in res['account.invoice']))
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/odoorpc/tests/test_timeout.py b/odoorpc/tests/test_timeout.py
index 446c1fa..e1abac4 100644
--- a/odoorpc/tests/test_timeout.py
+++ b/odoorpc/tests/test_timeout.py
@@ -15,7 +15,7 @@ class TestTimeout(LoginTestCase):
 
     def test_reduced_timeout(self):
         # Set the timeout
-        self.odoo.config['timeout'] = 0.05
+        self.odoo.config['timeout'] = 0.005
         # Execute a time consuming query: handle exception
         self.assertRaises(
             socket.timeout,
diff --git a/odoorpc/tests/test_workflow.py b/odoorpc/tests/test_workflow.py
index bfda741..e417ec3 100644
--- a/odoorpc/tests/test_workflow.py
+++ b/odoorpc/tests/test_workflow.py
@@ -12,6 +12,7 @@ class TestWorkflow(LoginTestCase):
         self.product_obj = self.odoo.env['product.product']
         self.partner_obj = self.odoo.env['res.partner']
         self.sale_order_obj = self.odoo.env['sale.order']
+        self.uom_obj = self.odoo.env['product.uom']
         self.p_id = self.partner_obj.create({'name': "Child 1"})
         prod_vals = {
             'name': "PRODUCT TEST WORKFLOW",
@@ -20,6 +21,7 @@ class TestWorkflow(LoginTestCase):
         sol_vals = {
             'name': "TEST WORKFLOW",
             'product_id': self.product_id,
+            'product_uom': self.uom_obj.search([])[0],
         }
         so_vals = {
             'partner_id': self.p_id,
diff --git a/setup.py b/setup.py
index 5f6316b..312597c 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@ import os
 from distutils.core import setup
 
 name = 'OdooRPC'
-version = '0.3.0'
+version = '0.4.1'
 description = ("OdooRPC is a Python module providing an easy way to "
                "pilot your Odoo servers through RPC.")
 keywords = ("openerp odoo server rpc client xml-rpc xmlrpc jsonrpc json-rpc "
@@ -62,6 +62,7 @@ setup(name=name,
           "Programming Language :: Python :: 3.2",
           "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",
           "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-odoorpc.git



More information about the Python-modules-commits mailing list