Tryton returning stale/wrong data

26 views
Skip to first unread message

Mark Shane Hayden

unread,
Jun 1, 2017, 5:35:34 AM6/1/17
to tryton
Here is the scenario:

  1. We made some changes in a development environment and things tested OK.  The changes involved installing product_attributes module, then adding attributes and removing the redundant information from the description in all the variant (product_product) records.
  2. Once everything was confirmed in dev the production trytond was shut down, and we used SQL updates to updated the information from dev to production.
  3. Upon connecting when we open up the product variants in the tryton client, or on the web shop front end the OLD descriptions show up, even though the database clearly has the new ones in place
  4. I can update records manually in the Tryton client but all changes that were done by database queries on the product description have no effect outside the database!
Clearly there is a cache issue of some kind, though the documentation suggests the default is memory cache (we have not specified anything different in the configs) and I have even completely rebooted the server to no effect.

How do I ensure that Tryton reads the proper data from the database?

Sergi Almacellas Abellana

unread,
Jun 1, 2017, 5:38:55 AM6/1/17
to try...@googlegroups.com
El 01/06/17 a les 11:35, Mark Shane Hayden ha escrit:
> Here is the scenario:
>
> 1. We made some changes in a development environment and things tested
> OK. The changes involved installing product_attributes module, then
> adding attributes and removing the redundant information from the
> description in all the variant (product_product) records.
> 2. Once everything was confirmed in dev the production trytond was shut
> down, and we used SQL updates to updated the information from dev to
> production.
> 3. Upon connecting when we open up the product variants in the tryton
> client, or on the web shop front end the OLD descriptions show up,
> even though the database clearly has the new ones in place
> 4. I can update records manually in the Tryton client but all changes
> that were done by database queries on the product description have
> no effect outside the database!
>
> Clearly there is a cache issue of some kind, though the documentation
> suggests the default is memory cache (we have not specified anything
> different in the configs) and I have even completely rebooted the server
> to no effect.
>
> How do I ensure that Tryton reads the proper data from the database?
It does, just check you are using the proper database when connecting
throw the client and the trytond.conf file contains the expected URL.


--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

Mark Shane Hayden

unread,
Jun 1, 2017, 7:06:29 AM6/1/17
to tryton
Thanks for the prompt reply.

I have already confirmed I am connecting to the right database.  When I go to the production database in PSQL it shows the NEW descriptions when I query.  In the Tryton client it shows all the OLD descriptions.  When I change the description of one of the products to something totally different using the Tryton client and click save, then re-run the exact same query in PSQL in the exact same connection it still shows all the old descriptions, EXCEPT FOR THE ONE I CHANGED, which matches what I entered in Tryton client.

It really does seem to be running into some cache issue due to directly altering the database or something like that...

Sergi Almacellas Abellana

unread,
Jun 1, 2017, 7:10:47 AM6/1/17
to try...@googlegroups.com
El 01/06/17 a les 13:06, Mark Shane Hayden ha escrit:
> I have already confirmed I am connecting to the right database. When I
> go to the production database in PSQL it shows the NEW descriptions when
> I query. In the Tryton client it shows all the OLD descriptions. When
> I change the description of one of the products to something totally
> different using the Tryton client and click save, then re-run the exact
> same query in PSQL in the exact same connection it still shows all the
> old descriptions, EXCEPT FOR THE ONE I CHANGED, which matches what I
> entered in Tryton client.
>
> It really does seem to be running into some cache issue due to directly
> altering the database or something like that...

As you talk about the descritpion field maybe it's something related to
languages. Which languages do you have activated on the database? Which
language has your user set on preferences? The tryton client always
reads/writes using the tryton language. You can use the flag button on
the description field to see it's translations.

Tryton by default only stores the main language on the database table,
but stores the translations on the ir.translation table. By default the
main language is 'en' (but you can customize on the tryton.cfg file).

Hope it helps.

Nicolas Évrard

unread,
Jun 1, 2017, 7:21:17 AM6/1/17
to tryton
* Mark Shane Hayden [2017-06-01 11:35 +0200]:
>Here is the scenario:
>
> 1. We made some changes in a development environment and things tested
> OK. The changes involved installing product_attributes module, then adding
> attributes and removing the redundant information from the description in
> all the variant (product_product) records.
> 2. Once everything was confirmed in dev the production trytond was shut
> down, and we used SQL updates to updated the information from dev to
> production.
> 3. Upon connecting when we open up the product variants in the tryton
> client, or on the web shop front end the OLD descriptions show up, even
> though the database clearly has the new ones in place
> 4. I can update records manually in the Tryton client but all changes
> that were done by database queries on the product description have no
> effect outside the database!
>
>Clearly there is a cache issue of some kind, though the documentation
>suggests the default is memory cache (we have not specified anything
>different in the configs) and I have even completely rebooted the server to
>no effect.

Maybe you're modifying translatable fields and updated the value in
the "real" table but not in the translation table.

--
Nicolas Évrard - B2CK SPRL
E-mail/Jabber: nicolas...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Mark Shane Hayden

unread,
Jun 1, 2017, 7:36:23 AM6/1/17
to tryton


On Thursday, 1 June 2017 05:10:47 UTC-6, Sergi Almacellas Abellana wrote:
El 01/06/17 a les 13:06, Mark Shane Hayden ha escrit:
> I have already confirmed I am connecting to the right database.  When I
> go to the production database in PSQL it shows the NEW descriptions when
> I query.  In the Tryton client it shows all the OLD descriptions.  When
> I change the description of one of the products to something totally
> different using the Tryton client and click save, then re-run the exact
> same query in PSQL in the exact same connection it still shows all the
> old descriptions, EXCEPT FOR THE ONE I CHANGED, which matches what I
> entered in Tryton client.
>
> It really does seem to be running into some cache issue due to directly
> altering the database or something like that...

As you talk about the descritpion field maybe it's something related to
languages. Which languages do you have activated on the database? Which
language has your user set on preferences? The tryton client always
reads/writes using the tryton language. You can use the flag button on
the description field to see it's translations.

 
Thanks this helps a lot!  I have English and French activated on this setup, though at the moment I am only using English (we want to be able to accommodate business in Quebec in the future but we haven't translated anything yet).

Despite the fact I have only been using English the site appears to have the descriptions in both the product table AND the translation table.  When I edit the values in Tryton client they BOTH change, but my updates only changed the main table and it seems the Tryton client and my flask web shop pull the value out of the translation.

I will have a look at my setup  to see if there is anythong weird, however I have not specified a main language in the config file, and all the translations have a language "en".

Would there be any damage in removing those offending translation records? I really only need them for French in the future.

Sergi Almacellas Abellana

unread,
Jun 1, 2017, 7:58:05 AM6/1/17
to try...@googlegroups.com
El 01/06/17 a les 13:36, Mark Shane Hayden ha escrit:
> Thanks this helps a lot! I have English and French activated on this
> setup, though at the moment I am only using English (we want to be able
> to accommodate business in Quebec in the future but we haven't
> translated anything yet).
>
> Despite the fact I have only been using English the site appears to have
> the descriptions in both the product table AND the translation table.
> When I edit the values in Tryton client they BOTH change, but my
> updates only changed the main table and it seems the Tryton client and
> my flask web shop pull the value out of the translation.

Tryton reads the data from the translation table and you should probably
do the same. Indeed, if you use flask-tryton [1], the same behaviour
will be preserved.

My advice will be to update the scripts to put the right values on the
translation table.

>
> I will have a look at my setup to see if there is anythong weird,
> however I have not specified a main language in the config file, and all
> the translations have a language "en".
>
> Would there be any damage in removing those offending translation
> records? I really only need them for French in the future.
WARNING: If you want to remove translations, take care to remove only
translations for your field and language.

First of all, you should unmark the "Translatable" check on the langauge
table to indicate that this language is no more available as translation.


[1] https://pypi.python.org/pypi/flask_tryton/0.4
Reply all
Reply to author
Forward
0 new messages