# Use proteus to access custom field

**URL:** https://discuss.tryton.org/t/use-proteus-to-access-custom-field/4287
**Category:** Developer
**Created:** [June 6, 2021, 10:12am UTC](https://discuss.tryton.org/t/use-proteus-to-access-custom-field/4287 "2021-06-06T10:12:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![locx](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/l/f04885/32.png) [@locx](https://discuss.tryton.org/u/locx)
#### Post date: [June 6, 2021, 10:12am UTC](https://discuss.tryton.org/t/use-proteus-to-access-custom-field/4287/1 "2021-06-06T10:12:04Z")

</div>

Suppose I have defined a new field in the `product.product` class as

`description2 = fields.Text("Description2", translate=True)`

Now, if I create a database with the above modification, create a product, run Proteus, and try to access the new field as follows:

```
Product = Model.get('product.product')
all_vars = Product.find()
var1 = all_vars[0]
var1.description2

```

I get:

`AttributeError: 'product.product' object has no attribute 'description2'`

How can I get Proteus to access `description2` ?

---

<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: [June 6, 2021, 6:51pm UTC](https://discuss.tryton.org/t/use-proteus-to-access-custom-field/4287/2 "2021-06-06T18:51:48Z")

</div>

You have nothing to do for proteus. So this error means that the customization is not correctly setup.

---

<div class="post-metadata">

### Author: ![locx](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/l/f04885/32.png) [@locx](https://discuss.tryton.org/u/locx)
#### Post date: [June 6, 2021, 7:10pm UTC](https://discuss.tryton.org/t/use-proteus-to-access-custom-field/4287/3 "2021-06-06T19:10:48Z")

</div>

The answer is the following:  
I had installed trytond in a folder outside my virtual environment folder (so I could keep the customized modules separate, and the rest of the stuff in the env... folder).

When I opened Spyder (my IDE) in that virtual environment, I had to set my working directory to the trytond installation folder (outside the virtual env.) for it to work properly.

@ced For completeness, I should have said that I am running the following code:

```auto
from proteus import config, Model, Wizard, Report
cfg = config.set_trytond(database='test2' , config_file='C:\\Users\\user\\Desktop\\trytond\\trytond-6.0.2\\etc\\trytond.conf')
Product = Model.get('product.product')
all_vars = Product.find()
var1 = all_vars[0]
var1.description2

```

---

<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: [July 6, 2021, 7:11pm UTC](https://discuss.tryton.org/t/use-proteus-to-access-custom-field/4287/4 "2021-07-06T19:11:19Z")

</div>

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