freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

odoo90模塊開發(fā)全流程-展示頁

2025-04-25 07:35本頁面
  

【正文】 eld /record record model= id=session_list_action field name=nameSessions/field field name=res_model/fieldExerciseInverse one2many relationsUsing the inverse relational field one2many, modify the models to reflect the relation between courses and sessions.1. Modify the, ondelete=39。, string=Instructor) course_id = (39。 start_date = () duration = (digits=(6, 2), help=Duration in days) seats = (string=Number of seats) instructor_id = (39。, string=Responsible, index=True)class Session(): _name = 39。, ondelete=39。1. 添加相關(guān)字段Many2One到model2. 添加到viewopenacademy/ name = (string=Title, required=True) description = () responsible_id = (39。 一個(gè)Session關(guān)聯(lián)一個(gè)Course,必填 每個(gè)Session有一個(gè)老師, 每個(gè)Course有一個(gè)負(fù)責(zé)人,)One2many(other_model, related_field)Many2many(other_model)練習(xí) 9概述關(guān)聯(lián)字段類型:Many2one(other_model, ondelete=39。39。views/39。39。security/39。data39。s descriptionCan have multiple lines /field /record record model= id=course1 field name=nameCourse 1/field ! no description for this one /record record model= id=course2 field name=nameCourse 2/field field name=descriptionCourse 239。39。o write_uid (Many2one)誰最后修改的記錄。o create_uid (Many2one)誰創(chuàng)建的記錄。 后者連接到其他的記錄上(可以是相同的模型也可以是不同的模型).Boolean, Date, Char這些都是簡單字段.保留字段Odoo在模型中自動創(chuàng)建并維護(hù)一些字段, 這些字段就是保留字段, 這些字段數(shù)據(jù)不需要也不應(yīng)該手動去修改.o id (Id)一條記錄的唯一id。o index (bool, default: False)如果值為True,創(chuàng)建表時(shí)將為此列添加索引。o required (bool, default: False)如果值為True,此字段值不能為空,設(shè)置默認(rèn)值或者在創(chuàng)建記錄時(shí)提供。39。39。:True。:True, 39。構(gòu)建Odoo模塊模塊組成o 業(yè)務(wù)對象業(yè)務(wù)對象聲明為Python類, 由Odoo自動載入.o 數(shù)據(jù)文件XML或CSV文件格式, 在其中聲明了元數(shù)據(jù)(視圖或工作流)、配置數(shù)據(jù)(模塊參數(shù))、演示數(shù)據(jù)等.o Web控制器處理Web瀏覽器發(fā)來的requests.o 靜態(tài)web數(shù)據(jù)Web用到的圖像, CSS或JavaScript文件.模塊結(jié)構(gòu)一個(gè)Odoo模塊也是一個(gè)Python模塊, 存放在一個(gè)目錄中, , 用于導(dǎo)入其他Python模塊.from . import mymodule.$ scaffold module name where to put it命令執(zhí)行后, 將會創(chuàng)建一個(gè)子目錄并且其中包括了Odoo模塊所需的一些基本文件.練習(xí) 1執(zhí)行 ./ scaffold openacademy addons, 在addons目錄下創(chuàng)建一個(gè)名為openacademy的模塊, 生成的目錄文件結(jié)構(gòu)如下.openacademy├── ├── ├── ├── ├── ├── security│ └── └── 各文件內(nèi)容請查看文件或查看原文, ,至少需要添加39。installable39。application39。對象關(guān)系映射ORM層是Odoo的一個(gè)關(guān)鍵組件, 它可以避免大部分的SQL語句編寫從而提高擴(kuò)展性和安全性.業(yè)務(wù)對象用派生自Model的Python類(模型)來編寫, 該類的_name屬性定義了模型在Odoo系統(tǒng)中的名稱.from openerp import modelsclass MinimalModel(): _name = 39。字段字段定義模型能夠存儲什么以及在哪里存儲, 字段在模型類中用屬性來定義.from openerp import models, fieldsclass LessMinimalModel(): _name = 39。 name = ()通用屬性與模型類似, 字段也可以通過參數(shù)傳遞對其進(jìn)行設(shè)定:name = (required=True)字段的常用屬性有:o string (unicode, default: field’s name)字段標(biāo)簽名稱,會顯示在界面上(對用戶可見)。o help (unicode, default: ‘’)界面上顯示提示語。簡單字段字段可以分為兩類: 簡單字段和關(guān)系字段. 前者為原子值, 直接保存在模型對應(yīng)的數(shù)據(jù)庫表中。o create_date (Datetime)記錄創(chuàng)建時(shí)間。o write_date (Datetime)最后修改時(shí)間。特殊字段默認(rèn)情況下, Odoo要求模型中有一個(gè)name字段, 用于顯示和搜索, 通過設(shè)置_rec_name也可以達(dá)到這樣的目的.練習(xí) 2在openacademy模塊中定義一個(gè)新的模型Course, openacademy/: * coding: utf8 *from openerp import models, fields, apiclass Course(): _name = 39。 name = (string=Title, required=True) description = ()數(shù)據(jù)文件Odoo是一個(gè)高度數(shù)據(jù)驅(qū)動的系統(tǒng), 雖然使用Python代碼來定制模塊行為, 但很多模塊數(shù)據(jù)是在其載入時(shí)setup的, 并且有些模塊僅僅為Odoo添加數(shù)據(jù).通過數(shù)據(jù)文件來定義模塊數(shù)據(jù), 例如可以使用XML文件中的record元素定義數(shù)據(jù), 每一個(gè)record元素創(chuàng)建或者更新數(shù)據(jù)庫中的一條記錄, 形式如下:openerp data record model={model name} id={record identifier} field name={a field name}{a value}/field /record /dataopenerpo modelOdoo模型名.o id外部ID(External Identifier), 通過它可以引用到記錄(并且不需要知道記錄所在的數(shù)據(jù)庫ID).o 元素name屬性用于確定字段名稱(例如description), 該元素的body給出字段的值.數(shù)據(jù)文件必須在模塊載入清單文件列表中, ’data’列表(全部載入)或’demo’列表(只有設(shè)定為載入演示數(shù)據(jù)才會載入)中.練習(xí) 3創(chuàng)建一個(gè)數(shù)據(jù)文件來向Course中添加數(shù)據(jù), 編輯openacademy/, ’demo’列表中有該文件.openerp data record model= id=course0 field name=nameCourse 0/field field name=descriptionCourse 039。s description/field /record /data/openerp動作和菜單在Odoo中, 動作和菜單都是定義在數(shù)據(jù)庫中的數(shù)據(jù)記錄, 一般通過數(shù)據(jù)文件來定義.動作可以由三種方式觸發(fā):o 點(diǎn)擊菜單項(xiàng)(菜單項(xiàng)鏈接到特定動作)o 點(diǎn)擊視圖上的按鈕(如果按鈕連接到動作)o 作為對象的上下文動作使用menuitem, 可以用下面的形式的代碼.record model= id=action_list_ideas field name=nameIdeas/field field name=res_model/field field name=view_modetree,form/field/recordmenuitem id=menu_ideas parent=menu_root name=Ideas sequence=10 action=action_list_ideas/注意: action必須先于menu的連接使用定義, 數(shù)據(jù)文件在載入時(shí)順序地執(zhí)行, 所以動作的ID必須首先存在于數(shù)據(jù)庫中才能使用.練習(xí) 4定義一個(gè)新的菜單項(xiàng)訪問OpenAcademy課程.創(chuàng)建openacademy/views/, 并在其中添加動作和菜單.?xml version= encoding=UTF8?openerp data ! window action ! The following tag is an action definition for a window action, that is an action opening a view or a set of views record model= id=course_list_action field name=nameCourses/field field name=res_model/field field name=view_typeform/field field name=view_modetree,form/field field name=help type=html p class=oe_view_nocontent_createCreate the first course /p /field /record ! top level menu: no parent menuitem id=main_openacademy_menu name=Open Academy/ ! A first level in the left side menu is needed before using action= attribute menuitem id=openacademy_menu name=Open Academy parent=main_openacademy_menu/ ! the following menuitem should appear *after* its parent openacademy_menu and *after* its action course_list_action menuitem id=courses_menu name=Courses parent=openacademy_menu action=course_list_action/ ! Full id lo
點(diǎn)擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1