Odoo18-Base/addons/product/views/product_views.xml
2025-03-10 11:12:23 +07:00

497 lines
30 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- base structure of product.template, common with product.product -->
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">product.template.common.form</field>
<field name="model">product.template</field>
<field name="mode">primary</field>
<field name="arch" type="xml">
<form string="Product">
<header>
<button string="Print Labels" type="object" name="action_open_label_layout" attrs="{'invisible': [('detailed_type', '==', 'service')]}"/>
</header>
<sheet name="product_form">
<field name='product_variant_count' invisible='1'/>
<field name='is_product_variant' invisible='1'/>
<field name='attribute_line_ids' invisible='1'/>
<field name="type" invisible="1"/>
<field name="company_id" invisible="1"/>
<div class="oe_button_box" name="button_box">
<button class="oe_stat_button"
name="open_pricelist_rules"
icon="fa-list-ul"
groups="product.group_product_pricelist"
type="object">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value">
<field name="pricelist_item_count"/>
</span>
<span attrs="{'invisible': [('pricelist_item_count', '=', 1)]}">
Extra Prices
</span>
<span attrs="{'invisible': [('pricelist_item_count', '!=', 1)]}">
Extra Price
</span>
</div>
</button>
</div>
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
<field name="id" invisible="True"/>
<field name="image_1920" widget="image" class="oe_avatar" options="{'preview_image': 'image_128'}"/>
<div class="oe_title">
<label for="name" string="Product Name"/>
<h1>
<div class="d-flex">
<field name="priority" widget="priority" class="me-3"/>
<field class="text-break" name="name" placeholder="e.g. Cheese Burger"/>
</div>
</h1>
</div>
<div name="options">
<span class="d-inline-block">
<field name="sale_ok"/>
<label for="sale_ok"/>
</span>
<span class="d-inline-block">
<field name="purchase_ok"/>
<label for="purchase_ok"/>
</span>
</div>
<notebook>
<page string="General Information" name="general_information">
<group>
<group name="group_general">
<field name="active" invisible="1"/>
<field name="detailed_type"/>
<field name="product_tooltip" string="" class="fst-italic text-muted"/>
<field name="uom_id" groups="uom.group_uom" options="{'no_create': True}"/>
<field name="uom_po_id" groups="uom.group_uom" options="{'no_create': True}"/>
</group>
<group name="group_standard_price">
<label for="list_price"/>
<div name="pricing">
<field name="list_price" class="oe_inline" widget='monetary'
options="{'currency_field': 'currency_id', 'field_digits': True}"/>
</div>
<label for="standard_price" attrs="{'invisible': [('product_variant_count', '&gt;', 1), ('is_product_variant', '=', False)]}"/>
<div name="standard_price_uom" attrs="{'invisible': [('product_variant_count', '&gt;', 1), ('is_product_variant', '=', False)]}">
<field name="standard_price" class="oe_inline" widget='monetary' options="{'currency_field': 'cost_currency_id', 'field_digits': True}"/>
<span groups="uom.group_uom" >per
<field name="uom_name" class="oe_inline"/>
</span>
</div>
<field name="categ_id" string="Product Category"/>
<field name="product_tag_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
<field name="company_id" groups="base.group_multi_company"
options="{'no_create': True}"/>
<field name="currency_id" invisible="1"/>
<field name="cost_currency_id" invisible="1"/>
<field name="product_variant_id" invisible="1"/>
</group>
</group>
<group string="Internal Notes">
<field colspan="2" name="description" nolabel="1" placeholder="This note is only for internal purposes."/>
</group>
</page>
<page string="Sales" attrs="{'invisible':[('sale_ok','=',False)]}" name="sales" invisible="1">
<group name="sale">
<group string="Upsell &amp; Cross-Sell" name="upsell" invisible="1"/>
</group>
<group>
<group string="Sales Description" name="description">
<field colspan="2" name="description_sale" nolabel="1" placeholder="This note is added to sales orders and invoices."/>
</group>
</group>
</page>
<page string="Purchase" name="purchase" attrs="{'invisible': [('purchase_ok','=',False)]}" invisible="1">
<group name="purchase">
<group string="Vendor Bills" name="bill"/>
</group>
</page>
<page string="Inventory" name="inventory" groups="product.group_stock_packaging" attrs="{'invisible':[('type', '=', 'service')]}">
<group name="inventory">
<group name="group_lots_and_weight" string="Logistics" attrs="{'invisible': [('type', 'not in', ['product', 'consu'])]}">
<label for="weight" attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}"/>
<div class="o_row" name="weight" attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}">
<field name="weight" class="oe_inline"/>
<field name="weight_uom_name"/>
</div>
<label for="volume" attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}"/>
<div class="o_row" name="volume" attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}">
<field name="volume" string="Volume" class="oe_inline"/>
<field name="volume_uom_name"/>
</div>
</group>
</group>
<group name="packaging" string="Packaging"
colspan="4"
attrs="{'invisible':['|', ('type', 'not in', ['product', 'consu']), ('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}"
groups="product.group_stock_packaging">
<field colspan="2" name="packaging_ids" nolabel="1" context="{'tree_view_ref':'product.product_packaging_tree_view2', 'default_company_id': company_id}"/>
</group>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids"/>
<field name="activity_ids"/>
<field name="message_ids"/>
</div>
</form>
</field>
</record>
<record id="product_template_search_view" model="ir.ui.view">
<field name="name">product.template.search</field>
<field name="model">product.template</field>
<field name="arch" type="xml">
<search string="Product">
<field name="name" string="Product" filter_domain="['|', '|', '|', ('default_code', 'ilike', self), ('product_variant_ids.default_code', 'ilike', self),('name', 'ilike', self), ('barcode', 'ilike', self)]"/>
<field name="categ_id" filter_domain="[('categ_id', 'child_of', raw_value)]"/>
<separator/>
<filter string="Services" name="services" domain="[('type','=','service')]"/>
<filter string="Products" name="consumable" domain="[('type', 'in', ['consu', 'product'])]"/>
<separator/>
<filter string="Can be Sold" name="filter_to_sell" domain="[('sale_ok','=',True)]"/>
<filter string="Can be Purchased" name="filter_to_purchase" domain="[('purchase_ok', '=', True)]"/>
<separator/>
<field string="Attributes" name="attribute_line_ids" groups="product.group_product_variant"/>
<filter invisible="1" string="Late Activities" name="activities_overdue"
domain="[('my_activity_date_deadline', '&lt;', context_today().strftime('%Y-%m-%d'))]"
help="Show all records which has next action date is before today"/>
<filter invisible="1" string="Today Activities" name="activities_today"
domain="[('my_activity_date_deadline', '=', context_today().strftime('%Y-%m-%d'))]"/>
<filter invisible="1" string="Future Activities" name="activities_upcoming_all"
domain="[('my_activity_date_deadline', '&gt;', context_today().strftime('%Y-%m-%d'))
]"/>
<separator/>
<filter string="Favorites" name="favorites" domain="[('priority','=','1')]"/>
<separator/>
<filter string="Warnings" name="activities_exception"
domain="[('activity_exception_decoration', '!=', False)]"/>
<separator/>
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
<group expand="1" string="Group By">
<filter string="Product Type" name="type" context="{'group_by':'type'}"/>
<filter string="Product Category" name="categ_id" context="{'group_by':'categ_id'}"/>
</group>
</search>
</field>
</record>
<record id="product_template_action_all" model="ir.actions.act_window">
<field name="name">Products</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_mode">kanban,tree,form</field>
<field name="context">{}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new product
</p>
</field>
</record>
<record id="product_search_form_view" model="ir.ui.view">
<field name="name">product.product.search</field>
<field name="model">product.product</field>
<field name="mode">primary</field>
<field name="inherit_id" ref="product.product_template_search_view"/>
<field name="arch" type="xml">
<field name="name" position="replace">
<field name="name" string="Product" filter_domain="['|', '|', ('default_code', 'ilike', self), ('name', 'ilike', self), ('barcode', 'ilike', self)]"/>
</field>
<field name="attribute_line_ids" position="replace">
<field name="product_template_attribute_value_ids" groups="product.group_product_variant"/>
<field name="product_tmpl_id" string="Product Template"/>
</field>
</field>
</record>
<record id="product_normal_action" model="ir.actions.act_window">
<field name="name">Product Variants</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_mode">tree,form,kanban,activity</field>
<field name="search_view_id" ref="product_search_form_view"/>
<field name="view_id" eval="False"/> <!-- Force empty -->
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new product variant
</p><p>
You must define a product for everything you sell or purchase,
whether it's a storable product, a consumable or a service.
</p>
</field>
</record>
<record id="product_variant_easy_edit_view" model="ir.ui.view">
<field name="name">product.product.view.form.easy</field>
<field name="model">product.product</field>
<field name="mode">primary</field>
<field name="arch" type="xml">
<form string="Variant Information" duplicate="false">
<header>
<button string="Print Labels" type="object" name="action_open_label_layout"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box"/>
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
<field name="active" invisible="1"/>
<field name="id" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="image_1920" widget="image" class="oe_avatar" options="{'preview_image': 'image_128'}"/>
<div class="oe_title">
<label for="name" string="Product Name"/>
<h1><field name="name" readonly="1" placeholder="e.g. Odoo Enterprise Subscription"/></h1>
<field name="product_template_attribute_value_ids" widget="many2many_tags" readonly="1"/>
<p>
<span>All general settings about this product are managed on</span>
<button name="open_product_template" type="object" string="the product template." class="oe_link oe_link_product ps-0 ms-1 mb-1"/>
</p>
</div>
<group>
<group name="codes" string="Codes">
<field name="default_code"/>
<field name="barcode"/>
<field name="type" invisible="1"/>
</group>
<group name="pricing" string="Pricing">
<field name="product_variant_count" invisible="1"/>
<label for="lst_price" string="Sales Price"/>
<div class="o_row">
<field name="lst_price" class="oe_inline" widget='monetary' options="{'currency_field': 'currency_id', 'field_digits': True}" attrs="{'readonly': [('product_variant_count', '&gt;', 1)]}"/>
</div>
<label for="standard_price"/>
<div class="o_row">
<field name="standard_price" widget='monetary' class="oe_inline" options="{'currency_field': 'cost_currency_id'}"/>
</div>
<field name="currency_id" invisible='1'/>
<field name="cost_currency_id" invisible="1"/>
</group>
</group>
<group>
<group name="weight" string="Logistics" attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}">
<label for="volume"/>
<div class="o_row">
<field name="volume" class="oe_inline"/>
<span><field name="volume_uom_name"/></span>
</div>
<label for="weight"/>
<div class="o_row">
<field name="weight" class="oe_inline"/>
<span><field name="weight_uom_name"/></span>
</div>
</group>
<group name="tags" string="Tags">
<field name="product_tag_ids" string="Product Template Tags" widget="many2many_tags" readonly="1" options="{'no_open': True, 'color_field': 'color'}"/>
<field name="additional_product_tag_ids" widget="many2many_tags" options="{'no_open': True, 'color_field': 'color'}"/>
</group>
</group>
<group>
<group name="packaging" string="Packaging" groups="product.group_stock_packaging">
<field colspan="2" name="packaging_ids" nolabel="1"
context="{'tree_view_ref':'product.product_packaging_tree_view2', 'default_company_id': company_id}"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="product_variant_action" model="ir.actions.act_window">
<field name="name">Product Variants</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="context">{'search_default_product_tmpl_id': [active_id], 'default_product_tmpl_id': active_id, 'create': False}</field>
<field name="search_view_id" ref="product_search_form_view"/>
<field name="view_ids"
eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree'}),
(0, 0, {'view_mode': 'form', 'view_id': ref('product_variant_easy_edit_view')}),
(0, 0, {'view_mode': 'kanban'})]"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new product variant
</p><p>
You must define a product for everything you sell or purchase,
whether it's a storable product, a consumable or a service.
The product form contains information to simplify the sale process:
price, notes in the quotation, accounting data, procurement methods, etc.
</p>
</field>
</record>
<record id="product_product_tree_view" model="ir.ui.view">
<field name="name">product.product.tree</field>
<field name="model">product.product</field>
<field eval="7" name="priority"/>
<field name="arch" type="xml">
<tree string="Product Variants" multi_edit="1" duplicate="false" sample="1">
<header>
<button string="Print Labels" type="object" name="action_open_label_layout"/>
</header>
<field name="priority" widget="priority" nolabel="1" readonly="1"/>
<field name="default_code" optional="show" readonly="1"/>
<field name="barcode" optional="hide" readonly="1"/>
<field name="name" readonly="1"/>
<field name="product_template_variant_value_ids" widget="many2many_tags" groups="product.group_product_variant" readonly="1"/>
<field name="company_id" groups="base.group_multi_company" optional="hide" readonly="1"/>
<field name="lst_price" optional="show" string="Sales Price"/>
<field name="standard_price" optional="show"/>
<field name="categ_id" optional="hide"/>
<field name="product_tag_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_edit_color': 1}" optional="hide"/>
<field name="type" optional="hide" readonly="1"/>
<field name="uom_id" options="{'no_open': True, 'no_create': True}" groups="uom.group_uom" optional="show" readonly="1"/>
<field name="product_tmpl_id" invisible="1" readonly="1"/>
<field name="active" invisible="1"/>
</tree>
</field>
</record>
<record id="product_normal_form_view" model="ir.ui.view">
<field name="name">product.product.form</field>
<field name="model">product.product</field>
<field name="mode">primary</field>
<field eval="7" name="priority"/>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<form position="attributes">
<attribute name="string">Product Variant</attribute>
<attribute name="duplicate">false</attribute>
</form>
<xpath expr="//div[@name='standard_price_uom']" position="after">
<field name="default_code"/>
<field name="barcode"/>
</xpath>
<xpath expr="//field[@name='priority']" position="attributes">
<attribute name="readonly">1</attribute>
</xpath>
<field name="list_price" position="attributes">
<attribute name="attrs">{'readonly': [('product_variant_count', '&gt;', 1)]}</attribute>
<attribute name="invisible">1</attribute>
</field>
<xpath expr="//label[@for='list_price']" position="replace">
<label for="lst_price"/>
</xpath>
<field name="list_price" position="after">
<field name="lst_price" class="oe_inline" widget='monetary' options="{'currency_field': 'currency_id', 'field_digits': True}"/>
</field>
<group name="packaging" position="attributes">
<attribute name="attrs">{'invisible': 0}</attribute>
</group>
<field name="name" position="after">
<field name="product_tmpl_id" class="oe_inline" readonly="1" invisible="1" attrs="{'required': [('id', '!=', False)]}"/>
</field>
<xpath expr="//div[hasclass('oe_title')]" position="inside">
<field name="product_template_variant_value_ids" widget="many2many_tags" readonly="1" groups="product.group_product_variant"/>
</xpath>
<field name="product_tag_ids" position="attributes">
<attribute name="options">{'no_open': True, 'color_field': 'color'}</attribute>
</field>
<field name="product_tag_ids" position="after">
<field name="additional_product_tag_ids" widget="many2many_tags" options="{'no_open': True, 'color_field': 'color'}"/>
</field>
</field>
</record>
<record id="product_kanban_view" model="ir.ui.view">
<field name="name">Product Kanban</field>
<field name="model">product.product</field>
<field name="arch" type="xml">
<kanban sample="1">
<field name="id"/>
<field name="lst_price"/>
<field name="activity_state"/>
<field name="color"/>
<progressbar field="activity_state" colors='{"planned": "success", "today": "warning", "overdue": "danger"}'/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o_kanban_image">
<img t-att-src="kanban_image('product.product', 'image_128', record.id.raw_value)" alt="Product" class="o_image_64_contain"/>
</div>
<div class="oe_kanban_details">
<field name="priority" widget="priority" readonly="1"/>
<strong class="o_kanban_record_title">
<field name="name"/>
<small t-if="record.default_code.value">[<field name="default_code"/>]</small>
</strong>
<div class="o_kanban_tags_section">
<field name="product_template_variant_value_ids" groups="product.group_product_variant" widget="many2many_tags" options="{'color_field': 'color'}"/>
</div>
<ul>
<li><strong>Price: <field name="lst_price"></field></strong></li>
</ul>
<div name="tags"/>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="product_product_view_activity" model="ir.ui.view">
<field name="name">product.product.activity</field>
<field name="model">product.product</field>
<field name="arch" type="xml">
<activity string="Product Variants">
<field name="id"/>
<field name="default_code"/>
<templates>
<div t-name="activity-box">
<img t-att-src="activity_image('product.product', 'image_128', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
<div>
<field name="name" display="full"/>
<div t-if="record.default_code.value" class="text-muted">
[<field name="default_code"/>]
</div>
</div>
</div>
</templates>
</activity>
</field>
</record>
<record id="product_normal_action_sell" model="ir.actions.act_window">
<field name="name">Product Variants</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_mode">kanban,tree,form,activity</field>
<field name="context">{"search_default_filter_to_sell":1}</field>
<field name="view_id" ref="product_product_tree_view"/>
<field name="search_view_id" ref="product_search_form_view"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new product variant
</p><p>
You must define a product for everything you sell, whether it's a physical product,
a consumable or a service you offer to customers.
The product form contains information to simplify the sale process:
price, notes in the quotation, accounting data, procurement methods, etc.
</p>
</field>
</record>
<record id="action_product_price_list_report" model="ir.actions.server">
<field name="name">Generate Pricelist</field>
<field name="groups_id" eval="[(4, ref('group_product_pricelist'))]"/>
<field name="model_id" ref="product.model_product_product"/>
<field name="binding_model_id" ref="product.model_product_product"/>
<field name="state">code</field>
<field name="code">
ctx = env.context
ctx.update({'default_pricelist': env['product.pricelist'].search([], limit=1).id})
action = {
'name': 'Pricelist Report',
'type': 'ir.actions.client',
'tag': 'generate_pricelist',
'context': ctx,
}
</field>
</record>
</odoo>