Files
test/sf_warehouse/views/shelf_location.xml
2025-06-19 16:18:04 +08:00

345 lines
18 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- 货架视图 -->
<record id="view_sf_shelf" model="ir.ui.view">
<field name="name">Sf Shelf</field>
<field name="model">sf.shelf</field>
<field name="arch" type="xml">
<form string="Sf Shelf">
<header>
<field name="is_there_area" invisible="1"/>
<button string="生成货位" name="create_location" type="object" class="oe_highlight"
attrs="{'invisible': [('is_there_area', '=', True)]}"/>
</header>
<sheet>
<group>
<field name="barcode" string="货架编码"/>
<field name="name" string="货架名称"/>
<field name="check_state" string="审核状态"/>
<field name="channel" string="通道"/>
<field name="shelf_location_id" string="所属库区"/>
<field name="direction" string="方向"/>
<field name="shelf_height" string="货架高度(m)"/>
<field name="shelf_layer" string="货架层数"/>
<field name="layer_capacity" string="层数容量"/>
<field name="shelf_rotative_Boolean"/>
</group>
<notebook>
<page string="货位">
<button name="print_all_location_barcode" type="object" string="一键打印"
class="oe_highlight"/>
<field name="location_ids" widget="one2many_list">
<tree string="Shelf Location">
<field name="barcode" string="编码"/>
<field name="name" string="名称"/>
<field name="qr_code" string="条码" widget="image"/>
<button string="打印" name="print_single_location_qr_code" type="object"
class="oe_highlight"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="view_sf_shelf_tree" model="ir.ui.view">
<field name="name">Sf Shelf tree</field>
<field name="model">sf.shelf</field>
<field name="arch" type="xml">
<tree string="Sf Shelf">
<field name="barcode" string="货架编码"/>
<field name="name" string="名称"/>
<field name="shelf_location_id" string="所属库区"/>
</tree>
</field>
</record>
<!-- 货架action -->
<record id="sf_shelf_action" model="ir.actions.act_window">
<field name="name">货架</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sf.shelf</field>
<field name="view_mode">tree,form</field>
<!-- <field name="view_id" ref="view_sf_shelf_tree"/> -->
</record>
<!-- 货架菜单 -->
<menuitem
id="sf_shelf_menu"
name="货架"
parent="stock.menu_warehouse_config"
sequence="19"
action="sf_shelf_action"
groups="sf_base.group_sf_stock_user"/>
<record id="view_shelf_location_tree" model="ir.ui.view">
<field name="name">Shelf Location tree</field>
<field name="model">sf.shelf.location</field>
<field name="arch" type="xml">
<tree string="Shelf Location">
<field name="barcode"/>
<field name="name"/>
<field name="location_id"/>
<!-- <field name="check_state" widget="label_selection"-->
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
<!-- <button name="action_check" string="审核" type="object"-->
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
<!-- groups="sf_base.group_sf_stock_manager"-->
<!-- class="oe_highlight"/>-->
</tree>
</field>
</record>
<!-- 货架货位移动历史按钮-->
<record id="sf_stock_move_line_view_search" model="ir.ui.view">
<field name="name">sf.view.picking.form</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.stock_move_line_view_search"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_id']" position="after">
<field name='current_location_id'/>
<field name='destination_location_id'/>
</xpath>
</field>
</record>
<record id="stock_move_line_action1" model="ir.actions.act_window">
<field name="name">移动历史</field>
<field name="res_model">stock.move.line</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="sf_stock_move_line_view_search"/>
<field name="view_id" ref="stock.view_move_line_tree"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
产品移动历史
</p>
</field>
</record>
<record id="view_shelf_location_form" model="ir.ui.view">
<field name="name">Shelf Location form</field>
<field name="model">sf.shelf.location</field>
<field name="arch" type="xml">
<form string="Shelf Location" create="0">
<header>
<button string="货位变更"
name="%(sf_warehouse.sf_shelf_location_wizard_act)d"
type="action"
context="{'default_name':name,
'default_current_name':name,
'default_current_product_sn_ids':product_sn_ids,
'default_lot_id':product_sn_id,
'default_current_shelf_id':shelf_id,
'default_current_location_id':location_id,
'default_current_barcode_id':id,
'default_current_product_id':product_id,
}"
class="btn-primary" attrs="{'invisible':[('location_status','!=','占用')]}"/>
<field name="location_status" invisible="1"/>
<button string="禁用货位" name="action_location_status_disable" type="object"
class="oe_highlight"
attrs="{'invisible': [('location_status', '!=', '空闲')]}"/>
<button string="启用货位" name="action_location_status_enable" type="object"
class="oe_highlight"
attrs="{'invisible': [('location_status', '!=', '禁用')]}"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button name="%(stock_move_line_action1)d"
type="action"
class="oe_stat_button"
context="{'search_default_current_location_id': [active_id]}"
icon="fa-exchange">
<field string="当前位置历史" name="current_move_ids" widget="statinfo"/>
</button>
<button name="%(stock_move_line_action1)d"
type="action"
class="oe_stat_button"
context="{'search_default_destination_location_id': [active_id]}"
icon="fa-exchange">
<field string="目标位置历史" name="destination_move_ids" widget="statinfo"/>
</button>
</div>
<group>
<field name="barcode" readonly="1"/>
<field name="name" readonly="1"/>
<field name="rotative_Boolean" invisible="1"/>
<field name="shelf_id" readonly="1"/>
<field name="location_id" readonly="1"/>
<field name="product_id"/>
<field name="product_sn_id" options="{'no_create': True}"
attrs="{'invisible': [('product_sn_ids', '!=', [])]}"/>
<field name="product_sn_ids"
attrs="{'invisible': [('product_sn_ids', '=', [])]}">
<tree edit="1" create="0" delete="0" editable="bottom">
<field name="lot_id" readonly="1"/>
<field name="qty" readonly="1"/>
</tree>
</field>
<field name="product_num" readonly="1"/>
<field name="location_status"/>
<field name="storage_time" widget="datetime"/>
<field name="production_id" readonly="1"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="shelf_location_kanban_view" model="ir.ui.view">
<field name="name">shelf.location.kanban</field>
<field name="model">sf.shelf.location</field>
<field name="arch" type="xml">
<kanban class="sf_kanban_location_style" js_class="custom_kanban" create="0">
<templates>
<t t-name="kanban-box">
<t t-set='isBaseStyle' t-value="user_context.isBaseStyle"/>
<div t-attf-class="oe_kanban_card oe_kanban_global_click
#{record.location_status.raw_value == '空闲' ? 'kanban_color_1' : ''}
#{record.location_status.raw_value == '占用' ? 'kanban_color_2' : ''}
#{record.location_status.raw_value == '禁用' ? 'kanban_color_3' : ''}">
<!-- 所有情况都需要的数据 (隐藏) -->
<div style="display:none">
<field name="location_status"/>
<field name="tool_name_id"/>
</div>
<t t-if="isBaseStyle">
<div class="o_kanban_card_header">
<div class="o_kanban_card_header_title">
<field name="name"/>
</div>
</div>
<div class="o_kanban_record_bottom">
<field name="product_sn_id"/>
<field name="product_id"/>
</div>
</t>
<t t-else="">
<div class="o_kanban_record_bottom sf_kanban_custom_location_info_style">
<field name="kanban_show_layer_info"/>
</div>
<!-- 添加RFID字段 -->
<!-- <t t-if="record.data and record.data.display_rfid">
<div class="o_kanban_record_bottom">
<field name="display_rfid"/>
</div>
</t>
<t t-if="record.data and record.data.tool_rfid">
<div class="o_kanban_record_bottom">
<field name="tool_rfid"/>
</div>
</t> -->
<!-- 悬停时显示的详细信息 -->
<div class="status-hover-bar">
<t t-if="record.product_id.value">
<div>产品: <t t-esc="record.product_id.value"/></div>
</t>
<t t-if="record.product_sn_id.value">
<div>标签ID: <t t-esc="record.product_sn_id.value"/></div>
</t>
<!-- <t t-if="record.display_rfid.value">
<div>rfid: <t t-esc="record.display_rfid.value"/></div>
</t>
<t t-if="record.tool_rfid.value">
<div>rfid: <t t-esc="record.tool_rfid.value"/></div>
</t> -->
<t t-if="record.tool_name_id and record.tool_name_id.value">
<div>功能刀具名称: <t t-esc="record.tool_name_id.value"/></div>
</t>
<div>状态: <t t-esc="record.location_status.value"/></div>
</div>
</t>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<!-- 搜索视图 -->
<record id="shelf_location_search_view" model="ir.ui.view">
<field name="name">shelf.location.search</field>
<field name="model">sf.shelf.location</field>
<field name="arch" type="xml">
<search string="货位">
<field name="barcode"/>
<field name="product_id"/>
<searchpanel class="account_root">
<!-- <field name="location_type" icon="fa-filter"/> -->
<!-- <field name="location_id" select="multi" icon="fa-filter"/> -->
<field name="location_id" string="所属库区" icon="fa-filter"/>
<field name="shelf_id" string="货架"/>
<!-- <field name="location_status" icon="fa-filter"/> -->
</searchpanel>
</search>
</field>
</record>
<record id="shelf_location_kanban_action_id" model="ir.actions.act_window">
<field name="name">货位看板</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sf.shelf.location</field>
<field name="view_mode">kanban,form</field>
<!-- <field name="domain">[('check_state','=','enable')]</field> -->
</record>
<!-- <record id="example_action" model="ir.actions.act_window"> -->
<!-- <field name="name">Example</field> -->
<!-- <field name="type">ir.actions.act_window</field> -->
<!-- <field name="res_model">stock.location</field> -->
<!-- <field name="view_mode">kanban</field> -->
<!-- <field name="searchpanel">true</field> -->
<!-- <field name="searchpanel_field_label">货架</field> -->
<!-- <field name="searchpanel_field_name">parent_id</field> -->
<!-- <field name="searchpanel_field_group_by">['parent_id']</field> -->
<!-- <field name="domain">[('location_type', '=', '货位')]</field> -->
<!-- </record> -->
<menuitem id="shelf_location_kanban_menu" name="货位看板" parent="stock.menu_stock_root"
sequence="51"
action="shelf_location_kanban_action_id"
groups="sf_base.group_sf_stock_user"/>
<record id="action_sf_shelf_location" model="ir.actions.act_window">
<field name="name">货位</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sf.shelf.location</field>
<field name="view_mode">tree,form</field>
</record>
<!-- <record id="example_action" model="ir.actions.act_window"> -->
<!-- <field name="name">Example</field> -->
<!-- <field name="type">ir.actions.act_window</field> -->
<!-- <field name="res_model">stock.location</field> -->
<!-- <field name="view_mode">kanban</field> -->
<!-- <field name="searchpanel">true</field> -->
<!-- <field name="searchpanel_field_label">货架</field> -->
<!-- <field name="searchpanel_field_name">parent_id</field> -->
<!-- <field name="searchpanel_field_group_by">['parent_id']</field> -->
<!-- <field name="domain">[('location_type', '=', '货位')]</field> -->
<!-- </record> -->
<!-- <menuitem id="menu_stock_location" name="货位状态" parent="stock.menu_stock_root" -->
<!-- sequence="50" -->
<!-- action="kanban_action_id"/> -->
<menuitem id="menu_sf_shelf_location" name="货位" parent="stock.menu_warehouse_config"
sequence="20"
action="action_sf_shelf_location"
groups="sf_base.group_sf_stock_user"/>
</data>
</odoo>