1摔蓝、上傳的文件保存路徑根據(jù)啟動(dòng)的conf配置的data_dir目錄下膘侮,系統(tǒng)遷移服務(wù)器的時(shí)候記得備份清女。
2、給H1增加label谍失,<label for="name"/><field name="name"/>
3眶俩、設(shè)置—用戶—群組:為每個(gè)應(yīng)用程序劃分級(jí)別,例如:經(jīng)理快鱼、員工
4颠印、開發(fā)完成的模塊進(jìn)行翻譯,首先進(jìn)入【設(shè)置—翻譯—應(yīng)用程序術(shù)語】抹竹,點(diǎn)擊【同步術(shù)語】线罕,執(zhí)行完成之后進(jìn)入【設(shè)置—翻譯—應(yīng)用程序術(shù)語—已翻譯術(shù)語】搜索需要翻譯的源術(shù)語,修改翻譯值并保存窃判。
5钞楼、設(shè)置—翻譯—應(yīng)用程序術(shù)語—已翻譯術(shù)語 設(shè)置翻譯
類型:字段、對(duì)象袄琳、報(bào)表/模板询件、選中內(nèi)容、視圖唆樊、幫助宛琅、代碼、約束逗旁、SQL約束
- 對(duì)象嘿辟,翻譯字段是模型名稱+逗號(hào)+字段名(ir.ui.view,arch_db),翻譯數(shù)據(jù)庫中某個(gè)字段內(nèi)的數(shù)據(jù)
- 代碼片效,翻譯字段是一個(gè)文件的完整路徑(addons/base/res/res_config.py)仓洼,翻譯某個(gè)文件中出現(xiàn)的文字,比如字段中help的內(nèi)容堤舒、default的內(nèi)容
- 選中內(nèi)容,翻譯字段是模型名稱+逗號(hào)+字段名(ir.translation,state)哺呜,翻譯Selection類型字段中的值
- SQL約束舌缤,翻譯字段是模型名稱(res.country),翻譯_sql_constraints內(nèi)的錯(cuò)誤提示內(nèi)容
6、創(chuàng)建新模塊
python odoo-bin scaffold goal D:\python\odoo10\addons
7国撵、繼承重寫ir.actions.act_window不需要新的id陵吸,直接調(diào)用原id進(jìn)行添加或修改
<record id="base.action_partner_supplier_form" model="ir.actions.act_window">
<field name="domain">[('supplier', '=', True)]</field>
</record>
8、title上刪除“Odoo”修改以下文件
addons\web\static\src\js\abstract_web_client.js介牙,54行
this.set('title_part', {"zopenerp": "Odoo"});
addons\web\views\webclient_templates.xml壮虫,198行
<title t-esc="title or 'Odoo'"/>
警告提示框刪除odoo文字
addons\web\static\src\js\framework\crash_manager.js,第108行
title: "Odoo " + (_.str.capitalize(error.type) || _t("Warning"))
9环础、實(shí)時(shí)獲取當(dāng)前長時(shí)間囚似、短時(shí)間
date = fields.Date(string=u'display_name', default=fields.Date.context_today, compute='_compute_dates', inverse='_inverse_dates', store=True, states={'done': [('readonly', True)]}, track_visibility='onchange')
datetime = fields.Datetime(string=u'display_name', default=fields.Datetime.now, readonly=True, copy=False, help='', compute='_methods_compute', store=True)
now = fields.Datetime.now()
date = fields.Date.today()
10、Selection類型字段繼承擴(kuò)展增加新選項(xiàng)
type = fields.Selection(selection_add=[('product', 'Stockable Product')])
11线得、通過代碼跳轉(zhuǎn)頁面
@api.multi
def action_invoice_sent(self):
""" Open a window to compose an email, with the edi invoice template
message loaded by default
"""
self.ensure_one()
template = self.env.ref('account.email_template_edi_invoice', False)
compose_form = self.env.ref('mail.email_compose_message_wizard_form', False)
ctx = dict(
default_model='account.invoice',
default_res_id=self.id,
default_use_template=bool(template),
default_template_id=template and template.id or False,
default_composition_mode='comment',
mark_invoice_as_sent=True,
custom_layout="account.mail_template_data_notification_email_account_invoice"
)
return {
'name': _('Compose Email'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'mail.compose.message',
'views': [(compose_form.id, 'form')],
'view_id': compose_form.id,
'target': 'new',
'context': ctx,
}
12饶唤、獲取本地ip
myname = socket.getfqdn(socket.gethostname())
myaddr = socket.gethostbyname(myname)
print request.context
print request.httprequest.remote_addr
print myname, myaddr
ipList = socket.gethostbyname_ex(socket.gethostname())
for i in ipList:
print i