Setting context with Proteus with a remote connection

Hi,

I am trying to import some Categories according the Proteus example documentation

I am connecting to a remote Tryton instance so I am using confit.set_xmlrpc

config.set_xmlrpc(remote_url)

Category = Model.get(‘party.category’)
with config.set_context(language=‘en’):
category = Category(name=“Category”)
category.save()

When I execute the script I received the following error:

with config.set_context(language=‘en’):
AttributeError: module ‘proteus.config’ has no attribute ‘set_context’

What am I doing wrong? can you aim me to the any examples to check how to do it?

Regards,

Mc

Try this:

my_config = config.set_xmlrpc(remote_url)
Category = Model.get(‘party.category’)
with my_config.set_context(language=‘en’):
    category = Category(name=“Category”)
    category.save()

it Works!! Thank you very much.

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.