When i check connection database using xmlrpc or jsonrpc the data will not update or be same before update but data in db updated so i will refresh browser for update ui data, how to fix it like example in test connection in outgoing email server
<buttonstring="Check API"name="check_api"type="object"class="btn-primary"attrs="{'invisible': [('selection_rpc', '==', 'local')]}"/>
def check_api(self):
host = self.fields_host
port = self.fields_port
db_name = self.fields_database
username = self.fields_username
password = self.fields_password
title = "Warning!"
message = "Database Disconnected, Please Check Username or Password!!"
type = 'warning'
try:
# if (self.selection_rpc == 'socketrpc'):
# odoo = odoorpc.ODOO(host, port=port)
# # # Login
# odoo.login(db_name, username, password)
# if (odoo.env.uid):
# title = "Success!"
# message = "Database Connected"
# type = 'success'
if (self.selection_rpc == 'xmlrpc'):
base_url = 'http://' + host + ':' + port + '/'
common = xmlrpc.client.ServerProxy(
'{}/xmlrpc/2/common'.format(base_url))
uid = common.authenticate(db_name, username, password, {})
if (uid):
title = "Success!"
message = "Database Connected"
type = 'success'
elif (self.selection_rpc == 'jsonrpc'):
url = "http://%s:%s/jsonrpc" % (host, port)
uid = self.call(url, "common", "login", db_name,
username, password)
if (uid):
title = "Success!"
message = "Database Connected"
type = 'success'
except Exception as e:
print("Except", str(e))
return False
return {
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'title': _(title),
'message': message,
'type': type,
'sticky': False
}
}
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- إدارة علاقات العملاء
- e-Commerce
- المحاسبة
- المخزون
- PoS
- Project
- MRP
لقد تم الإبلاغ عن هذا السؤال
1237
أدوات العرض
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيلالمنشورات ذات الصلة | الردود | أدوات العرض | النشاط | |
---|---|---|---|---|
|
3
أغسطس 25
|
2407 | ||
|
1
مايو 25
|
2568 | ||
|
1
أبريل 25
|
3523 | ||
|
1
أبريل 25
|
4357 | ||
|
1
أبريل 25
|
1834 |