mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
[app_base_chinese]将创建数据库的界面,默认中文,中国
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
{
|
||||
'name': "App base chinese,中国化基本模块增强",
|
||||
'version': '16.23.02.14',
|
||||
'version': '16.23.03.22',
|
||||
'author': 'Sunpop.cn',
|
||||
'category': 'Base',
|
||||
'website': 'https://www.sunpop.cn',
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import database
|
||||
|
||||
49
app_base_chinese/controllers/database.py
Normal file
49
app_base_chinese/controllers/database.py
Normal file
@@ -0,0 +1,49 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import re
|
||||
from lxml import html
|
||||
import odoo
|
||||
import odoo.modules.registry
|
||||
from odoo import http
|
||||
from odoo.exceptions import AccessError
|
||||
from odoo.http import content_disposition, dispatch_rpc, request, Response
|
||||
from odoo.service import db
|
||||
from odoo.tools.misc import file_open, str2bool
|
||||
from odoo.addons.web.controllers.database import Database as Database
|
||||
from odoo.addons.base.models.ir_qweb import render as qweb_render
|
||||
|
||||
DBNAME_PATTERN = '^[a-zA-Z0-9][a-zA-Z0-9_.-]+$'
|
||||
|
||||
|
||||
class Database(Database):
|
||||
|
||||
def _render_template(self, **d):
|
||||
d.setdefault('manage', True)
|
||||
d['insecure'] = odoo.tools.config.verify_admin_password('admin')
|
||||
d['list_db'] = odoo.tools.config['list_db']
|
||||
d['langs'] = odoo.service.db.exp_list_lang()
|
||||
d['countries'] = odoo.service.db.exp_list_countries()
|
||||
d['pattern'] = DBNAME_PATTERN
|
||||
# databases list
|
||||
try:
|
||||
d['databases'] = http.db_list()
|
||||
d['incompatible_databases'] = odoo.service.db.list_db_incompatible(d['databases'])
|
||||
except odoo.exceptions.AccessDenied:
|
||||
d['databases'] = [request.db] if request.db else []
|
||||
|
||||
templates = {}
|
||||
|
||||
with file_open("web/static/src/public/database_manager.qweb.html", "r") as fd:
|
||||
templates['database_manager'] = fd.read()
|
||||
with file_open("web/static/src/public/database_manager.master_input.qweb.html", "r") as fd:
|
||||
templates['master_input'] = fd.read()
|
||||
# with file_open("web/static/src/public/database_manager.create_form.qweb.html", "r") as fd:
|
||||
with file_open("app_base_chinese/static/src/public/database_manager.create_form.qweb.html", "r") as fd:
|
||||
templates['create_form'] = fd.read()
|
||||
|
||||
def load(template_name):
|
||||
fromstring = html.document_fromstring if template_name == 'database_manager' else html.fragment_fromstring
|
||||
return (fromstring(templates[template_name]), template_name)
|
||||
|
||||
return qweb_render('database_manager', d, load)
|
||||
@@ -4,7 +4,7 @@
|
||||
<h2 class="oe_slogan">App base chinese. Local customize for china user </h2>
|
||||
<h3 class="oe_slogan">Set all chinese default value. Like Default country, timezone, currency, partner... </h3>
|
||||
<div class="oe_row">
|
||||
<h3>Lastest update: v16.23.02.14</h3>
|
||||
<h3>Lastest update: v16.23.03.22</h3>
|
||||
<div class="oe_span12">
|
||||
<img class="oe_demo oe_screenshot" src="banner.jpg">
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<t>
|
||||
<t t-call="master_input" />
|
||||
<div class="row mb-3">
|
||||
<label for="dbname" class="col-md-4 col-form-label">Database Name</label>
|
||||
<div class="col-md-8">
|
||||
<input id="dbname" type="text" name="name" class="form-control" required="required" autocomplete="off" t-att-pattern="pattern" title="Only alphanumerical characters, underscore, hyphen and dot are allowed"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="login" class="col-md-4 col-form-label">Email</label>
|
||||
<div class="col-md-8">
|
||||
<input id="login" type="text" name="login" class="form-control" required="required" autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="password" class="col-md-4 col-form-label">Password</label>
|
||||
<div class="col-md-8">
|
||||
<div class="input-group">
|
||||
<input id="password" type="password" name="password" class="form-control" required="required" autocomplete="off"/>
|
||||
<span class="fa fa-eye o_little_eye input-group-text" aria-hidden="true" style="cursor: pointer;"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="phone" class="col-md-4 col-form-label">Phone number</label>
|
||||
<div class="col-md-8">
|
||||
<input id="phone" type="tel" name="phone" class="form-control" autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="lang" class="col-md-4 col-form-label">Language</label>
|
||||
<div class="col-md-8">
|
||||
<select id="lang" name="lang" class="form-select" required="required" autocomplete="off">
|
||||
<t t-foreach="langs" t-as="lang">
|
||||
<t t-if="lang[0] == 'zh_CN'">
|
||||
<option t-att-value="lang[0]" t-out="lang[1]" selected="selected"/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<option t-att-value="lang[0]" t-out="lang[1]"/>
|
||||
</t>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="country" class="col-md-4 col-form-label ">Country</label>
|
||||
<div class="col-md-8">
|
||||
<select id="country" name="country_code" class="form-select" autocomplete="off">
|
||||
<option value=""></option>
|
||||
<t t-foreach="countries" t-as="country">
|
||||
<t t-if="country[0] == 'cn'">
|
||||
<option t-att-value="country[0]" t-out="country[1]" selected="selected"/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<option t-att-value="country[0]" t-out="country[1]"/>
|
||||
</t>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="load_demo_checkbox" class="col-md-4 col-form-label">Demo data</label>
|
||||
<div class="col-md-8">
|
||||
<input type="checkbox" id="load_demo_checkbox" class="form-control-sm" name="demo" value="1" />
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
Reference in New Issue
Block a user