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

Hi Hope someone can help.

I have the following code, in the res.partner model


def get_links(self):
web_link = self.env['ir.config_parameter']
print(web_link)
return web_link.sudo().get_param("external_links")
web_links = fields.Boolean(compute=get_links, store=False)

external_links is a key in the res.config_parameters model.


No matter what I do I cannot get the compute function to be called.

if I put the function in a default (default=get_links) call in the field then it works correct, but only on creating a record.



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

Hi,
As you said, default works only while creating a record, in order to make your function work, compute function should depend on any field in current model , so that when that field changes your compute function works.

الكاتب أفضل إجابة

Thanks, but will it then still call when the function when the field is viewed


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

Hi, try with running a cron job for that compute function.