Hi.
In openerp login page, we have database list.
I want to know the method in openerp which provide this list.
NB: the method is a python code
Thank you.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hi dear friends.
The database list in openerp login page is provide by the method def exp_list(self,document=False) which is in /openerp/service/web_services
def exp_list(self, document=False):
if not tools.config['list_db'] and not document:
raise openerp.exceptions.AccessDenied()
chosen_template = tools.config['db_template']
templates_list = tuple(set(['template0', 'template1', 'postgres', chosen_template]))
db = sql_db.db_connect('postgres')
cr = db.cursor()
try:
try:
db_user = tools.config["db_user"]
if not db_user and os.name == 'posix':
import pwd
db_user = pwd.getpwuid(os.getuid())[0]
if not db_user:
cr.execute("select usename from pg_user where usesysid=(select datdba from pg_database where datname=%s)", (tools.config["db_name"],))
res = cr.fetchone()
db_user = res and str(res[0])
if db_user:
cr.execute("select datname from pg_database where datdba=(select usesysid from pg_user where usename=%s) and datname not in %s order by datname", (db_user, templates_list))
else:
cr.execute("select datname from pg_database where datname not in %s order by datname", (templates_list,))
res = [tools.ustr(name) for (name,) in cr.fetchall()]
except Exception:
res = []
finally:
cr.close()
res.sort()
return res
Best reagrds.
Hi,
Ther is a method named "db_list". Inside the web module -> controllers -> main.py
This method gives the full list of db names
In python Dabase list source code location: /addons/web/controllers/main.py
Line No 704
class Database(openerpweb.Controller):
_cp_path = "/web/database"
@openerpweb.jsonrequest
def get_list(self, req):
return db_list(req)
In JavaScript Dabase list source code location: /addons/web/static/src/js/chrome.js
Line no: 367
start: function() {
var self = this;
$('.oe_secondary_menus_container,.oe_user_menu_placeholder').empty();
var fetch_db = this.rpc("/web/database/get_list", {}).then(
function(result) {
self.db_list = result;
},
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
0
thg 7 25
|
1453 | ||
|
2
thg 11 24
|
6276 | ||
|
2
thg 10 24
|
3297 | ||
|
2
thg 8 24
|
1867 | ||
|
3
thg 7 24
|
8269 |