API returning old data for bulk updated records using Import feature
Steps to reproduce the issue:
- log in to Odoo and navigate to Products.
- Create a product with the name "TestProduct".
- Try to read this product using the API. You will get the correct product name as "TestProduct".
- Now, go to Products and export that product as an importable row in excel.
- Update the product name to "Product123" in the excel sheet and import it back into the Odoo.
- Now, try to read the same product using API. You will still get the old product name as "TestProduct".
Are you using multiple languages?
No. Single language, testing on a fresh Odoo 16 instance.
I just tested again and found that not only with the bulk import, if you update the product directly in the Odoo we can see the same issue. This means we are not able to get the updated data of any record.
please add a code example
namespace Odoo.Models
{
[OdooTableName("product.template")]
[JsonConverter(typeof(OdooModelConverter))]
public class ProductTemplate : IOdooModel
{
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("__last_update")]
public DateTime LastUpdated { get; set; }
}
}
//GET Product Data
long ID = 2;
OdooRepository<ProductTemplate> Repository = new OdooRepository<ProductTemplate>(Global.GetOdooConfig());
ProductTemplate product = Repository.Query().ById(ID).FirstOrDefaultAsync().Result.Value;
Console.WriteLine(product.Name);
Ale you sure that you are updating product.template not product.product?
Yes. I can see the LastUpdated value changed but not other field values.
To simplify the testing, you can create a new product.template. Use the newly created ID in the code to read the data. Now update something and run the same code. You will still get the old values except LastUpdated as the latest value.
Please check another fields, maybe you update something else
I have tried reading another field and it gives me the updated values. I think the only issue is with the name field.
I mean the name you change may not be name property but something else
It is name property for sure. When I hover over the value in Odoo, I see the field name. I also tried reading the display_name field, but I got the same old value.
