# Fault: Undetected access error on Sales report by region

**URL:** https://discuss.tryton.org/t/fault-undetected-access-error-on-sales-report-by-region/8110
**Category:** User
**Tags:** sales
**Created:** [December 10, 2024, 7:20am UTC](https://discuss.tryton.org/t/fault-undetected-access-error-on-sales-report-by-region/8110 "2024-12-10T07:20:42Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![dotbit](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/dotbit/32/2093_2.png) [@dotbit](https://discuss.tryton.org/u/dotbit)
#### Post date: [December 10, 2024, 7:20am UTC](https://discuss.tryton.org/t/fault-undetected-access-error-on-sales-report-by-region/8110/1 "2024-12-10T07:20:42Z")

</div>

Context: I sell in Romania using company currency RON, and in Europe in EUR.  
Using trytond / trytond\_sale / tryton all 7.4.1 updated with pip.

While attempting to use Sale Reports under Sales / Reporting and then Sales by Region:  
While browsing the regions I see exaggerated sales figures in EUR, and it appears to be a factor of the exchange rate.  
It seems to me that the sales sum reported is in local currency, but with the sale currency symbol (EUR).

When I double click on the region I can see a tree of countries/regions where sales happened.  
When I double click on the region where the company is, I get the following traceback:

```auto
Traceback (most recent call last):
  File "/trytond/wsgi.py", line 96, in dispatch_request
    return endpoint(request, **request.view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/trytond/protocols/dispatcher.py", line 44, in rpc
    return methods.get(request.rpc_method, _dispatch)(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/trytond/wsgi.py", line 76, in wrapper
    return func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/trytond/protocols/wrappers.py", line 206, in wrapper
    result = func(request, pool, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/trytond/protocols/dispatcher.py", line 216, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/trytond/model/modelsql.py", line 1161, in read
    raise RuntimeError("Undetected access error")
RuntimeError: Undetected access error

Fault: Undetected access error

```

I have not been able to reproduce on demo, or on a fresh database.  
This is the reason I have not filed a bug report.

I have read this: [Undetected access error](https://discuss.tryton.org/t/undetected-access-error/7958)

> [@Undetected access error](https://discuss.tryton.org/t/undetected-access-error/7958/3):
>
> This is typical of table query that does not generate unique `id`.

Possible issues with my database: I have deactivated sale opportunity. Otherwise I don’t have custom sales modules.

---

<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: [December 10, 2024, 8:46am UTC](https://discuss.tryton.org/t/fault-undetected-access-error-on-sales-report-by-region/8110/2 "2024-12-10T08:46:33Z")

</div>

Hi, do you have the error in a former version, also?  
I tested in 6.0 and can not reproduce.  
Do you also have the error when you remove the region == subdivision from your company?

---

<div class="post-metadata">

### Author: ![dotbit](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/dotbit/32/2093_2.png) [@dotbit](https://discuss.tryton.org/u/dotbit)
#### Post date: [December 10, 2024, 9:13am UTC](https://discuss.tryton.org/t/fault-undetected-access-error-on-sales-report-by-region/8110/3 "2024-12-10T09:13:38Z")

</div>

> [@udono](#):
>
> Hi, do you have the error in a former version, also?  
> I tested in 6.0 and can not reproduce.

I have not tested in 6.0, it was a long time ago.  
I think the issue was also in 7.0, sales reports did not work as they should but I did not investigate further then.

> [@udono](#):
>
> Do you also have the error when you remove the region == subdivision from your company?

For example I changed Company address to USA.  
Now I can see the sale report for Eastern Europe (former company country), but I still get the crash when I try to see the report for North America.

I see a strange thing that I need to investigate.  
When I moved company address to USA, I also see some sales in USA (?!).  
Edit: These are the deliveries with pick-up from ware-house. So it is normal to have sales in company country if you allow shipment\_address == company address.

---

<div class="post-metadata">

### Author: ![dotbit](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/dotbit/32/2093_2.png) [@dotbit](https://discuss.tryton.org/u/dotbit)
#### Post date: [December 10, 2024, 11:03am UTC](https://discuss.tryton.org/t/fault-undetected-access-error-on-sales-report-by-region/8110/4 "2024-12-10T11:03:40Z")

</div>

Sale with delivery to company warehouse on demo does not cause this crash.

---

<div class="post-metadata">

### Author: ![maxx](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/maxx/32/2320_2.png) [@maxx](https://discuss.tryton.org/u/maxx)
#### Post date: [December 10, 2024, 11:07am UTC](https://discuss.tryton.org/t/fault-undetected-access-error-on-sales-report-by-region/8110/5 "2024-12-10T11:07:21Z")

</div>

Got same problem with purchase report by suppliers

```auto
ERROR:tryton.gui.window.view_form.view.list_gtk.widget:Error calling get_textual_value for <tryton.gui.window.view_form.view.list_gtk.widget.M2O object at 0x7fcd4eb9ab10> with <Record 1298@purchase.reporting.supplier at 140519459643200>
Traceback (most recent call last):
File "/home/tbruyere/workspace/tryton/7.2/tryton/tryton/gui/window/view_form/view/list_gtk/widget.py", line 64, in wrapper
return func(self, record)
^^^^^^^^^^^^^^^^^^
File "/home/tbruyere/workspace/tryton/7.2/tryton/tryton/gui/window/view_form/view/list_gtk/widget.py", line 360, in get_textual_value
record.load(self.attrs['name'], process_exception=False)
File "/home/tbruyere/workspace/tryton/7.2/tryton/tryton/gui/window/view_form/model/record.py", line 173, in load
values = RPCExecute('model', self.model_name, 'read',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tbruyere/workspace/tryton/7.2/tryton/tryton/common/common.py", line 1337, in RPCExecute
return RPCProgress('execute', args).run(process<em>exception, callback)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tbruyere/workspace/tryton/7.2/tryton/tryton/common/common.py", line 1287, in run
return self.process()
^^^^^^^^^^^^^^
File "/home/tbruyere/workspace/tryton/7.2/tryton/tryton/common/common.py", line 1327, in process
return return</em>()
^^^^^^^^^
File "/home/tbruyere/workspace/tryton/7.2/tryton/tryton/common/common.py", line 1319, in return_
raise RPCException(self.exception)
tryton.common.common.RPCException: Undetected access error

```

---

<div class="post-metadata">

### Author: ![dotbit](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/dotbit/32/2093_2.png) [@dotbit](https://discuss.tryton.org/u/dotbit)
#### Post date: [December 10, 2024, 11:21am UTC](https://discuss.tryton.org/t/fault-undetected-access-error-on-sales-report-by-region/8110/6 "2024-12-10T11:21:18Z")

</div>

It would be nice if we can reproduce it on a new database, or on demo database…

> [@maxx](#):
>
> Got same problem with purchase report by suppliers

Is this one of your production databases?  
Does this happen on a new database?  
Do you have some ideas what might be the issue?

Initially I was thinking the issue might be the different currency of some sales and the company currency.  
Do you have supplier/purchases in other currency than company currency?

Do you use warehouse pick up?

---

<div class="post-metadata">

### Author: ![maxx](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/maxx/32/2320_2.png) [@maxx](https://discuss.tryton.org/u/maxx)
#### Post date: [December 10, 2024, 11:35am UTC](https://discuss.tryton.org/t/fault-undetected-access-error-on-sales-report-by-region/8110/7 "2024-12-10T11:35:22Z")

</div>

Cannot reproduce on new database. Problem on our production database. (7.0 and 7.2)

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [December 10, 2024, 11:37am UTC](https://discuss.tryton.org/t/fault-undetected-access-error-on-sales-report-by-region/8110/8 "2024-12-10T11:37:57Z")

</div>

This is a bug on the table query generating the report. Could you please fill an issue?

As you are double clicking in the record this is when you open the `sale.reporting.country.tree` which is an unnion of the `country.country` and `country.subdivision` models.

Normally this issues depend on the ids of the database, so it will be great to know the maxiumum ids of such tables. If you loaded using a script, it should be possible to reproduce the values on a fresh database as far as they have the same ids generated.  
Note that if you deleted and re-imported the records, the ids will increase and they will be different from the ones created in a fresh database.

---

<div class="post-metadata">

### Author: ![maxx](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/maxx/32/2320_2.png) [@maxx](https://discuss.tryton.org/u/maxx)
#### Post date: [December 10, 2024, 1:29pm UTC](https://discuss.tryton.org/t/fault-undetected-access-error-on-sales-report-by-region/8110/9 "2024-12-10T13:29:40Z")

</div>

In my case, the problem seems linked when using different currencies for the same supplier. So id, which is party.id, is not unique.

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [December 10, 2024, 1:38pm UTC](https://discuss.tryton.org/t/fault-undetected-access-error-on-sales-report-by-region/8110/10 "2024-12-10T13:38:53Z")

</div>

In such case, the amounts should be converted to same currency and a single record for the party should be shown.

Please fill an issue as this is a differnt error, despite the error message beeing the same.

---

<div class="post-metadata">

### Author: ![maxx](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/maxx/32/2320_2.png) [@maxx](https://discuss.tryton.org/u/maxx)
#### Post date: [December 10, 2024, 1:54pm UTC](https://discuss.tryton.org/t/fault-undetected-access-error-on-sales-report-by-region/8110/11 "2024-12-10T13:54:17Z")

</div>

> **[Undetected access error on Purchase report per Supplier (#13743) · Issues ·...](https://foss.heptapod.net/tryton/tryton/-/issues/13743)**
>
> When trying to opening Purchases Report per Supplier, i got this error: File "/home/mrichez/Workspace/tryton/issues/tryton\_72\_dev/trytond/trytond/protocols/dispatcher.py",...

---

<div class="post-metadata">

### Author: ![dotbit](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/dotbit/32/2093_2.png) [@dotbit](https://discuss.tryton.org/u/dotbit)
#### Post date: [December 11, 2024, 6:14am UTC](https://discuss.tryton.org/t/fault-undetected-access-error-on-sales-report-by-region/8110/12 "2024-12-11T06:14:44Z")

</div>

> **[Undetected access error on Sale report per Region (#13744) · Issues · Tryton...](https://foss.heptapod.net/tryton/tryton/-/issues/13744)**
>
> Following https://discuss.tryton.org/t/fault-undetected-access-error-on-sales-report-by-region/8110/9 I have not reproduced this crash on new database, or on demo. On my production database it happens when...

---

<div class="post-metadata">

### Author: ![maxx](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/maxx/32/2320_2.png) [@maxx](https://discuss.tryton.org/u/maxx)
#### Post date: [December 11, 2024, 1:41pm UTC](https://discuss.tryton.org/t/fault-undetected-access-error-on-sales-report-by-region/8110/13 "2024-12-11T13:41:05Z")

</div>

> [@pokoli](#):
>
> In such case, the amounts should be converted to same currency and a single record for the party should be shown.

Which date should be used to convert currency ? Purchase date ? Delivery Date ?
