Merge branch refs/heads/develop into refs/heads/feature/修改机床参数bug
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
'security/sf_stock_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'views/view.xml',
|
||||
'views/shelf_location.xml',
|
||||
'views/change_stock_move_views.xml',
|
||||
],
|
||||
'demo': [
|
||||
],
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import logging
|
||||
from odoo import api, fields, models
|
||||
from odoo.osv import expression
|
||||
|
||||
@@ -11,10 +12,13 @@ class SfLocation(models.Model):
|
||||
barcode = fields.Char('Barcode', copy=False, size=15)
|
||||
|
||||
# 仓库类别(selection:库区、库位、货位)
|
||||
# location_type = fields.Selection([
|
||||
# ('库区', '库区'),
|
||||
# ('货架', '货架'),
|
||||
# ('货位', '货位')
|
||||
# ], string='存储类型')
|
||||
location_type = fields.Selection([
|
||||
('库区', '库区'),
|
||||
('货架', '货架'),
|
||||
('货位', '货位')
|
||||
('库区', '库区')
|
||||
], string='存储类型')
|
||||
# 库区类型(selection:拣货区、存货区、收货区、退货区、次品区)
|
||||
area_type = fields.Selection([
|
||||
@@ -24,6 +28,10 @@ class SfLocation(models.Model):
|
||||
('退货区', '退货区'),
|
||||
('次品区', '次品区')
|
||||
], string='库区类型')
|
||||
# 当前位置
|
||||
current_location_id = fields.Many2one('sf.shelf.location', string='当前位置')
|
||||
# 目的位置
|
||||
destination_location_id = fields.Many2one('sf.shelf.location', string='目的位置')
|
||||
# 存储类型(selection:库区、货架)
|
||||
# storage_type = fields.Selection([
|
||||
# ('库区', '库区'),
|
||||
@@ -173,6 +181,117 @@ class SfLocation(models.Model):
|
||||
# return res
|
||||
|
||||
# 生成货位
|
||||
def create_location(self):
|
||||
"""
|
||||
当仓库类型为货架时,自动生成其下面的货位,数量为货架层数*层数容量
|
||||
"""
|
||||
pass
|
||||
# if self.location_type == '货架':
|
||||
# for i in range(self.shelf_layer):
|
||||
# for j in range(self.layer_capacity):
|
||||
# self.create({
|
||||
# 'name': self.name + '-' + str(i + 1) + '层' + '-' + str(j + 1) + '位置',
|
||||
# 'location_id': self.id,
|
||||
# 'location_type': '货位',
|
||||
# 'barcode': self.generate_barcode(i, j),
|
||||
# 'location_status': '空闲'
|
||||
# })
|
||||
|
||||
def generate_barcode(self, i, j):
|
||||
"""
|
||||
生成货位条码
|
||||
"""
|
||||
pass
|
||||
# # 这里是你生成barcode的代码
|
||||
# # area_type_barcode = self.location_id.barcode
|
||||
# area_type_barcode = self.barcode
|
||||
# i_str = str(i + 1).zfill(3) # 确保是两位数,如果不足两位,左侧补0
|
||||
# j_str = str(j + 1).zfill(3) # 确保是两位数,如果不足两位,左侧补0
|
||||
# return area_type_barcode + self.channel + self.direction + '-' + self.barcode + '-' + i_str + '-' + j_str
|
||||
|
||||
|
||||
class ShelfLocation(models.Model):
|
||||
_name = 'sf.shelf.location'
|
||||
_description = '货架货位'
|
||||
_order = 'name'
|
||||
|
||||
name = fields.Char('名称', required=True, size=20)
|
||||
barcode = fields.Char('编码', copy=False, size=15)
|
||||
|
||||
# 仓库类别(selection:库区、库位、货位)
|
||||
location_type = fields.Selection([
|
||||
('货架', '货架'),
|
||||
('货位', '货位')
|
||||
], string='存储类型')
|
||||
# 绑定库区
|
||||
shelf_location_id = fields.Many2one('stock.location', string='所属库区', domain=[('location_type', '=', '库区')])
|
||||
location_id = fields.Many2one('stock.location', string='所属库区', domain=[('location_type', '=', '库区')])
|
||||
# 产品类别 (关联:product.category)
|
||||
# product_type = fields.Many2many('product.category', string='产品类别')
|
||||
|
||||
# picking_product_type = fields.Many2many('stock.picking', string='调拨产品类别', related='location_dest_id.product_type')
|
||||
# 货架独有字段:通道、方向、货架高度(m)、货架层数、层数容量
|
||||
channel = fields.Char(string='通道')
|
||||
direction = fields.Selection([
|
||||
('R', 'R'),
|
||||
('L', 'L')
|
||||
], string='方向')
|
||||
shelf_height = fields.Float(string='货架高度(m)')
|
||||
shelf_layer = fields.Integer(string='货架层数')
|
||||
layer_capacity = fields.Integer(string='层数容量')
|
||||
|
||||
# 货位独有字段:货位状态、产品(关联产品对象)、产品序列号(关联产品序列号对象)
|
||||
location_status = fields.Selection([
|
||||
('空闲', '空闲'),
|
||||
('占用', '占用'),
|
||||
('禁用', '禁用')
|
||||
], string='货位状态', default='空闲')
|
||||
# product_id = fields.Many2one('product.template', string='产品')
|
||||
product_id = fields.Many2one('product.product', string='产品', compute='_compute_product_id', readonly=True)
|
||||
product_sn_id = fields.Many2one('stock.lot', string='产品序列号')
|
||||
|
||||
hide_shelf = fields.Boolean(compute='_compute_hide_what', string='隐藏货架')
|
||||
hide_location = fields.Boolean(compute='_compute_hide_what', string='隐藏货位')
|
||||
|
||||
@api.onchange('shelf_location_id')
|
||||
def _onchange_shelf_location_id(self):
|
||||
"""
|
||||
根据货架的所属库区修改货位的所属库区
|
||||
"""
|
||||
all_location = self.env['sf.shelf.location'].search([('name', 'ilike', self.name)])
|
||||
for record in self:
|
||||
for location in all_location:
|
||||
location.location_id = record.shelf_location_id.id
|
||||
|
||||
@api.depends('product_sn_id')
|
||||
def _compute_product_id(self):
|
||||
"""
|
||||
根据产品序列号,获取产品
|
||||
"""
|
||||
for record in self:
|
||||
if record.product_sn_id:
|
||||
record.product_id = record.product_sn_id.product_id
|
||||
record.location_status = '占用'
|
||||
else:
|
||||
record.product_id = False
|
||||
record.location_status = '空闲'
|
||||
|
||||
@api.depends('location_type')
|
||||
def _compute_hide_what(self):
|
||||
"""
|
||||
根据仓库类别,隐藏不需要的字段
|
||||
:return:
|
||||
"""
|
||||
for record in self:
|
||||
record.hide_shelf = False
|
||||
record.hide_location = False
|
||||
if record.location_type and record.location_type == '货架':
|
||||
record.hide_shelf = True
|
||||
elif record.location_type and record.location_type == '货位':
|
||||
record.hide_location = True
|
||||
else:
|
||||
pass
|
||||
|
||||
def create_location(self):
|
||||
"""
|
||||
当仓库类型为货架时,自动生成其下面的货位,数量为货架层数*层数容量
|
||||
@@ -180,13 +299,17 @@ class SfLocation(models.Model):
|
||||
if self.location_type == '货架':
|
||||
for i in range(self.shelf_layer):
|
||||
for j in range(self.layer_capacity):
|
||||
self.create({
|
||||
'name': self.name + '-' + str(i + 1) + '层' + '-' + str(j + 1) + '位置',
|
||||
'location_id': self.id,
|
||||
'location_type': '货位',
|
||||
'barcode': self.generate_barcode(i, j),
|
||||
'location_status': '空闲'
|
||||
})
|
||||
location_name = self.name + '-' + str(i + 1) + '层' + '-' + str(j + 1) + '位置'
|
||||
# 检查是否已经有同名的位置存在
|
||||
existing_location = self.search([('name', '=', location_name)])
|
||||
if not existing_location:
|
||||
self.create({
|
||||
'name': location_name,
|
||||
'location_id': self.shelf_location_id.id,
|
||||
'location_type': '货位',
|
||||
'barcode': self.generate_barcode(i, j),
|
||||
'location_status': '空闲',
|
||||
})
|
||||
|
||||
def generate_barcode(self, i, j):
|
||||
"""
|
||||
@@ -199,11 +322,121 @@ class SfLocation(models.Model):
|
||||
j_str = str(j + 1).zfill(3) # 确保是两位数,如果不足两位,左侧补0
|
||||
return area_type_barcode + self.channel + self.direction + '-' + self.barcode + '-' + i_str + '-' + j_str
|
||||
|
||||
# def generate_barcode(self, i, j):
|
||||
# # 这里是你生成barcode的代码
|
||||
# area_type_barcode = self.location_id.barcode
|
||||
# return area_type_barcode + self.channel + self.direction + '-' + self.barcode + '-' + str(i + 1) + '-'
|
||||
# + str(j + 1)
|
||||
|
||||
class Sf_stock_move_line(models.Model):
|
||||
_inherit = 'stock.move.line'
|
||||
|
||||
current_location_id = fields.Many2one(
|
||||
'sf.shelf.location', string='当前货位', compute='_compute_current_location_id', store=True)
|
||||
# location_dest_id = fields.Many2one('stock.location', string='目标库位')
|
||||
location_dest_id_product_type = fields.Many2many(related='location_dest_id.product_type')
|
||||
location_dest_id_value = fields.Integer(compute='_compute_location_dest_id_value', store=True)
|
||||
|
||||
# def button_test(self):
|
||||
# print(self.picking_id.name)
|
||||
# stock_picking = self.env['stock.picking'].search([('name', '=', self.picking_id.name)], limit=1)
|
||||
# print(self.picking_id.name)
|
||||
# print(aa.move_line_ids.lot_id.name)
|
||||
# # 获取当前的stock.picking对象
|
||||
# current_picking = self.env['stock.picking'].search([('name', '=', self.picking_id.name)], limit=1)
|
||||
#
|
||||
# # 获取当前picking的第一个stock.move对象
|
||||
# current_move = current_picking.move_ids[0] if current_picking.move_ids else False
|
||||
#
|
||||
# # 如果存在相关的stock.move对象
|
||||
# if current_move:
|
||||
# # 获取源stock.move对象
|
||||
# origin_move = current_move.move_orig_ids[0] if current_move.move_orig_ids else False
|
||||
#
|
||||
# # 从源stock.move对象获取源stock.picking对象
|
||||
# origin_picking = origin_move.picking_id if origin_move else False
|
||||
# # 现在,origin_picking就是current_picking的上一步
|
||||
# # 获取目标stock.move对象
|
||||
# dest_move = current_move.move_dest_ids[0] if current_move.move_dest_ids else False
|
||||
#
|
||||
# # 从目标stock.move对象获取目标stock.picking对象
|
||||
# dest_picking = dest_move.picking_id if dest_move else False
|
||||
# # 现在,dest_picking就是current_picking的下一步
|
||||
@api.depends('location_id')
|
||||
def _compute_current_location_id(self):
|
||||
for record in self:
|
||||
# 使用record代替self来引用当前遍历到的记录
|
||||
logging.info('record.picking_id.name: %s' % record.picking_id.name)
|
||||
logging.info('record.env: %s' % record.env['stock.picking'].search([('name', '=', record.picking_id.name)]))
|
||||
|
||||
# 获取当前的stock.picking对象
|
||||
current_picking = record.env['stock.picking'].search([('name', '=', record.picking_id.name)], limit=1)
|
||||
|
||||
# 获取当前picking的第一个stock.move对象
|
||||
current_move = current_picking.move_ids[0] if current_picking.move_ids else False
|
||||
|
||||
# 如果存在相关的stock.move对象
|
||||
if current_move:
|
||||
# 获取源stock.move对象
|
||||
origin_move = current_move.move_orig_ids[0] if current_move.move_orig_ids else False
|
||||
|
||||
# 从源stock.move对象获取源stock.picking对象
|
||||
origin_picking = origin_move.picking_id if origin_move else False
|
||||
|
||||
# 如果前一个调拨单有目标货位
|
||||
if origin_picking:
|
||||
for i in current_picking.move_line_ids:
|
||||
for j in origin_picking.move_line_ids:
|
||||
if j.destination_location_id and i.lot_id == j.lot_id:
|
||||
# 更新当前记录的current_location_id字段
|
||||
record.current_location_id = j.destination_location_id
|
||||
# # 获取目标stock.move对象
|
||||
# dest_move = current_move.move_dest_ids[0] if current_move.move_dest_ids else False
|
||||
#
|
||||
# # 从目标stock.move对象获取目标stock.picking对象
|
||||
# dest_picking = dest_move.picking_id if dest_move else False
|
||||
# # 现在,dest_picking就是current_picking的下一步
|
||||
|
||||
# 是一张单据一张单据往下走的,所以这里的目标货位是上一张单据的当前货位,且这样去计算是可以的。
|
||||
@api.depends('location_dest_id')
|
||||
def _compute_location_dest_id_value(self):
|
||||
for record in self:
|
||||
record.location_dest_id_value = record.location_dest_id.id if record.location_dest_id else False
|
||||
|
||||
destination_location_id = fields.Many2one(
|
||||
'sf.shelf.location', string='目标货位')
|
||||
|
||||
@api.onchange('destination_location_id')
|
||||
def _compute_destination_location_id(self):
|
||||
for record in self:
|
||||
shelf_location_obj = self.env['sf.shelf.location'].search(
|
||||
[('product_sn_id', '=', record.lot_id.id)])
|
||||
if shelf_location_obj:
|
||||
shelf_location_obj.product_sn_id = False
|
||||
# obj = self.env['sf.shelf.location'].search([('location_id', '=',
|
||||
# self.destination_location_id.id)])
|
||||
obj = self.env['sf.shelf.location'].search([('name', '=',
|
||||
self.destination_location_id.name)])
|
||||
if obj:
|
||||
obj.product_sn_id = record.lot_id.id
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
obj = self.env['sf.shelf.location'].search([('name', '=',
|
||||
self.destination_location_id.name)])
|
||||
if obj:
|
||||
obj.product_sn_id = record.lot_id.id
|
||||
|
||||
|
||||
class SfStockPicking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
def button_validate(self):
|
||||
"""
|
||||
重写验证方法,当验证时意味着调拨单已经完成,已经移动到了目标货位,所以需要将当前货位的状态改为空闲
|
||||
"""
|
||||
res = super(SfStockPicking, self).button_validate()
|
||||
for line in self.move_line_ids:
|
||||
if line:
|
||||
if line.current_location_id:
|
||||
line.current_location_id.product_sn_id = False
|
||||
line.current_location_id = False
|
||||
return res
|
||||
|
||||
|
||||
class SfProcurementGroup(models.Model):
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
odoo.define('sf_warehouse.custom_kanban', function (require) {
|
||||
"use strict"
|
||||
"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> \
|
||||
@@ -16,5 +15,4 @@ odoo.define('sf_warehouse.custom_kanban', function (require) {
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { CharField } from '@web/views/fields/char/char_field';
|
||||
|
||||
|
||||
import {registry} from "@web/core/registry";
|
||||
import {CharField} from '@web/views/fields/char/char_field';
|
||||
|
||||
// 继承CharField组件实现自定义组件:当光标聚焦于输入框时,选中输入框内容
|
||||
class CustomChar extends CharField {
|
||||
@@ -20,7 +18,7 @@ class CustomChar extends CharField {
|
||||
// 当光标聚焦于输入框时,选中输入框内容
|
||||
this.input.el.addEventListener('focus', function () {
|
||||
this.select();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -72,13 +70,10 @@ class CustomChar extends CharField {
|
||||
// }
|
||||
// }
|
||||
|
||||
// this.$input.on('focus', function () {
|
||||
// $(this).select();
|
||||
// });
|
||||
|
||||
|
||||
// this.$input.on('focus', function () {
|
||||
// $(this).select();
|
||||
// });
|
||||
// 当光标聚焦于输入框时,选中输入框内容
|
||||
|
||||
}
|
||||
|
||||
registry.category("fields").add("custom_char", CustomChar);
|
||||
registry.category("fields").add("custom_char", CustomChar);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import { KanbanController } from "@web/views/kanban/kanban_controller";
|
||||
import { kanbanView } from "@web/views/kanban/kanban_view";
|
||||
import { registry } from "@web/core/registry";
|
||||
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 {
|
||||
@@ -18,4 +18,4 @@ export const customKanbanView = {
|
||||
};
|
||||
|
||||
// Register it to the views registry
|
||||
registry.category("views").add("custom_kanban", customKanbanView);
|
||||
registry.category("views").add("custom_kanban", customKanbanView);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { Many2OneField } from '@web/views/fields/many2one/many2one_field';
|
||||
|
||||
import {registry} from "@web/core/registry";
|
||||
import {Many2OneField} from '@web/views/fields/many2one/many2one_field';
|
||||
|
||||
|
||||
// 继承FieldMany2One组件实现自定义组件:当光标聚焦于输入框时,选中输入框内容
|
||||
@@ -17,14 +16,14 @@ class CustomMany2One extends Many2OneField {
|
||||
// console.log('CustomMany2One.setup11111111111111');
|
||||
super.setup();
|
||||
}
|
||||
|
||||
onMounted() {
|
||||
// console.log('CustomMany2One.onMounted1');
|
||||
// 当光标聚焦于输入框时,选中输入框内容
|
||||
this.input.el.addEventListener('focus', function () {
|
||||
this.select();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
registry.category("fields").add("custom_many2one", CustomMany2One);
|
||||
|
||||
41
sf_warehouse/views/change_stock_move_views.xml
Normal file
41
sf_warehouse/views/change_stock_move_views.xml
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="sf_stock_move_line_tree" model="ir.ui.view">
|
||||
<field name="name">sf.stock.move.line.tree</field>
|
||||
<field name="model">stock.move.line</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='location_id'][2]" position="after">
|
||||
<field name="current_location_id"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='location_dest_id'][2]" position="after">
|
||||
<field name="destination_location_id" domain="[
|
||||
('location_type', '=', '货位'),
|
||||
('location_id', '=', location_dest_id_value),
|
||||
('location_status', '=', '空闲')
|
||||
]"/>
|
||||
<!-- <field name="location_dest_id_product_type"/> -->
|
||||
<!-- <field name="location_dest_id"/> -->
|
||||
<field name="location_dest_id_value" invisible="1"/>
|
||||
<!-- <button name="button_test" string="测试" type="object" class="oe_highlight"/> -->
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_stock_move_line_form" model="ir.ui.view">
|
||||
<field name="name">sf.stock.move.line.form</field>
|
||||
<field name="model">stock.move.line</field>
|
||||
<field name="inherit_id" ref="stock.view_move_line_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//form//sheet//group//group//field[@name='location_id']" position="after">
|
||||
<field name="current_location_id" options="{'no_create': False}"/>
|
||||
</xpath>
|
||||
<xpath expr="//form//sheet//group//group//field[@name='location_dest_id']" position="after">
|
||||
<field name="destination_location_id" options="{'no_create': False}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
178
sf_warehouse/views/shelf_location.xml
Normal file
178
sf_warehouse/views/shelf_location.xml
Normal file
@@ -0,0 +1,178 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<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="name" string="名称"/>
|
||||
<field name="barcode" string="编码"/>
|
||||
<field name="location_type"/>
|
||||
</tree>
|
||||
</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">
|
||||
<header>
|
||||
<button string="生成货位" name="create_location" type="object" class="oe_highlight" attrs="{'invisible': [('hide_shelf', '=', False)]}"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="hide_shelf" invisible="1"/>
|
||||
<field name="hide_location" invisible="1"/>
|
||||
<field name="name" string="名称"/>
|
||||
<field name="barcode" string="编码"/>
|
||||
<field name="location_type"/>
|
||||
<field name="shelf_location_id" attrs="{'invisible': [('location_type', '=', '货位')]}"/>
|
||||
<field name="location_id" attrs="{'readonly': [('location_type', '=', '货位')], 'invisible': [('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)]}"/>
|
||||
<!-- <field name="product_type" widget="many2many_tags"/> -->
|
||||
<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="product_id" attrs="{'invisible': [('hide_location', '=', False)]}"/>
|
||||
<!-- <field name="product_type" attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False), ('location_status', '=', '占用')]}" widget="many2many_tags"/> -->
|
||||
<field name="location_status" attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False)]}"/>
|
||||
</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="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> | </span>
|
||||
<field name="product_id"/>
|
||||
</div>
|
||||
</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>
|
||||
</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="货架货位">
|
||||
<searchpanel class="account_root">
|
||||
<!-- <field name="location_type" icon="fa-filter"/> -->
|
||||
<field name="location_id" select="multi" icon="fa-filter"/>
|
||||
<!-- <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">[('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="shelf_location_kanban_menu" name="货位看板" parent="stock.menu_stock_root"
|
||||
sequence="51"
|
||||
action="shelf_location_kanban_action_id"/>
|
||||
|
||||
<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="2"
|
||||
action="action_sf_shelf_location"/>
|
||||
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -32,6 +32,8 @@
|
||||
<field name="product_sn_id" attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False), ('location_status', '=', '空闲')]}"/>
|
||||
<!-- <field name="time_test" widget="timepicker"/>-->
|
||||
<field name="area_type" attrs="{'invisible': [('hide_area', '=', False)], 'required': [('hide_area', '!=', False)]}"/>
|
||||
<field name="current_location_id" attrs="{'invisible': [('hide_area', '=', False)]}"/>
|
||||
<field name="destination_location_id" attrs="{'invisible': [('hide_area', '=', False)]}"/>
|
||||
|
||||
</group>
|
||||
<group>
|
||||
@@ -156,9 +158,9 @@
|
||||
<!-- </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>
|
||||
|
||||
Reference in New Issue
Block a user