Allow to use keyword arguments with trytond configuration
issue6647 review41451002
This commit is contained in:
1 parent
46e5aedebe
commit
d3475c0190
3 files changed
+11
-2
No files matched your search
@@ -1,3 +1,5 @@
|
||||
* Allow to use keyword arguments with trytond configuration
|
||||
|
||||
Version 4.4.0 - 2017-05-01
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
|
||||
|
||||
+2
-2
@@ -152,7 +152,7 @@ class _TrytondMethod(object):
|
||||
self._object = model
|
||||
self._config = config
|
||||
|
||||
def __call__(self, *args):
|
||||
def __call__(self, *args, **kwargs):
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.rpc import RPC
|
||||
|
||||
@@ -166,7 +166,7 @@ class _TrytondMethod(object):
|
||||
with Transaction().start(self._config.database_name,
|
||||
self._config.user, readonly=rpc.readonly) as transaction:
|
||||
args, kwargs, transaction.context, transaction.timestamp = \
|
||||
rpc.convert(self._object, *args)
|
||||
rpc.convert(self._object, *args, **kwargs)
|
||||
meth = getattr(self._object, self._name)
|
||||
if not hasattr(meth, 'im_self') or meth.im_self:
|
||||
result = rpc.result(meth(*args, **kwargs))
|
||||
|
||||
@@ -13,6 +13,13 @@ class TestConfig(ProteusTestCase):
|
||||
config.context)[0]
|
||||
self.assert_(user_id == config.user)
|
||||
|
||||
def test_proxy_keyword(self):
|
||||
config = proteus.config.get_config()
|
||||
user_proxy = config.get_proxy('res.user')
|
||||
user_id, = user_proxy.search(
|
||||
[('login', '=', 'admin')], limit=1, context=config.context)
|
||||
self.assert_(user_id == config.user)
|
||||
|
||||
def test_proxy_methods(self):
|
||||
config = proteus.config.get_config()
|
||||
self.assert_('search' in config.get_proxy_methods('res.user'))
|
||||
|
||||
Reference in new issue
Block a user