Files
app-odoo/app_sample/views/model_new_views.xml
2023-10-09 01:39:01 +08:00

271 lines
16 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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">
<tree 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"/>
</tree>
</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" attrs="{'invisible': [('active', '=', True)]}"/>
<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/16.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/16.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/16.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>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="activity_ids" widget="mail_activity"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</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,tree,form</field>
<field name="context">{'search_default_groupby_state': 1}</field>
</record>
</odoo>