Merge branch 'develop' into feature/修改看板样式

# Conflicts:
#	sf_warehouse/__manifest__.py
#	sf_warehouse/static/src/kanban_color_change.scss
#	sf_warehouse/views/view.xml
This commit is contained in:
WEB许何哲\xuhez
2023-07-11 16:05:53 +08:00
17 changed files with 594 additions and 242 deletions

View File

@@ -22,10 +22,12 @@
'web.assets_qweb': [
],
'web.assets_backend': [
'sf_warehouse/static/src/change.scss',
'sf_warehouse/static/src/kanban_color_change.scss',
'sf_warehouse/static/src/colorGuide.js'
'web.assets_backend':[
# 'sf_warehouse/static/src/js/vanilla-masker.min.js',
'sf_warehouse/static/src/css/kanban_color_change.scss',
'sf_warehouse/static/src/js/custom_kanban_controller.js',
'sf_warehouse/static/src/xml/custom_kanban_controller.xml',
]
},

View File

@@ -0,0 +1,25 @@
.oe_kanban_card.kanban_color_1 {
background-color: #73b9a2 !important;
}
.oe_kanban_card.kanban_color_2 {
background-color: #ac6767 !important;
}
.oe_kanban_card.kanban_color_3 {
background-color: #77787b !important;
}
.color-guide {
border: 1px solid #ccc;
background-color: #f9f9f9;
padding: 10px;
}
.color-guide-item {
display: inline-block;
width: 20px;
height: 20px;
margin-right: 10px;
border-radius: 50%;
}

View File

@@ -0,0 +1,21 @@
/** @odoo-module */
import { KanbanController } from "@web/views/kanban/kanban_controller";
import { kanbanView } from "@web/views/kanban/kanban_view";
import { registry } from "@web/core/registry";
// the controller usually contains the Layout and the renderer.
class CustomKanbanController extends KanbanController {
// Your logic here, override or insert new methods...
// if you override setup(), don't forget to call super.setup()
}
CustomKanbanController.template = "sf_warehouse.CustomKanbanView";
export const customKanbanView = {
...kanbanView, // contains the default Renderer/Controller/Model
Controller: CustomKanbanController,
};
// Register it to the views registry
registry.category("views").add("custom_kanban", customKanbanView);

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates>
<t t-name="sf_warehouse.CustomKanbanView" t-inherit="web.KanbanView" owl="1">
<!-- <xpath expr="//Layout" position="before"> -->
<!-- <div> -->
<!-- Hello world ! -->
<!-- </div> -->
<!-- </xpath> -->
<xpath expr="//t[@t-component='props.Renderer']" position="before">
<div>
Hello world !
</div>
</xpath>
</t>
</templates>

View File

@@ -1,171 +1,157 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="view_location_tree2_sf_inherit" model="ir.ui.view">
<field name="name">stock.location.tree.sf.inherit</field>
<field name="model">stock.location</field>
<field name="inherit_id" ref="stock.view_location_tree2"/>
<field name="arch" type="xml">
<xpath expr="//tree/field[@name='complete_name']" position="before">
<field name="barcode"/>
</xpath>
</field>
</record>
<data>
<record id="view_location_tree2_sf_inherit" model="ir.ui.view">
<field name="name">stock.location.tree.sf.inherit</field>
<field name="model">stock.location</field>
<field name="inherit_id" ref="stock.view_location_tree2"/>
<field name="arch" type="xml">
<xpath expr="//tree/field[@name='complete_name']" position="before">
<field name="barcode"/>
</xpath>
</field>
</record>
<record id="view_location_form_sf_inherit" model="ir.ui.view">
<field name="name">stock.location.form.sf.inherit</field>
<field name="model">stock.location</field>
<field name="inherit_id" ref="stock.view_location_form"/>
<field name="arch" type="xml">
<xpath expr="//form/sheet/group" position="before">
<group string="基本信息">
<group>
<record id="view_location_form_sf_inherit" model="ir.ui.view">
<field name="name">stock.location.form.sf.inherit</field>
<field name="model">stock.location</field>
<field name="inherit_id" ref="stock.view_location_form"/>
<field name="arch" type="xml">
<xpath expr="//form/sheet/group" position="before">
<group string="基本信息">
<group>
<field name="hide_location_type" invisible="1"/>
<field name="hide_area" invisible="1"/>
<field name="hide_shelf" invisible="1"/>
<field name="hide_location" invisible="1"/>
<field name="barcode" string="编码"/>
<field name="location_type"/>
<field name="channel"
attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
<field name="direction"
attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
<field name="product_sn_id"
attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False), ('location_status', '=', '空闲')]}"/>
<field name="time_test" widget='timepicker'/>
</group>
<group>
<field name="location_category"
attrs="{'invisible': [('hide_location_type', '=', False)], 'required': [('hide_location_type', '!=', False)]}"/>
<field name="area_type"
attrs="{'invisible': [('hide_area', '=', False)], 'required': [('hide_area', '!=', False)]}"/>
<field name="shelf_height"
attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
<field name="shelf_layer"
attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
<field name="layer_capacity"
attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
<field name="product_id"
attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False), ('location_status', '=', '空闲')]}"/>
<field name="location_status"
attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False)]}"/>
</group>
<field name="hide_location_type" invisible="1"/>
<field name="hide_area" invisible="1"/>
<field name="hide_shelf" invisible="1"/>
<field name="hide_location" invisible="1"/>
<field name="barcode" string="编码"/>
<field name="location_type"/>
<field name="channel" attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
<field name="direction" attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
<field name="product_sn_id" attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False), ('location_status', '=', '空闲')]}"/>
</group>
</xpath>
<!-- <xpath expr="//form/sheet/div/button" position="before"> -->
<!-- <button string="生成货位" name="create_location" type="object" class="oe_highlight" attrs="{'invisible': [('hide_shelf', '=', False)]}"/> -->
<!-- </xpath> -->
<xpath expr="//form/sheet" position="before">
<header>
<button string="生成货位" name="create_location" type="object" class="oe_highlight"
attrs="{'invisible': [('hide_shelf', '=', False)]}"/>
</header>
</xpath>
<group>
<field name="location_category" attrs="{'invisible': [('hide_location_type', '=', False)], 'required': [('hide_location_type', '!=', False)]}"/>
<field name="area_type" attrs="{'invisible': [('hide_area', '=', False)], 'required': [('hide_area', '!=', False)]}"/>
<field name="shelf_height" attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
<field name="shelf_layer" attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
<field name="layer_capacity" attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
<field name="product_id" attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False), ('location_status', '=', '空闲')]}"/>
<field name="location_status" attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False)]}"/>
</field>
</record>
</group>
<record id="view_location_search_sf_inherit" model="ir.ui.view">
<field name="name">stock.location.search.sf.inherit</field>
<field name="model">stock.location</field>
<field name="inherit_id" ref="stock.view_location_search"/>
<field name="arch" type="xml">
<xpath expr="//search[1]" position="inside">
<searchpanel class="account_root">
<!-- <field name="location_type" icon="fa-filter"/> -->
<field name="location_id" select="multi" domain="[('location_type', '=', '货架')]"/>
</searchpanel>
</xpath>
</field>
</record>
<!-- <div class="testss">1023</div>-->
<record id="example_kanban_view" model="ir.ui.view">
<field name="name">example.kanban</field>
<field name="model">stock.location</field>
<field name="arch" type="xml">
<kanban class="o_kanban_mobile">
<div class="xu">
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_card oe_kanban_global_click
</group>
</xpath>
<!-- <xpath expr="//form/sheet/div/button" position="before"> -->
<!-- <button string="生成货位" name="create_location" type="object" class="oe_highlight" attrs="{'invisible': [('hide_shelf', '=', False)]}"/> -->
<!-- </xpath> -->
<xpath expr="//form/sheet" position="before">
<header>
<button string="生成货位" name="create_location" type="object" class="oe_highlight" attrs="{'invisible': [('hide_shelf', '=', False)]}"/>
</header>
</xpath>
</field>
</record>
<record id="view_location_search_sf_inherit" model="ir.ui.view">
<field name="name">stock.location.search.sf.inherit</field>
<field name="model">stock.location</field>
<field name="inherit_id" ref="stock.view_location_search"/>
<field name="arch" type="xml">
<xpath expr="//search[1]" position="inside">
<searchpanel class="account_root">
<!-- <field name="location_type" icon="fa-filter"/> -->
<field name="location_id" select="multi" domain="[('location_type', '=', '货架')]"/>
</searchpanel>
</xpath>
</field>
</record>
<record id="example_kanban_view" model="ir.ui.view">
<field name="name">example.kanban</field>
<field name="model">stock.location</field>
<field name="arch" type="xml">
<kanban class="o_kanban_mobile" js_class="custom_kanban">
<templates>
<t t-name="kanban-box">
<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 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="location_status"/>
</div>
<div class="o_kanban_record_bottom">
<field name="product_sn_id"/>
<span class="spilit">|</span>
<field name="product_id"/>
</div>
<!-- 标题 -->
<div class="o_kanban_card_header">
<div class="o_kanban_card_header_title">
<field name="name"/>
</div>
</t>
<!-- <t t-name="kanban-box"> -->
<!-- <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> -->
<!-- <div t-attf-class="oe_kanban_card"> -->
<!-- --><!-- 标题 -->
<!-- <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="location_status"/> -->
<!-- </div> -->
<!-- <div class="o_kanban_record_bottom"> -->
<!-- <field name="product_sn_id"/> -->
<!-- <span> | </span> -->
<!-- <field name="product_id"/> -->
<!-- </div> -->
<!-- </div> -->
<!-- </t> -->
</templates>
</div>
<!-- 内容 -->
<div class="o_kanban_record_bottom">
<field name="location_status"/>
</div>
<div class="o_kanban_record_bottom">
<field name="product_sn_id"/>
<span> | </span>
<field name="product_id"/>
</div>
</div>
</kanban>
</field>
</record>
</t>
<!-- <t t-name="kanban-box"> -->
<!-- <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> -->
<!-- <div t-attf-class="oe_kanban_card"> -->
<!-- --><!-- 标题 -->
<!-- <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="location_status"/> -->
<!-- </div> -->
<!-- <div class="o_kanban_record_bottom"> -->
<!-- <field name="product_sn_id"/> -->
<!-- <span> | </span> -->
<!-- <field name="product_id"/> -->
<!-- </div> -->
<!-- </div> -->
<!-- </t> -->
</templates>
</kanban>
</field>
</record>
<record id="kanban_action_id" model="ir.actions.act_window">
<field name="name">货位状态</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.location</field>
<field name="view_mode">kanban,form</field>
</record>
<record id="kanban_action_id" model="ir.actions.act_window">
<field name="name">货位状态</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.location</field>
<field name="view_mode">kanban,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> -->
<!-- <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_stock_location" name="货位状态" parent="stock.menu_stock_root"
sequence="50"
action="kanban_action_id"/>
</data>
</data>
</odoo>