简述网页与网站的区别,网站建设策划书编制,建站网站图片不显示,做一个自己的网站需要什么目录
1、什么是Form视图
2、Form视图的结构
3、源码示例 1、什么是Form视图 Form视图是用于查看和编辑数据库记录的界面。每个数据库模型在Odoo中都有一个Form视图#xff0c;用于显示该模型的数据。Form视图提供了一个可编辑的界面#xff0c;允许用户查看和修改数据库记…
目录
1、什么是Form视图
2、Form视图的结构
3、源码示例 1、什么是Form视图 Form视图是用于查看和编辑数据库记录的界面。每个数据库模型在Odoo中都有一个Form视图用于显示该模型的数据。Form视图提供了一个可编辑的界面允许用户查看和修改数据库记录的字段值。 2、Form视图的结构 页眉Header 通常包含记录的标题或按钮信息。 主体Body 包含字段的输入框、选择框、按钮等用于展示和编辑记录的具体数据。 页脚Footer 包含操作按钮例如保存、取消等。 示例
record idview_my_model_form modelir.ui.viewfield namenamemy.model.form/fieldfield namemodelmy.model/fieldfield namearch typexmlformgroupfield namename/field namedescription/!-- 其他字段... --/groupfooterbutton stringSave classoe_highlight typeobject namesave/button stringCancel classoe_link specialcancel//footer/form/field
/record3、源码示例
这里以CRM中的渠道作为讲解 源码 record idcrm_lead_view_form modelir.ui.viewfield namenamecrm.lead.form/fieldfield namemodelcrm.lead/fieldfield namearch typexmlform classo_lead_opportunity_form js_classcrm_formheaderbutton nameaction_set_won_rainbowman stringWontypeobject classoe_highlight data-hotkeyw titleMark as wonattrs{invisible: [|,|, (active,,False), (probability, , 100), (type, , lead)]}/button name%(crm.crm_lead_lost_action)d stringLost data-hotkeyl titleMark as losttypeaction context{default_lead_id: active_id} attrs{invisible: [|, (type, , lead), amp;,(active, , False),(probability, lt;, 100)]}/button name%(crm.action_crm_lead2opportunity_partner)d stringConvert to Opportunity typeaction helpConvert to Opportunityclassoe_highlight attrs{invisible: [|, (type, , opportunity), (active, , False)]} data-hotkeyv/button nametoggle_active stringRestore typeobject data-hotkeyzattrs{invisible: [|, (probability, gt;, 0), (active, , True)]}/button nameaction_set_lost stringLost typeobject data-hotkeyl titleMark as lostattrs{invisible: [|, (type, , opportunity), amp;, (probability, , 0), (active, , False)]}/field namestage_id widgetstatusbar classo_field_statusbaroptions{clickable: 1, fold_field: fold}domain[|, (team_id, , team_id), (team_id, , False)]attrs{invisible: [|, (active, , False), (type, , lead)]}//headersheetfield nameactive invisible1/field namecompany_id invisible1/div classoe_button_box namebutton_boxbutton nameaction_schedule_meeting typeobjectclassoe_stat_button iconfa-calendarcontext{partner_id: partner_id}attrs{invisible: [(type, , lead)]}div classo_stat_infofield namecalendar_event_count classo_stat_value/span classo_stat_text attrs{invisible: [(calendar_event_count, lt;, 2)]} Meetings/spanspan classo_stat_text attrs{invisible: [(calendar_event_count, gt;, 1)]} Meeting/span/div/buttonbutton nameaction_show_potential_duplicates typeobjectclassoe_stat_button iconfa-starattrs{invisible: [(duplicate_lead_count, lt;, 1)]}div classo_stat_infofield nameduplicate_lead_count classo_stat_value/span classo_stat_text attrs{invisible: [(duplicate_lead_count, lt;, 2)]}Similar Leads/spanspan classo_stat_text attrs{invisible: [(duplicate_lead_count, gt;, 1)]}Similar Lead/span/div/button/divwidget nameweb_ribbon titleLost bg_colorbg-danger attrs{invisible: [|, (probability, gt;, 0), (active, , True)]}/widget nameweb_ribbon titleWon attrs{invisible: [(probability, lt;, 100)]} /div classoe_titleh1field classtext-break namename placeholdere.g. Product Pricing//h1h2 classd-flex gap-2 g-0 align-items-end pb-3div attrs{invisible: [(type, , lead)]}label forexpected_revenue classoe_edit_only pb-1 /div classd-flex align-items-endfield namecompany_currency invisible1/field nameexpected_revenue classoe_inline o_input_8ch widgetmonetary options{currency_field: company_currency}/span classoe_grey p-2 groupscrm.group_use_recurring_revenues /spanspan classoe_grey p-2 groups!crm.group_use_recurring_revenues at /span/div/divdiv attrs{invisible: [(type, , lead)]} groupscrm.group_use_recurring_revenuesfield namerecurring_revenue classoe_inline o_input_10ch widgetmonetary options{currency_field: company_currency}//divdiv attrs{invisible: [(type, , lead)]} groupscrm.group_use_recurring_revenuesdiv classd-flex align-items-end ps-2field namerecurring_plan classoe_inline o_input_12ch placeholderE.g. Monthlyattrs{required: [(recurring_revenue, !, 0)]} options{no_create: True, no_open: True}/span classoe_grey p-2 at /span/div/divdivdiv classoe_edit_only d-md-flex align-items-centerlabel forprobability/div classd-flex align-items-centerbutton classps-0 ps-md-2 btn btn-link nameaction_set_automated_probability typeobjectattrs{invisible: [(is_automated_probability, , True)]}i classfa fa-gear roleimg titleSwitch to automatic probability aria-labelSwitch to automatic probability/i/buttonsmall classoe_grey h6 mb0 d-flex attrs{invisible: [(is_automated_probability, , True)]}field classmb0 nameautomated_probability force_save1/ %/small/div/divdiv idprobability classd-inline-blockfield nameis_automated_probability invisible1/field nameprobability widgetfloat classoe_inline o_input_6ch/span classoe_grey %/span/div/div/h2/divgroupgroup namelead_partner attrs{invisible: [(type, , opportunity)]}!-- Preload all the partners information --field nameis_partner_visible invisible1/field namepartner_id widgetres_partner_many2onecontext{default_name: contact_name,default_title: title,default_street: street,default_street2: street2,default_city: city,default_state_id: state_id,default_zip: zip,default_country_id: country_id,default_function: function,default_phone: phone,default_mobile: mobile,default_email: email_from,default_user_id: user_id,default_team_id: team_id,default_website: website,default_lang: lang_code,show_vat: True} attrs{invisible: [(is_partner_visible, , False)]}/field namepartner_name/label forstreet stringAddress/div classo_address_formatfield namestreet placeholderStreet... classo_address_street/field namestreet2 placeholderStreet 2... classo_address_street/field namecity placeholderCity classo_address_city/field namestate_id classo_address_state placeholderState options{no_open: True}/field namezip placeholderZIP classo_address_zip/field namecountry_id placeholderCountry classo_address_country options{no_open: True, no_create: True}//divfield namewebsite widgeturl placeholdere.g. https://www.odoo.com/field namelang_active_count invisible1/field namelang_code invisible1/field namelang_id attrs{invisible: [(lang_active_count, lt;, 1)]}options{no_quick_create: True, no_create_edit: True, no_open: True}//groupgroup nameopportunity_partner attrs{invisible: [(type, , lead)]}field namepartner_idwidgetres_partner_many2onestringCustomercontext{res_partner_search_mode: type opportunity and customer or False,default_name: contact_name or partner_name,default_street: street,default_is_company: type opportunity and contact_name False,default_company_name: type opportunity and partner_name,default_street2: street2,default_city: city,default_title: title,default_state_id: state_id,default_zip: zip,default_country_id: country_id,default_function: function,default_phone: phone,default_mobile: mobile,default_email: email_from,default_user_id: user_id,default_team_id: team_id,default_website: website,default_lang: lang_code,show_vat: True,}/field nameis_blacklisted invisible1/field namepartner_is_blacklisted invisible1/field namephone_blacklisted invisible1/field namemobile_blacklisted invisible1/field nameemail_state invisible1/field namephone_state invisible1/field namepartner_email_update invisible1/field namepartner_phone_update invisible1/label foremail_from classoe_inline/div classo_row o_row_readonlybutton namemail_action_blacklist_remove classfa fa-ban text-dangertitleThis email is blacklisted for mass mailings. Click to unblacklist.typeobject context{default_email: email_from} groupsbase.group_userattrs{invisible: [(is_blacklisted, , False)]}/field nameemail_from stringEmail widgetemail/span classfa fa-exclamation-triangle text-warning oe_edit_onlytitleBy saving this change, the customer email will also be updated.attrs{invisible: [(partner_email_update, , False)]}//divlabel forphone classoe_inline/div classo_row o_row_readonlybutton namephone_action_blacklist_remove classfa fa-ban text-dangertitleThis phone number is blacklisted for SMS Marketing. Click to unblacklist.typeobject context{default_phone: phone} groupsbase.group_userattrs{invisible: [(phone_blacklisted, , False)]}/field namephone widgetphone/span classfa fa-exclamation-triangle text-warning oe_edit_onlytitleBy saving this change, the customer phone number will also be updated.attrs{invisible: [(partner_phone_update, , False)]}//divfield namelost_reason_id attrs{invisible: [(active, , True)]}/field namedate_conversion invisible1/field nameuser_company_ids invisible1//groupgroup namelead_info attrs{invisible: [(type, , opportunity)]}label forcontact_name/div classo_rowfield namecontact_name/field nametitle placeholderTitle domain[] options{no_open: True}//divfield nameis_blacklisted invisible1/field namephone_blacklisted invisible1/field nameemail_state invisible1/field namephone_state invisible1/field namepartner_email_update invisible1/field namepartner_phone_update invisible1/label foremail_from_group_lead_info classoe_inline/div classo_row o_row_readonlybutton namemail_action_blacklist_remove classfa fa-ban text-dangertitleThis email is blacklisted for mass mailings. Click to unblacklist.typeobject context{default_email: email_from} groupsbase.group_userattrs{invisible: [(is_blacklisted, , False)]}/field nameemail_from idemail_from_group_lead_info stringEmail widgetemail/span classfa fa-exclamation-triangle text-warning oe_edit_onlytitleBy saving this change, the customer email will also be updated.attrs{invisible: [(partner_email_update, , False)]}//divfield nameemail_cc groupsbase.group_no_one/field namefunction/label forphone_group_lead_info classoe_inline/div classo_row o_row_readonlybutton namephone_action_blacklist_remove classfa fa-ban text-dangertitleThis phone number is blacklisted for SMS Marketing. Click to unblacklist.typeobject context{default_phone: phone} groupsbase.group_userattrs{invisible: [(phone_blacklisted, , False)]}/field namephone idphone_group_lead_info widgetphone/span classfa fa-exclamation-triangle text-warning oe_edit_onlytitleBy saving this change, the customer phone number will also be updated.attrs{invisible: [(partner_phone_update, , False)]}//divlabel formobile classoe_inline/div classo_row o_row_readonlybutton namephone_action_blacklist_remove classfa fa-ban text-dangertitleThis phone number is blacklisted for SMS Marketing. Click to unblacklist.typeobject context{default_phone: mobile} groupsbase.group_userattrs{invisible: [(mobile_blacklisted, , False)]}/field namemobile widgetphone stringMobile//div/groupfield nametype invisible1/group attrs{invisible: [(type, , lead)]}field nameuser_idcontext{default_sales_team_id: team_id} widgetmany2one_avatar_user/label fordate_deadlineExpected Closing/labeldiv classo_lead_opportunity_form_inline_fieldsfield namedate_deadline nolabel1 classoe_inline/field namepriority widgetpriority nolabel1 classoe_inline align-top//divfield nametag_ids widgetmany2many_tags options{color_field: color, no_create_edit: True}//groupgroup attrs{invisible: [(type, , opportunity)]}field nameuser_idcontext{default_sales_team_id: team_id} widgetmany2one_avatar_user/field nameteam_id options{no_open: True, no_create: True}//groupgroup namelead_priority attrs{invisible: [(type, , opportunity)]}field namepriority widgetpriority/field nametag_ids widgetmany2many_tags options{color_field: color, no_create_edit: True}//group/groupfield attrs{invisible: [(team_id, , False)]}namelead_properties nolabel1 columns2 hideKanbanOption1/notebookpage stringInternal Notes nameinternal_notesfield namedescription placeholderAdd a description... options{collaborative: true} //pagepage nameextra stringExtra Info attrs{invisible: [(type, , opportunity)]}groupgroup stringEmail groupsbase.group_no_onefield namemessage_bounce readonly1//groupgroup stringMarketing namecategorizationfield namecompany_idgroupsbase.group_multi_companyoptions{no_create: True}/field namecampaign_id options{create_name_field: title, always_reload: True}/field namemedium_id/field namesource_id/field namereferred//groupgroup stringAnalysisfield namedate_open/field namedate_closed//group/group/pagepage namelead stringExtra Information attrs{invisible: [(type, , lead)]}groupgroup stringContact Informationfield namepartner_name/label forstreet_page_lead stringAddress/div classo_address_formatfield namestreet idstreet_page_lead placeholderStreet... classo_address_street/field namestreet2 placeholderStreet 2... classo_address_street/field namecity placeholderCity classo_address_city/field namestate_id classo_address_state placeholderState options{no_open: True}/field namezip placeholderZIP classo_address_zip/field namecountry_id placeholderCountry classo_address_country options{no_open: True, no_create: True}//divfield namewebsite widgeturl placeholdere.g. https://www.odoo.com/field namelang_active_count invisible1/field namelang_id attrs{invisible: [(lang_active_count, lt;, 1)]}options{no_quick_create: True, no_create_edit: True, no_open: True}//groupgroup classmt48label forcontact_name_page_lead/div classo_rowfield namecontact_name idcontact_name_page_lead/field nametitle placeholderTitle domain[] options{no_open: True}//divfield namefunction/label formobile_page_lead classoe_inline/div classo_row o_row_readonlybutton namephone_action_blacklist_remove classfa fa-ban text-dangertitleThis phone number is blacklisted for SMS Marketing. Click to unblacklist.typeobject context{default_phone: mobile} groupsbase.group_userattrs{invisible: [(mobile_blacklisted, , False)]}/field namemobile idmobile_page_lead widgetphone//div/groupgroup stringMarketingfield namecampaign_id options{create_name_field: title, always_reload: True}/field namemedium_id /field namesource_id /field namereferred//groupgroup stringTracking nameMiscfield namecompany_idgroupsbase.group_multi_companyoptions{no_create: True}/field nameteam_id options{no_open: True, no_create: True}/field nameday_open /field nameday_close/field nametype invisible1//group/group/page/notebook/sheetdiv classoe_chatterfield namemessage_follower_ids/field nameactivity_ids/field namemessage_ids options{post_refresh: recipients}//div/form/field/record
参数解释 record 元素 idcrm_lead_view_form视图的唯一标识符用于在其他地方引用该视图。modelir.ui.view指定模型为 ir.ui.view这是Odoo中用于存储用户界面视图定义的模型。 field 元素 namename视图的名称用于在Odoo界面中标识该视图。modelcrm.lead指定模型为 crm.lead表示该视图关联到 crm.lead 模型。 form 元素 classo_lead_opportunity_form为视图添加CSS类名可以用于自定义视图的样式。js_classcrm_form为视图添加JavaScript类名可用于自定义视图的行为。 header 元素 包含了在 Form 视图的顶部显示的按钮和字段如 Won、Lost、Convert to Opportunity 等。 button 元素 name按钮的方法名称点击按钮时会触发该方法。string按钮上显示的文本。type按钮的类型可以是 object 或 action。classCSS类用于自定义按钮的样式。data-hotkey定义热键用户可以通过键盘快捷键触发按钮。context上下文传递给按钮触发的方法。 field 元素 namestage_id展示了一个阶段的字段使用了 widgetstatusbar显示为状态栏。domain定义了字段的域过滤条件。 sheet 元素 包含了 Form 视图主体的内容包括字段、按钮、页签等。 widget 元素 nameweb_ribbon自定义小部件用于在记录上显示标签如 Lost 或 Won。title小部件的标题。bg_color背景颜色用于区分不同的标签。 div 元素 classoe_button_box包含按钮的容器用于自定义按钮的布局。 notebook 元素 包含了多个页签每个页签使用 page 元素定义。这里有 Internal Notes、Extra Info 和 Extra Information 三个页签。 group 元素 包含了一组相关的字段可以通过 attrs 属性控制字段组的可见性。 field 元素 widgetmany2one_avatar_user使用了 many2one_avatar_user 小部件用于选择用户并显示用户的头像。 button 元素 nameaction_schedule_meeting触发一个方法来安排会议。context定义了在触发方法时传递给方法的上下文。 widget 元素 nameweb_ribbon自定义小部件用于显示记录的标签。 notebook 中的 page 元素 包含了不同的信息页例如 Internal Notes、Extra Info 和 Extra Information。 div 元素 classoe_chatter包含了关于记录的讨论和活动信息。 field 元素 namemessage_follower_ids、nameactivity_ids、namemessage_ids用于显示关注者、活动和消息的信息。