mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
[app_sample] v18
This commit is contained in:
34
app_sample/views/menu_views.xml
Normal file
34
app_sample/views/menu_views.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<!-- Sample,样例,-->
|
||||
<!-- Root,根菜单,This Menu Item will appear in the Upper bar, That's why It needs NO parent or action -->
|
||||
<menuitem id="module_new_root" name="Module New Root"
|
||||
web_icon="app_sample,static/description/icon.png"
|
||||
groups="group_app_user"
|
||||
sequence="90"/>
|
||||
|
||||
<!-- Category,菜单分组,This Menu Item Must have a parent -->
|
||||
<menuitem id="module_new_cat" name="Module New Category"
|
||||
parent="module_new_root"
|
||||
sequence="91"/>
|
||||
|
||||
<!-- Action,操作菜单,This Menu Item must have a parent and an action -->
|
||||
<!-- model.new Menu -->
|
||||
<menuitem id="menu_model_new" name="Model New"
|
||||
parent="module_new_cat"
|
||||
sequence="92"
|
||||
action="action_model_new"/>
|
||||
|
||||
<menuitem id="menu_model_new_report" name="Model New Report"
|
||||
parent="module_new_cat"
|
||||
sequence="93"
|
||||
action="action_model_new_report"/>
|
||||
|
||||
<!-- Exist Menu,改当前存在菜单,Change exist menu, use context if you are using multi language-->
|
||||
<!-- <record id="Exist_ID_menu" model="ir.ui.menu" context="{'lang': 'zh_CN}">-->
|
||||
<!-- <field name="groups_id"-->
|
||||
<!-- eval="[(6,0,[ref('Exist_ID')])]"/>-->
|
||||
<!-- </record>-->
|
||||
</data>
|
||||
</odoo>
|
||||
266
app_sample/views/model_new_views.xml
Normal file
266
app_sample/views/model_new_views.xml
Normal file
@@ -0,0 +1,266 @@
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
<!-- Template for model new view,新建模型视图 -->
|
||||
<!-- model.new Tree View -->
|
||||
<record id="app_view_model_new_tree" model='ir.ui.view'>
|
||||
<field name="name">app.view.model.new.tree</field>
|
||||
<field name="model">model.new</field>
|
||||
<field name="priority">16</field>
|
||||
<field name="arch" type="xml">
|
||||
<list string="Model New" editable="bottom">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="name"/>
|
||||
<field name="ref" optional="hide"/>
|
||||
<field name="date" widget="date" optional="show"/>
|
||||
<field name="amount" optional="show" sum="Total"/>
|
||||
<field name="note" optional="hide"/>
|
||||
|
||||
<field name="day_max" invisible="1"/>
|
||||
<field name="w_progressbar" widget="progressbar" optional="show"/>
|
||||
<field name="w_percentpie" widget="percentpie" optional="show"/>
|
||||
<field name="w_gauge" widget="gauge" options="{'max_field': 'day_max'}" optional="show"/>
|
||||
<field name="state"
|
||||
decoration-warning="state == 'draft'"
|
||||
decoration-muted="state == 'cancel'"
|
||||
decoration-success="state == 'done'"
|
||||
widget="badge" optional="show"/>
|
||||
<field name="active" optional="show" widget="boolean_toggle"/>
|
||||
<field name="user_id" optional="show" widget="many2one_avatar_user"/>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- model.new Form View -->
|
||||
<record id="app_view_model_new_form" model="ir.ui.view">
|
||||
<field name="name">app.view.model.new.form</field>
|
||||
<field name="model">model.new</field>
|
||||
<field name="priority">16</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Model New">
|
||||
<header>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,done"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button name="%(account.res_partner_action_customer)d"
|
||||
type="action"
|
||||
class="oe_stat_button"
|
||||
icon="fa-pencil-square-o">
|
||||
<field name="partner_count" widget="statinfo" />
|
||||
</button>
|
||||
</div>
|
||||
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" invisible="active"/>
|
||||
<field name="image" widget='image' class="oe_avatar" options='{"preview_image": "image"}'/>
|
||||
<div class="oe_title">
|
||||
<label class="oe_edit_only" for="name"/>
|
||||
<h1>
|
||||
<field name="name"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group>
|
||||
<group name="g1">
|
||||
<field name="ref"/>
|
||||
<field name="sequence"/>
|
||||
</group>
|
||||
<group name="g2">
|
||||
<field name="active" widget="boolean_toggle"/>
|
||||
<label class="o_form_label" for="note"/>
|
||||
<div>
|
||||
<field name="note" class="oe_inline" placeholder="Special field view for more contend"/>
|
||||
<a href="https://apps.odoo.com/apps/modules/18.0/app_module_creator" title="Odoo Module Creator" class="o_doc_link"
|
||||
target="_blank"></a>
|
||||
</div>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Widget Frequently Used">
|
||||
<div class="row">
|
||||
<div class="col-5 alert alert-success mb-2 ml4" role="alert">
|
||||
<a href="https://www.odooai.cn/documentation/18.0/zh_CN/developer.html" title="Odoo Developer Tutorials" class="o_doc_link"
|
||||
target="_blank">
|
||||
Alert success: Odoo Developer reference Guides
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-5 alert alert-danger mb-2 ml4" role="alert">
|
||||
<a href="https://www.odooai.cn/blog/odoo-develope-implement-8/odoo16-owl-widget-list-110" title="Odoo Module Creator" class="o_doc_link"
|
||||
target="_blank">
|
||||
Alert danger: Get All 174+ odoo widget list
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-5 alert alert-info mb-2 ml4" role="alert">
|
||||
<a href="https://apps.odoo.com/apps/modules/18.0/app_module_creator" title="Odoo Module Creator" class="o_doc_link"
|
||||
target="_blank">
|
||||
Alert info: Get odoo module auto creator, Quick create module with view and widget.
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-5 alert alert-warning mb-2 ml4" role="alert">
|
||||
<a href="https://www.odooai.cn" title="Odoo Module Creator" class="o_doc_link"
|
||||
target="_blank">
|
||||
Alert warning: Get More support in odooai.cn
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<group>
|
||||
<group string="char">
|
||||
<field name="w_phone" widget="phone"/>
|
||||
<field name="w_email" widget="email"/>
|
||||
<field name="w_image_url" widget="image_url" options="{'size': [60, 60]}"/>
|
||||
<field name="w_url" widget="url"/>
|
||||
<field name="w_CopyClipboardURL" widget="CopyClipboardURL"/>
|
||||
<field name="w_CopyClipboardChar" widget="CopyClipboardChar"/>
|
||||
<field name="w_CopyClipboardText" widget="CopyClipboardText"/>
|
||||
</group>
|
||||
<group string="int,float,date,datetime">
|
||||
<label for="date" string="daterange"/>
|
||||
<div class="o_row">
|
||||
<field name="date" widget="daterange" options='{"related_end_date": "date_end"}'/>
|
||||
<i class="fa fa-long-arrow-right mx-2 oe_edit_only" aria-label="Arrow icon" title="Arrow"/>
|
||||
<field name="date_end" widget="daterange" options='{"related_start_date": "date"}'/>
|
||||
</div>
|
||||
<field name="w_gauge" widget="gauge" options="{'max_field': 'day_max'}"/>
|
||||
<field name="w_progressbar" widget="progressbar" options="{'editable': true}" title="Integer"/>
|
||||
<field name="w_percentpie" widget="percentpie" title="float"/>
|
||||
<field name="w_percentage" widget="percentage" title="float"/>
|
||||
</group>
|
||||
<group string="selection">
|
||||
<!-- status_with_color 是在 kanban中使用-->
|
||||
<!-- <field name="w_color_s"/>-->
|
||||
<!-- <field name="w_status_with_color" widget="status_with_color" options="{'color_field': 'w_color_s'}"/>-->
|
||||
<field name="state"
|
||||
decoration-warning="state == 'draft'"
|
||||
decoration-muted="state == 'cancel'"
|
||||
decoration-success="state == 'done'"
|
||||
widget="badge" optional="show"/>
|
||||
</group>
|
||||
<group string="many2many">
|
||||
<!-- <field name="partner_ids" widget="many2many_tags"/>-->
|
||||
<field name="partner_ids" widget="many2many_tags_avatar" string="many2many_tags_avatar"/>
|
||||
<!-- <field name="w_autosave_many2many_tags" widget="autosave_many2many_tags"-->
|
||||
<!-- options="{'no_create': True}"-->
|
||||
<!-- force_save="1"/>-->
|
||||
</group>
|
||||
<group string="many2one">
|
||||
<field name="user_id" widget="many2one_avatar_user" string="many2one_avatar_user"/>
|
||||
<field name="w_selection_badge" widget="selection_badge"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
<chatter/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- model.new Kanban View -->
|
||||
<record id="app_view_model_new_kanban" model="ir.ui.view">
|
||||
<field name="name">app.model.new.kanban</field>
|
||||
<field name="model">model.new</field>
|
||||
<field name="arch" type="xml">
|
||||
<kanban>
|
||||
<field name="id"/>
|
||||
<field name="name"/>
|
||||
<field name="amount"/>
|
||||
<field name="date"/>
|
||||
<field name="state"/>
|
||||
<field name="user_id"/>
|
||||
<field name="image"/>
|
||||
<field name="partner_count"/>
|
||||
<field name="company_id"/>
|
||||
<field name="color"/>
|
||||
<field name="w_color_s"/>
|
||||
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div t-attf-class="#{!selection_mode ? kanban_color(record.color.raw_value) : ''} oe_kanban_global_click o_has_icon oe_kanban_content oe_kanban_card">
|
||||
<div t-attf-class="o_kanban_card_header">
|
||||
<div class="o_kanban_card_header_title">
|
||||
<h3 class="o_primary"><field name="name"/></h3>
|
||||
</div>
|
||||
<div class="o_kanban_manage_button_section">
|
||||
<a class="o_kanban_manage_toggle_button" href="#"><i class="fa fa-ellipsis-v" role="img" aria-label="Manage" title="Manage"/></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="o_kanban_card_content mt4">
|
||||
<div class="o_kanban_image mr4">
|
||||
<img t-att-src="kanban_image('model.new', 'image', record.id.raw_value)" alt="Image"/>
|
||||
</div>
|
||||
<h4 class="o_kanban_record_title mb4">
|
||||
Ref: <field name="ref"/>
|
||||
</h4>
|
||||
<div class="oe_kanban_details">
|
||||
<ul>
|
||||
<li>
|
||||
<a name="%(account.res_partner_action_customer)d" type="action">
|
||||
<t t-esc="record.partner_count.value"/>
|
||||
Partner
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<field name="w_progressbar" widget="progressbar"/>
|
||||
</li>
|
||||
<li>
|
||||
<field name="w_url" widget="url"/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="o_kanban_record_bottom mt-3">
|
||||
<div class="oe_kanban_bottom_left">
|
||||
<div class="o_project_kanban_boxes d-flex align-items-baseline">
|
||||
<field name="date"/>
|
||||
</div>
|
||||
<field name="activity_ids" widget="kanban_activity"/>
|
||||
</div>
|
||||
<div class="oe_kanban_bottom_right">
|
||||
<field name="user_id" widget="many2one_avatar_user" t-if="record.user_id.raw_value"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="o_kanban_card_manage_pane dropdown-menu text-right" role="menu">
|
||||
<div class="o_kanban_card_manage_section">
|
||||
<div class="dropdown-divider mt-0"/>
|
||||
<!-- 下拉操作-->
|
||||
<div role="menuitem" class="text-end mr32">
|
||||
<a type="edit">Edit</a>
|
||||
</div>
|
||||
</div>
|
||||
<div t-if="widget.editable" role="menuitem" aria-haspopup="true" class="o_no_padding_kanban_colorpicker">
|
||||
<ul class="oe_kanban_colorpicker" data-field="color" role="popup"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
</kanban>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- model.new Search View -->
|
||||
<record id="app_view_model_new_search" model="ir.ui.view">
|
||||
<field name="name">app.view.model.new.search</field>
|
||||
<field name="model">model.new</field>
|
||||
<field name="priority">16</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Model New">
|
||||
<field name="name"/>
|
||||
<field name="ref"/>
|
||||
<field name="note"/>
|
||||
<filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
|
||||
<group expand="0" string="Group By">
|
||||
<filter string="State" name="groupby_state" context="{'group_by': 'state'}"/>
|
||||
<filter string="User" name="groupby_user_id" context="{'group_by': 'user_id'}"/>
|
||||
</group>
|
||||
<searchpanel>
|
||||
</searchpanel>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- model.new Action -->
|
||||
<record id="action_model_new" model="ir.actions.act_window">
|
||||
<field name="name">Model New</field>
|
||||
<field name="res_model">model.new</field>
|
||||
<field name="view_mode">kanban,list,form</field>
|
||||
<field name="context">{'search_default_groupby_state': 1}</field>
|
||||
</record>
|
||||
</odoo>
|
||||
58
app_sample/views/product_template_views.xml
Normal file
58
app_sample/views/product_template_views.xml
Normal file
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- Template for model view inherit,继承模型视图 -->
|
||||
<!-- List -->
|
||||
<record id="app_view_product_template_tree" model="ir.ui.view">
|
||||
<field name="name">app.view.product.template.tree</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_tree_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<field name="short_name"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Kanban-->
|
||||
<record id="app_view_product_template_kanban" model="ir.ui.view">
|
||||
<field name="name">app.view.product.template.kanban</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="name">product.template.search.brand</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_kanban_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[hasclass('oe_kanban_details')]/strong[1]" position="after">
|
||||
<div>
|
||||
<a t-if="record.product_brand_id" type="action"
|
||||
name="%(action_open_single_product_brand)d">
|
||||
<field name="product_brand_id"/>
|
||||
</a>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Form -->
|
||||
<record id="app_view_product_template_form" model="ir.ui.view">
|
||||
<field name="name">app.product.template.form</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_tooltip" position="after">
|
||||
<field name="short_name" placeholder="Brief Name"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Search -->
|
||||
<record id="app_view_product_template_search" model="ir.ui.view">
|
||||
<field name="name">app.product.template.search</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_search_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<field name="short_name"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
24
app_sample/views/website_templates.xml
Normal file
24
app_sample/views/website_templates.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- sample add same logo-->
|
||||
<template id="option_header_brand_logo" inherit_id="website.option_header_brand_logo">
|
||||
<xpath expr="//a" position="after">
|
||||
<a href="/" t-attf-class="navbar-brand logo #{_link_class}">
|
||||
<span t-if="website.logo" class="d-lg-none"
|
||||
t-field="website.logo" t-options="{'widget': 'image', 'width': auto, 'height': 40}" role="img"
|
||||
t-att-aria-label="'sample Logo of %s' % website.name" t-att-title="website.name"/>
|
||||
</a>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
<!-- not use from v15-->
|
||||
<!-- <template id="assets_backend" name="app_web_supero2m assets" inherit_id="web.assets_backend">-->
|
||||
<!-- <xpath expr="//link[last()]" position="after">-->
|
||||
<!-- <link rel="stylesheet" type="text/scss" href="/app_web_supero2m/static/src/scss/app.scss"/>-->
|
||||
<!-- </xpath>-->
|
||||
<!-- <xpath expr="script[last()]" position="after">-->
|
||||
<!-- <script type="text/javascript" src="/app_web_supero2m/static/src/js/list_renderer.js"/>-->
|
||||
<!-- </xpath>-->
|
||||
<!-- </template>-->
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user