Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
21772 Widoki

Hi All,


I have a question.

How does a Transient Models clean up? 

I'm worrying that the transient models grows big and unmanageable.


Thanks.

Awatar
Odrzuć
Najlepsza odpowiedź

Hello Gavin,

Transient model data cleans up automatically by scheduled cron job in Odoo.

Go to menu Settings >> Technical >> Automation >> Schedule Actions and you will able to see cron record for to clean up Transient model data. If not activated in your instance, please activate it. At specified duration, system will clean all your Transient data.



Technical Note :  Though name contains "osv_memory" it doesn't means it will not clean up latest styled "Transient" models in V8. System will clean all the V8 styled "Transient" models.

For proof, you can go to file /addons/base/ir/osv_memory_autovacuum.py and you will see following class,

class osv_memory_autovacuum(openerp.osv.osv.osv_memory):
    """ Expose the osv_memory.vacuum() method to the cron jobs mechanism. """
    _name = 'osv_memory.autovacuum'
    def power_on(self, cr, uid, context=None):
        for model in self.pool.models.values():
            if model.is_transient():
                model._transient_vacuum(cr, uid, force=True)
        return True

As per "Bold" lines on above code, system will vacuum all the Transient models too. 

Hope we made your confusion 100% clear now,

 

Awatar
Odrzuć
Autor

Thanks Emipro. Looking at the Sechdule Action name, it suggest that if I use osv_memory to define my objects then the autovacuum will kick in. I'm coding in v8 and so I'm using models.Transient. And a bried look at odoov8 code does not seems that the models.Transient is a inheritance of osv_memory (I may be wrong?). So my question is does the above autovacuum works for models.Transient ?

@Gavin, I have updated my answer ! Hope this confusion will clear now.

Autor

Thanks Emipro. Cheers.

Najlepsza odpowiedź

I am not able to find the Autovacuum cron in schedule action triggers. I am using odoo-15. 

Awatar
Odrzuć

Check scheduled action ID = 18 , or find vac in filter.

Powiązane posty Odpowiedzi Widoki Czynność
1
sie 23
1511
2
lis 19
20965
1
sie 19
10113
0
mar 17
5520
1
maj 15
10270