Skip to Content
Menu
This question has been flagged

Hi everyone, 

i have a problem in my module that has over 600.000 datas in the database.

let's say that i have a field like this and it works well (before update) : 

distance_string = fields.Char(string='Distance', compute='_compute_range')

now i need to update that field to become like this  and : 

distance_string = fields.Char(string='Distance', compute='_compute_range', store=True) outside_range= fields.Selection([('no','no'),('yes','Yes')], string="Out of Range", default='no')

it will also work well if i update in the module that has less data. I think there's no problem with my code. The problem is why do i take so much loading time to update this module and it's never end. Can anyone suggest me how to fix it? because i really need to set store=True in that computed field


nb:  forget bout that stored computed field. this module still take never ends loading even if i just add a new field with the default values. i think the problem is from the how much the datas in my module before i update 

Avatar
Discard
Best Answer

i know how you feel bro. i was once in your position too.

default values and compute store will give same impact on existing data: update all data to assign the value.

you should try these options:

a. do the update in a system with better computation performance like on the cloud: restore your DB, upgrade the module there, once it finishes backup the DB and restore it back to your local, or

b. change the query into SQL, because ORM is really exhausting your resource and SQL will be much faster

c. upgrade the module to just give the field, use export-import to fill the field for existing data, then add compute to your field with logic "if the field is not empty, than skip for that record". by doing this, your compute field will only taking effect to new datas

Avatar
Discard
Related Posts Replies Views Activity
0
Feb 22
1522
0
Apr 21
1352
1
Sep 20
3573
1
Jan 20
4615
5
Sep 21
19023