تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
4 الردود
6719 أدوات العرض

Hello,
How can Odoo store field's data if the field has property "Store=False" ?


I have the example with property_account_income_id and property_account_expense_id , it is the bond between a product_template and an account when I install Accounting module

it is not stored in the database but it stand in odoo therefore. 

Is it in cache ? 

Is it in the object ? if it is in the object it should disapear if the server is rebooted ?

Thank you

الصورة الرمزية
إهمال
أفضل إجابة

Do it "Store=False" to "Store=True"

الصورة الرمزية
إهمال

Yes It's working for me.

الكاتب

@Muhammad Imran Yes sure, it will write in the database, but my question is How it is stocked if store is at false ?

أفضل إجابة

You are correct. The environment also stores caches.

I'm not sure at 100%, but non-stored fields, as transient models, are not stored in the DB but they stand for a while.
What I usually do is, in the case of transient models, when i create some records on it, remove them right after use them (for instance, when you want to recalculate the records from scratch).

So you could do the same on temporary-stored fields: once they are computed, set them to false.

الصورة الرمزية
إهمال
الكاتب

Ok so you says if it's not stored in the BD it's stored in the cache, but this cache is never reseted ?

After I saw your answer I have checked the models and it's "class ProductTemplate(models.Model):" (not a transient model)

sorry I think i've missunderstood what you said.

What I said about Transient models was just an example.

About non-stored fields, for sure they are not stored in the DB, but they are 'computed' and returned everytime when requested. So you could think the value will dissapear if your server is rebooted or your cache is cleared, but fortunately the value is recalculated everytime you load the related model.

المنشورات ذات الصلة الردود أدوات العرض النشاط
0
فبراير 25
1256
0
يناير 25
1096
1
ديسمبر 24
1385
1
يونيو 22
5526
Field __last_update تم الحل
1
فبراير 19
4928