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:
- CRM
- e-Commerce
- Akuntansi
- Inventaris
- PoS
- Project
- MRP
Pertanyaan ini telah diberikan tanda
1227
Tampilan
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
DaftarPost Terkait | Replies | Tampilan | Aktivitas | |
---|---|---|---|---|
|
3
Agu 25
|
2277 | ||
|
1
Mei 25
|
2529 | ||
|
1
Apr 25
|
3507 | ||
|
1
Apr 25
|
4338 | ||
|
1
Apr 25
|
1812 |