[FIX] odoo_referral: Fix undeterministic crashing bug
The http request to odoo.com could lead to a timeout. Avoid it in a testing environment, to avoid tests like test_20_crawl_demo to crash. closes odoo/odoo#48307 Taskid: 2222797 X-original-commit: 873699142f3427ecf486cf4319e158768a4e1336 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
@@ -10,7 +10,7 @@ import threading
|
||||
from hashlib import sha1
|
||||
from werkzeug import url_encode
|
||||
|
||||
from odoo import api, models
|
||||
from odoo import api, models, tools
|
||||
|
||||
|
||||
DEST_SERVER_URL = 'https://www.odoo.com'
|
||||
@@ -22,6 +22,8 @@ class Users(models.Model):
|
||||
|
||||
@api.model
|
||||
def get_referral_updates_count_for_current_user(self):
|
||||
if tools.config.options['test_enable']:
|
||||
return 0
|
||||
token = self.env.user._get_or_generate_referral_token()
|
||||
if not token:
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user