I'm on Odoo v14 CE.
I'm currently writing a custom app, so I'm modifying my models / views very often (var names, add and remove, ..) and sometimes with major changes
After all these changes, I ended with a strange behavior with a wizard (Transient model)
This wizard duplicates a "product.template" then set a custom name on it. Sample code could be :
new_product = current_product.copy()
vals = {
'name': "my new name"
}
new_product.write(vals)
The strange behavior is :
- On my existing database (the one with many changes / updates), it does not work, the name keeps being "Current product name (Copy)"
- On a fresh (new) database, everything works as expected : the name of the duplicated product is set to "my new name"
So I guess it's not a code issue by itself, but I was suspecting something wrong in the config hold in the database itself about this app/module, maybe some states, or code that has not been correcly updated / cleaned ?
Maybe I should do something specific (vaccum / cleanup) after important updates ? I also tried :
- duplicating the database, same problem, only a new database solves this issue
- having some other update methods, for example new_product.name = "my new name" but same problem
Any idea ?
Is there a way to force the reinstallation of an app without losing all data ?
Thank you
Some additional information about the models :
- The transient model is only for the wizard itself, it allows to define some important information for creating the new product (by duplicating another one)
- The current_product.copy in the above sample code concerns the default "product.template" model (so it's no Transient)
So I'm not sure if it's related to TransientModel or not..