This question has been flagged
2 Replies
3446 Views

I seem to have data "stuck" in Odoo's cache.

I've written a little utility to update product descriptions via XML-RPC (specifically, writing to fields name, description_sale and description_purchase in table product_template). This appears to work OK - my code doesn't return any errors, the data reads back with XML-RPC just as written, and I can see the changed data by peeking directly at the product_template table with SQL in phpPgAdmin (DB utility for PostGres databases).

However, Odoo stubbornly reports the data as it was prior to my updates, presumably from a cache somewhere. The cache survives a server restart (I'm using Odoo13 on Ubuntu 18.04). If I edit a product description in Odoo, the edit takes effect immediately, and can also be seen in phpPgAdmin. But untouched records don't update.

Is there some way I can clear an Odoo/Postgres/Ubuntu cache so as reload data from the actual PostGres table? I'd be glad of any help!


PARTIALLY SOLVED - this is not a cache issue, it's a translation issue.

More investigation shows that the "stuck" value exists only in the ir_translation table. Manually editing (say) description_sale in the Odoo web interface updates the value in product_template, and also both 'src' and 'value' fields in ir_translation. However, updating with XML-RPC changes the value in product_template and also 'src' in ir_translation - but not the translated 'value'. So the description appears "stuck" because the new description is always automatically "translated" to the old description.

So the new question is why does this happen? I'd be glad of any pointers, please. I could directly update ir_translation with XML-RPC, but it seems a bit brutal when there is a whole heap of logic in Odoo which I imagine should deal with this.

BTW, it is normal that fields with the attribute translate are always translated to themselves? Seems a touch inefficient! We have only one language active (en_AU).


Avatar
Discard

Hi,

you may need to use self.flush() to clear cache.

hope this helps.

Author

Hi Ibrahim - thanks for the suggestion, but AFAIK self.flush() is not available in the XML-RPC interface.