0711提交
This commit is contained in:
@@ -10,9 +10,9 @@
|
|||||||
""",
|
""",
|
||||||
'category': 'sf',
|
'category': 'sf',
|
||||||
'website': 'https://www.sf.jikimo.com',
|
'website': 'https://www.sf.jikimo.com',
|
||||||
'depends': ['stock', ],
|
'depends': ['stock','web' ],
|
||||||
'data': [
|
'data': [
|
||||||
#'security/group_security.xml',
|
# 'security/group_security.xml',
|
||||||
# 'security/ir.model.access.csv',
|
# 'security/ir.model.access.csv',
|
||||||
'views/view.xml',
|
'views/view.xml',
|
||||||
],
|
],
|
||||||
@@ -22,13 +22,12 @@
|
|||||||
|
|
||||||
'web.assets_qweb': [
|
'web.assets_qweb': [
|
||||||
],
|
],
|
||||||
'web.assets_backend':[
|
'web.assets_backend': [
|
||||||
'sf_warehouse/static/src/change.scss',
|
'sf_warehouse/static/src/change.scss',
|
||||||
'sf_warehouse/static/src/kanban_color_change.scss'
|
'sf_warehouse/static/src/kanban_color_change.scss',
|
||||||
|
'sf_warehouse/static/src/colorGuide.js'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
'license': 'LGPL-3',
|
'license': 'LGPL-3',
|
||||||
'installable': True,
|
'installable': True,
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class SfLocation(models.Model):
|
|||||||
# product_id = fields.Many2one('product.template', string='产品')
|
# product_id = fields.Many2one('product.template', string='产品')
|
||||||
product_id = fields.Many2one('product.product', string='产品', compute='_compute_product_id', readonly=True)
|
product_id = fields.Many2one('product.product', string='产品', compute='_compute_product_id', readonly=True)
|
||||||
product_sn_id = fields.Many2one('stock.lot', string='产品序列号')
|
product_sn_id = fields.Many2one('stock.lot', string='产品序列号')
|
||||||
|
time_test = fields.Char(string='time')
|
||||||
# 添加SQL约束
|
# 添加SQL约束
|
||||||
_sql_constraints = [
|
_sql_constraints = [
|
||||||
('name_uniq', 'unique(name)', '位置名称必须唯一!'),
|
('name_uniq', 'unique(name)', '位置名称必须唯一!'),
|
||||||
@@ -90,7 +90,7 @@ class SfLocation(models.Model):
|
|||||||
record.location_status = '占用'
|
record.location_status = '占用'
|
||||||
else:
|
else:
|
||||||
record.product_id = False
|
record.product_id = False
|
||||||
record.location_status = '空闲'
|
# record.location_status = '空闲'
|
||||||
|
|
||||||
@api.depends('location_type')
|
@api.depends('location_type')
|
||||||
def _compute_hide_what(self):
|
def _compute_hide_what(self):
|
||||||
|
|||||||
20
sf_warehouse/static/src/colorGuide.js
Normal file
20
sf_warehouse/static/src/colorGuide.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
odoo.define('sf_warehouse.custom_kanban', function (require) {
|
||||||
|
"use strict"
|
||||||
|
var KanbanRenderer = require('web.KanbanRenderer');
|
||||||
|
|
||||||
|
KanbanRenderer.include({
|
||||||
|
_render: function () {
|
||||||
|
var self = this;
|
||||||
|
return this._super.apply(this, arguments).then(function () {
|
||||||
|
|
||||||
|
var colorGuide = $('<div class="color-guide"> \
|
||||||
|
<span class="color-guide-item" style="background-color: red;"></span> \
|
||||||
|
<span class="color-guide-item" style="background-color: green;"></span> \
|
||||||
|
<span class="color-guide-item" style="background-color: blue;"></span> \
|
||||||
|
</div>');
|
||||||
|
self.$('.o_kanban_renderer').prepend(colorGuide);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
@@ -1,11 +1,37 @@
|
|||||||
.oe_kanban_card.kanban_color_1 {
|
.oe_kanban_card.kanban_color_1 {
|
||||||
background-color: red !important;
|
background-color: #73b9a2 !important;
|
||||||
|
opacity: 0.7;
|
||||||
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.oe_kanban_card.kanban_color_2 {
|
.oe_kanban_card.kanban_color_2 {
|
||||||
background-color: blue !important;
|
background-color: #ac6767 !important;
|
||||||
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.oe_kanban_card.kanban_color_3 {
|
.oe_kanban_card.kanban_color_3 {
|
||||||
background-color: green !important;
|
background-color: #77787b !important;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spilit {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.testss {
|
||||||
|
width: 200px !important;
|
||||||
|
height: 100px !important;
|
||||||
|
background-color: #000 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.oe_kanban_card .o_kanban_record_bottom:nth-child(2) span:nth-child(2) {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-guide-item {
|
||||||
|
display: inline-block;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,157 +1,171 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data>
|
<data>
|
||||||
<record id="view_location_tree2_sf_inherit" model="ir.ui.view">
|
<record id="view_location_tree2_sf_inherit" model="ir.ui.view">
|
||||||
<field name="name">stock.location.tree.sf.inherit</field>
|
<field name="name">stock.location.tree.sf.inherit</field>
|
||||||
<field name="model">stock.location</field>
|
<field name="model">stock.location</field>
|
||||||
<field name="inherit_id" ref="stock.view_location_tree2"/>
|
<field name="inherit_id" ref="stock.view_location_tree2"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//tree/field[@name='complete_name']" position="before">
|
<xpath expr="//tree/field[@name='complete_name']" position="before">
|
||||||
<field name="barcode"/>
|
<field name="barcode"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="view_location_form_sf_inherit" model="ir.ui.view">
|
<record id="view_location_form_sf_inherit" model="ir.ui.view">
|
||||||
<field name="name">stock.location.form.sf.inherit</field>
|
<field name="name">stock.location.form.sf.inherit</field>
|
||||||
<field name="model">stock.location</field>
|
<field name="model">stock.location</field>
|
||||||
<field name="inherit_id" ref="stock.view_location_form"/>
|
<field name="inherit_id" ref="stock.view_location_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//form/sheet/group" position="before">
|
<xpath expr="//form/sheet/group" position="before">
|
||||||
<group string="基本信息">
|
<group string="基本信息">
|
||||||
<group>
|
<group>
|
||||||
|
|
||||||
<field name="hide_location_type" invisible="1"/>
|
<field name="hide_location_type" invisible="1"/>
|
||||||
<field name="hide_area" invisible="1"/>
|
<field name="hide_area" invisible="1"/>
|
||||||
<field name="hide_shelf" invisible="1"/>
|
<field name="hide_shelf" invisible="1"/>
|
||||||
<field name="hide_location" invisible="1"/>
|
<field name="hide_location" invisible="1"/>
|
||||||
<field name="barcode" string="编码"/>
|
<field name="barcode" string="编码"/>
|
||||||
<field name="location_type"/>
|
<field name="location_type"/>
|
||||||
<field name="channel" attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
|
<field name="channel"
|
||||||
<field name="direction" attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
|
attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
|
||||||
<field name="product_sn_id" attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', 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>
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
<group>
|
</xpath>
|
||||||
<field name="location_category" attrs="{'invisible': [('hide_location_type', '=', False)], 'required': [('hide_location_type', '!=', False)]}"/>
|
<!-- <xpath expr="//form/sheet/div/button" position="before"> -->
|
||||||
<field name="area_type" attrs="{'invisible': [('hide_area', '=', False)], 'required': [('hide_area', '!=', False)]}"/>
|
<!-- <button string="生成货位" name="create_location" type="object" class="oe_highlight" attrs="{'invisible': [('hide_shelf', '=', False)]}"/> -->
|
||||||
<field name="shelf_height" attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
|
<!-- </xpath> -->
|
||||||
<field name="shelf_layer" attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
|
<xpath expr="//form/sheet" position="before">
|
||||||
<field name="layer_capacity" attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
|
<header>
|
||||||
<field name="product_id" attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False)]}"/>
|
<button string="生成货位" name="create_location" type="object" class="oe_highlight"
|
||||||
<field name="location_status" attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False)]}"/>
|
attrs="{'invisible': [('hide_shelf', '=', False)]}"/>
|
||||||
|
</header>
|
||||||
|
</xpath>
|
||||||
|
|
||||||
</group>
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
</group>
|
<record id="view_location_search_sf_inherit" model="ir.ui.view">
|
||||||
</xpath>
|
<field name="name">stock.location.search.sf.inherit</field>
|
||||||
<!-- <xpath expr="//form/sheet/div/button" position="before"> -->
|
<field name="model">stock.location</field>
|
||||||
<!-- <button string="生成货位" name="create_location" type="object" class="oe_highlight" attrs="{'invisible': [('hide_shelf', '=', False)]}"/> -->
|
<field name="inherit_id" ref="stock.view_location_search"/>
|
||||||
<!-- </xpath> -->
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//form/sheet" position="before">
|
<xpath expr="//search[1]" position="inside">
|
||||||
<header>
|
<searchpanel class="account_root">
|
||||||
<button string="生成货位" name="create_location" type="object" class="oe_highlight" attrs="{'invisible': [('hide_shelf', '=', False)]}"/>
|
<!-- <field name="location_type" icon="fa-filter"/> -->
|
||||||
</header>
|
<field name="location_id" select="multi" domain="[('location_type', '=', '货架')]"/>
|
||||||
</xpath>
|
</searchpanel>
|
||||||
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
<!-- <div class="testss">1023</div>-->
|
||||||
<record id="view_location_search_sf_inherit" model="ir.ui.view">
|
<record id="example_kanban_view" model="ir.ui.view">
|
||||||
<field name="name">stock.location.search.sf.inherit</field>
|
<field name="name">example.kanban</field>
|
||||||
<field name="model">stock.location</field>
|
<field name="model">stock.location</field>
|
||||||
<field name="inherit_id" ref="stock.view_location_search"/>
|
<field name="arch" type="xml">
|
||||||
<field name="arch" type="xml">
|
<kanban class="o_kanban_mobile">
|
||||||
<xpath expr="//search[1]" position="inside">
|
<div class="xu">
|
||||||
<searchpanel class="account_root">
|
<templates>
|
||||||
<!-- <field name="location_type" icon="fa-filter"/> -->
|
<t t-name="kanban-box">
|
||||||
<field name="location_id" select="multi" domain="[('location_type', '=', '货架')]"/>
|
<div t-attf-class="oe_kanban_card oe_kanban_global_click
|
||||||
</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">
|
|
||||||
<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_1' : ''}
|
||||||
#{record.location_status.raw_value == '占用' ? 'kanban_color_2' : ''}
|
#{record.location_status.raw_value == '占用' ? 'kanban_color_2' : ''}
|
||||||
#{record.location_status.raw_value == '禁用' ? 'kanban_color_3' : ''}">
|
#{record.location_status.raw_value == '禁用' ? 'kanban_color_3' : ''}">
|
||||||
<!-- 标题 -->
|
<!-- 标题 -->
|
||||||
<div class="o_kanban_card_header">
|
<div class="o_kanban_card_header">
|
||||||
<div class="o_kanban_card_header_title">
|
<div class="o_kanban_card_header_title">
|
||||||
<field name="name"/>
|
<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>
|
</div>
|
||||||
</div>
|
</t>
|
||||||
<!-- 内容 -->
|
<!-- <t t-name="kanban-box"> -->
|
||||||
<div class="o_kanban_record_bottom">
|
<!-- <div t-attf-class="oe_kanban_card oe_kanban_global_click -->
|
||||||
<field name="location_status"/>
|
<!-- #{record.location_status.raw_value == '空闲' ? 'kanban_color_1' : ''} -->
|
||||||
</div>
|
<!-- #{record.location_status.raw_value == '占用' ? 'kanban_color_2' : ''} -->
|
||||||
<div class="o_kanban_record_bottom">
|
<!-- #{record.location_status.raw_value == '禁用' ? 'kanban_color_3' : ''}"> -->
|
||||||
<field name="product_sn_id"/>
|
<!-- --><!-- 看板内容 -->
|
||||||
<span> | </span>
|
<!-- </div> -->
|
||||||
<field name="product_id"/>
|
<!-- <div t-attf-class="oe_kanban_card"> -->
|
||||||
</div>
|
<!-- --><!-- 标题 -->
|
||||||
|
<!-- <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>
|
||||||
</t>
|
</kanban>
|
||||||
<!-- <t t-name="kanban-box"> -->
|
</field>
|
||||||
<!-- <div t-attf-class="oe_kanban_card oe_kanban_global_click -->
|
</record>
|
||||||
<!-- #{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">
|
<record id="kanban_action_id" model="ir.actions.act_window">
|
||||||
<field name="name">货位状态</field>
|
<field name="name">货位状态</field>
|
||||||
<field name="type">ir.actions.act_window</field>
|
<field name="type">ir.actions.act_window</field>
|
||||||
<field name="res_model">stock.location</field>
|
<field name="res_model">stock.location</field>
|
||||||
<field name="view_mode">kanban,form</field>
|
<field name="view_mode">kanban,form</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- <record id="example_action" model="ir.actions.act_window"> -->
|
<!-- <record id="example_action" model="ir.actions.act_window"> -->
|
||||||
<!-- <field name="name">Example</field> -->
|
<!-- <field name="name">Example</field> -->
|
||||||
<!-- <field name="type">ir.actions.act_window</field> -->
|
<!-- <field name="type">ir.actions.act_window</field> -->
|
||||||
<!-- <field name="res_model">stock.location</field> -->
|
<!-- <field name="res_model">stock.location</field> -->
|
||||||
<!-- <field name="view_mode">kanban</field> -->
|
<!-- <field name="view_mode">kanban</field> -->
|
||||||
<!-- <field name="searchpanel">true</field> -->
|
<!-- <field name="searchpanel">true</field> -->
|
||||||
<!-- <field name="searchpanel_field_label">货架</field> -->
|
<!-- <field name="searchpanel_field_label">货架</field> -->
|
||||||
<!-- <field name="searchpanel_field_name">parent_id</field> -->
|
<!-- <field name="searchpanel_field_name">parent_id</field> -->
|
||||||
<!-- <field name="searchpanel_field_group_by">['parent_id']</field> -->
|
<!-- <field name="searchpanel_field_group_by">['parent_id']</field> -->
|
||||||
<!-- <field name="domain">[('location_type', '=', '货位')]</field> -->
|
<!-- <field name="domain">[('location_type', '=', '货位')]</field> -->
|
||||||
<!-- </record> -->
|
<!-- </record> -->
|
||||||
|
|
||||||
|
|
||||||
<menuitem id="menu_stock_location" name="货位状态" parent="stock.menu_stock_root"
|
<menuitem id="menu_stock_location" name="货位状态" parent="stock.menu_stock_root"
|
||||||
sequence="50"
|
sequence="50"
|
||||||
action="kanban_action_id"/>
|
action="kanban_action_id"/>
|
||||||
|
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
Reference in New Issue
Block a user