# Set the default accounts in the financial configuration with Proteus

**URL:** <https://discuss.tryton.org/t/set-the-default-accounts-in-the-financial-configuration-with-proteus/8875>\
**Category:** Developer\
**Tags:** accounting\
**Created:** [October 1, 2025, 1:09pm UTC](https://discuss.tryton.org/t/set-the-default-accounts-in-the-financial-configuration-with-proteus/8875 "2025-10-01T13:09:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gruenfischer](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/g/3be4f8/32.png) [@Gruenfischer](https://discuss.tryton.org/u/Gruenfischer)\
**Post date:** [October 1, 2025, 1:09pm UTC](https://discuss.tryton.org/t/set-the-default-accounts-in-the-financial-configuration-with-proteus/8875/1 "2025-10-01T13:09:46Z")

</div>

Hi everybody,

I am currently working on a testing setup for a chart of accounts. I am stuck at a point with proteus, where I request some help. I try to set the default accounts in the financial configuration with Proteus, but keep getting the following error, but in every object involved the missing field is set (from my point of view).

```bash
>>>Config = Model.get(‘account.configuration’)
>>>Defaultaccount = Model.get(‘account.configuration.default_account’)
>>>Account = Model.get(‘account.account’)
>>>config, = Config.find()
>>>recdef = Defaultaccount()
>>>recdef.company = get_company()
>>>account = Account.find([(‘code’, ‘=’, ‘1200’)], limit=1)[0]
>>>recdef.default_account_receivable = account
>>>account.company
proteus.Model.get(‘company.company’)(1)
>>>get_cfg().context[‘company’]
1
>>>config.default_account_receivable = recdef
>>>config.save()

Traceback (most recent call last):
  File "/Users/jakobfischer/Entwicklung/gf_verification_database/populate_veridb.py", line 550, in start_console
    from IPython import embed # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'IPython'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/jakobfischer/Entwicklung/tryton74/lib/python3.13/site-packages/proteus/ __init__.py", line 102, in newfunc
    return self.func(owner, [instance], *args, **kwargs)
           ~~~~~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jakobfischer/Entwicklung/tryton74/lib/python3.13/site-packages/proteus/ __init__.py", line 866, in save
    proxy.write(*values)
    ~~~~~~~~~~~ ^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/xmlrpc/client.py", line 1096, in __call__
    return self.__send(self.__name, args)
           ~~~~~~~~~~~ ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/xmlrpc/client.py", line 1435, in __request
    response = self.__transport.request(
        self.__host,
    ...<2 lines>...
        verbose=self.__verbose
        )
  File "/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/xmlrpc/client.py", line 1140, in request
    return self.single_request(host, handler, request_body, verbose)
           ~~~~~~~~~~~~~~~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/xmlrpc/client.py", line 1156, in single_request
    return self.parse_response(resp)
           ~~~~~~~~~~~~~~~~~~~ ^^^^^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/xmlrpc/client.py", line 1325, in parse_response
    return u.close()
           ~~~~~~~ ^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/xmlrpc/client.py", line 642, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 1: 'A value is required for field "Company" in "Account". - '>

```

I can configure this very account by hand in the client, but get the error when using Proteus. As you can see, the company of each object is set, but I still get the error.

Thanks for your help Jakob

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [October 2, 2025, 12:19pm UTC](https://discuss.tryton.org/t/set-the-default-accounts-in-the-financial-configuration-with-proteus/8875/2 "2025-10-02T12:19:14Z")

</div>

`account.configuration.default_account` is not supposed to be accessed directly but through the `account.configuration` instance.

---

<div class="post-metadata">

**Author:** ![Gruenfischer](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/g/3be4f8/32.png) [@Gruenfischer](https://discuss.tryton.org/u/Gruenfischer)\
**Post date:** [October 6, 2025, 9:08am UTC](https://discuss.tryton.org/t/set-the-default-accounts-in-the-financial-configuration-with-proteus/8875/3 "2025-10-06T09:08:06Z")

</div>

Thanks @ced for you help. I managed to solve the “Missing company”. It was due to a messed up context.

But when I access the model throught the `account.configuration` I get the error,

`Config = Model.get(‘account.configuration’)`  
`Account = Model.get(‘account.account’)`  
`config, = Config().find()`  
`config`  
`proteus.Model.get(‘account.configuration’)(1)`  
`config.default_account_receivable = Account.find([(‘code’, ‘=’, ‘1200’)], limit=1)[0]`  
`config.save()`

`xmlrpc.client.Fault: <Fault 1: 'You are trying to read records “1” of “Account Configuration Default Account” that don't exist. - '>`

Via Proteus, it seems the underlying Mulitvalue is not created when the Many2One is linked and the config is saved.  
Do I have to trigger the creation somehow “by hand”?

Full Stack:

```auto
>>> Config = Model.get('account.configuration')
>>> Account = Model.get('account.account')
>>> config, = Config().find()
>>> config
proteus.Model.get('account.configuration')(1)
>>> config.default_account_receivable = Account.find([('code', '=', '1200')], limit=1)[0]
>>> config.save()
Traceback (most recent call last):
  File "/Users/jakobfischer/Entwicklung/gf_verification_database/populate_veridb.py", line 573, in start_console
    from IPython import embed # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'IPython'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/jakobfischer/Entwicklung/tryton74/lib/python3.13/site-packages/proteus/ __init__.py", line 102, in newfunc
    return self.func(owner, [instance], *args, **kwargs)
           ~~~~~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jakobfischer/Entwicklung/tryton74/lib/python3.13/site-packages/proteus/ __init__.py", line 866, in save
    proxy.write(*values)
    ~~~~~~~~~~~ ^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/xmlrpc/client.py", line 1096, in __call__
    return self.__send(self.__name, args)
           ~~~~~~~~~~~ ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/xmlrpc/client.py", line 1435, in __request
    response = self.__transport.request(
        self.__host,
    ...<2 lines>...
        verbose=self.__verbose
        )
  File "/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/xmlrpc/client.py", line 1140, in request
    return self.single_request(host, handler, request_body, verbose)
           ~~~~~~~~~~~~~~~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/xmlrpc/client.py", line 1156, in single_request
    return self.parse_response(resp)
           ~~~~~~~~~~~~~~~~~~~ ^^^^^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/xmlrpc/client.py", line 1325, in parse_response
    return u.close()
           ~~~~~~~ ^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/xmlrpc/client.py", line 642, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 1: 'You are trying to read records "1" of "Account Configuration Default Account" that don\'t exist. - '>
>>>

```

Thanks for your help

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [October 6, 2025, 9:58am UTC](https://discuss.tryton.org/t/set-the-default-accounts-in-the-financial-configuration-with-proteus/8875/4 "2025-10-06T09:58:27Z")

</div>

It will be easier to understand the problem with the traceback from the server log (with debug level).

---

<div class="post-metadata">

**Author:** ![udono](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/udono/32/2114_2.png) [@udono](https://discuss.tryton.org/u/udono)\
**Post date:** [October 7, 2025, 7:14am UTC](https://discuss.tryton.org/t/set-the-default-accounts-in-the-financial-configuration-with-proteus/8875/5 "2025-10-07T07:14:52Z")

</div>

> [@Gruenfischer](#):
>
> config, = Config().find()

it looks like you re-define the `config` variable from proteus, if you call proteus like this:

```auto
config = config.set_trytond('…')

```

S.a. [Tryton Scripting Client — Library to access Tryton server as a client](https://docs.tryton.org/latest/client-library/index.html#configuration)

---

<div class="post-metadata">

**Author:** ![Gruenfischer](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/g/3be4f8/32.png) [@Gruenfischer](https://discuss.tryton.org/u/Gruenfischer)\
**Post date:** [October 7, 2025, 4:30pm UTC](https://discuss.tryton.org/t/set-the-default-accounts-in-the-financial-configuration-with-proteus/8875/6 "2025-10-07T16:30:58Z")

</div>

The cause of the error is the name of the variable `config`. But actually I did not redefine config, since I called it `prconfig`.  
It seems like somewhere in the code the string ‘config’ is used, maybe when calling the config dynamically per getattr()…

Takeaway for other readers:

- do not mess up your context 🙂
- do not use`config`, or other trytonic terms as local variable.

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![udono](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/udono/32/2114_2.png) [@udono](https://discuss.tryton.org/u/udono)\
**Post date:** [October 8, 2025, 9:00am UTC](https://discuss.tryton.org/t/set-the-default-accounts-in-the-financial-configuration-with-proteus/8875/7 "2025-10-08T09:00:18Z")

</div>

> [@Gruenfischer](#):
>
> But actually I did not redefine config, since I called it `prconfig`.

but even when you use `prconfig`, you redefine the imported `config`:

```auto
from proteus import config, …

prconfig = config.set_trytond('…')

```

…when you later call:

```auto
Config = Model.get(‘account.configuration’)
config, = Config().find()

```

This way you can import in another namespace:

```auto
from proteus import config as prconfig

prconfig = prconfig.set_trytond('…')

```

---

<div class="post-metadata">

**Author:** ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)\
**Post date:** [October 9, 2025, 9:00am UTC](https://discuss.tryton.org/t/set-the-default-accounts-in-the-financial-configuration-with-proteus/8875/8 "2025-10-09T09:00:31Z")

</div>

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