diff --git a/CHANGELOG b/CHANGELOG index 1826ea4265..cc38ef8d75 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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) diff --git a/proteus/config.py b/proteus/config.py index 4f69e9bfad..63d9ef83e6 100644 --- a/proteus/config.py +++ b/proteus/config.py @@ -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)) diff --git a/proteus/tests/test_config.py b/proteus/tests/test_config.py index d6420a7351..9e1d436c54 100644 --- a/proteus/tests/test_config.py +++ b/proteus/tests/test_config.py @@ -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'))