Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/修改机床参数bug
# Conflicts: # sf_warehouse/views/shelf_location.xml
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
import logging
|
||||
import base64
|
||||
import qrcode
|
||||
import io
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.osv import expression
|
||||
from odoo.exceptions import UserError
|
||||
@@ -220,30 +223,15 @@ class SfLocation(models.Model):
|
||||
# return area_type_barcode + self.channel + self.direction + '-' + self.barcode + '-' + i_str + '-' + j_str
|
||||
|
||||
|
||||
class ShelfLocation(models.Model):
|
||||
_name = 'sf.shelf.location'
|
||||
_description = '货架货位'
|
||||
class SfShelf(models.Model):
|
||||
_name = 'sf.shelf'
|
||||
_description = '货架'
|
||||
_order = 'name'
|
||||
|
||||
# current_location_id = fields.Many2one('sf.shelf.location', string='当前位置')
|
||||
# # 目的位置
|
||||
# destination_location_id = fields.Many2one('sf.shelf.location', string='目的位置')
|
||||
current_move_ids = fields.One2many('stock.move.line', 'current_location_id', '当前位置调拨单')
|
||||
destination_move_ids = fields.One2many('stock.move.line', 'destination_location_id', '目标位置调拨单')
|
||||
storage_time = fields.Datetime('入库时间', compute='_compute_location_status')
|
||||
|
||||
@api.depends('location_status')
|
||||
def _compute_location_status(self):
|
||||
for record in self:
|
||||
if record.location_status == '占用':
|
||||
record.storage_time = datetime.datetime.now()
|
||||
if record.location_status == '空闲':
|
||||
record.storage_time = False
|
||||
if record.location_status == '禁用':
|
||||
record.storage_time = False
|
||||
|
||||
name = fields.Char('名称', required=True, size=20)
|
||||
barcode = fields.Char('编码', copy=False, size=15)
|
||||
name = fields.Char('货架名称', required=True, size=20)
|
||||
barcode = fields.Char('编码', copy=False, size=15, required=True)
|
||||
# 货位
|
||||
location_ids = fields.One2many('sf.shelf.location', 'shelf_id', string='货位')
|
||||
|
||||
check_state = fields.Selection([
|
||||
('enable', '启用'),
|
||||
@@ -253,48 +241,26 @@ class ShelfLocation(models.Model):
|
||||
def action_check(self):
|
||||
self.check_state = 'enable'
|
||||
|
||||
# 仓库类别(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='产品类别')
|
||||
shelf_location_id = fields.Many2one('stock.location', string='所属库区')
|
||||
|
||||
# picking_product_type = fields.Many2many('stock.picking', string='调拨产品类别', related='location_dest_id.product_type')
|
||||
# 货架独有字段:通道、方向、货架高度(m)、货架层数、层数容量
|
||||
channel = fields.Char(string='通道')
|
||||
channel = fields.Char(string='通道', required=True, size=10)
|
||||
direction = fields.Selection([
|
||||
('R', 'R'),
|
||||
('L', 'L')
|
||||
], string='方向')
|
||||
], string='方向', required=True)
|
||||
shelf_height = fields.Float(string='货架高度(m)')
|
||||
shelf_layer = fields.Integer(string='货架层数')
|
||||
layer_capacity = fields.Integer(string='层数容量')
|
||||
|
||||
# 货位独有字段:货位状态、产品(关联产品对象)、产品序列号(关联产品序列号对象)
|
||||
location_status = fields.Selection([
|
||||
('空闲', '空闲'),
|
||||
('占用', '占用'),
|
||||
('禁用', '禁用')
|
||||
], string='货位状态', default='空闲', readonly=True)
|
||||
# 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='产品序列号')
|
||||
# 是否有货位
|
||||
is_there_area = fields.Boolean(string='是否有货位', compute='_compute_is_there_area', default=False, store=True)
|
||||
|
||||
hide_shelf = fields.Boolean(compute='_compute_hide_what', string='隐藏货架')
|
||||
hide_location = fields.Boolean(compute='_compute_hide_what', string='隐藏货位')
|
||||
|
||||
# 修改货位状态为禁用
|
||||
def action_location_status_disable(self):
|
||||
self.location_status = '禁用'
|
||||
|
||||
# 修改货位状态为空闲
|
||||
def action_location_status_enable(self):
|
||||
self.location_status = '空闲'
|
||||
@api.depends('location_ids')
|
||||
def _compute_is_there_area(self):
|
||||
for record in self:
|
||||
record.is_there_area = bool(record.location_ids)
|
||||
|
||||
@api.onchange('shelf_location_id')
|
||||
def _onchange_shelf_location_id(self):
|
||||
@@ -307,53 +273,24 @@ class ShelfLocation(models.Model):
|
||||
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.sudo().product_id = record.product_sn_id.product_id
|
||||
record.sudo().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.sudo().hide_shelf = False
|
||||
record.sudo().hide_location = False
|
||||
if record.location_type and record.location_type == '货架':
|
||||
record.sudo().hide_shelf = True
|
||||
elif record.location_type and record.location_type == '货位':
|
||||
record.sudo().hide_location = True
|
||||
else:
|
||||
pass
|
||||
|
||||
def create_location(self):
|
||||
"""
|
||||
当仓库类型为货架时,自动生成其下面的货位,数量为货架层数*层数容量
|
||||
"""
|
||||
if self.location_type == '货架':
|
||||
for i in range(self.shelf_layer):
|
||||
for j in range(self.layer_capacity):
|
||||
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': '空闲',
|
||||
})
|
||||
area_obj = self.env['sf.shelf.location']
|
||||
for i in range(self.shelf_layer):
|
||||
for j in range(self.layer_capacity):
|
||||
location_name = self.name + '-' + str(i + 1) + '层' + '-' + str(j + 1) + '位置'
|
||||
# 检查是否已经有同名的位置存在
|
||||
existing_location = area_obj.search([('name', '=', location_name)])
|
||||
if not existing_location:
|
||||
area_obj.create({
|
||||
'name': location_name,
|
||||
'location_id': self.shelf_location_id.id,
|
||||
'barcode': self.generate_barcode(i, j),
|
||||
'location_status': '空闲',
|
||||
'shelf_id': self.id
|
||||
})
|
||||
|
||||
def generate_barcode(self, i, j):
|
||||
"""
|
||||
@@ -367,6 +304,86 @@ class ShelfLocation(models.Model):
|
||||
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'
|
||||
|
||||
# current_location_id = fields.Many2one('sf.shelf.location', string='当前位置')
|
||||
# # 目的位置
|
||||
# destination_location_id = fields.Many2one('sf.shelf.location', string='目的位置')
|
||||
current_move_ids = fields.One2many('stock.move.line', 'current_location_id', '当前位置调拨单')
|
||||
destination_move_ids = fields.One2many('stock.move.line', 'destination_location_id', '目标位置调拨单')
|
||||
storage_time = fields.Datetime('入库时间', compute='_compute_location_status')
|
||||
|
||||
@api.depends('location_status')
|
||||
def _compute_location_status(self):
|
||||
for record in self:
|
||||
if record.location_status == '占用':
|
||||
record.storage_time = datetime.datetime.now()
|
||||
if record.location_status == '空闲':
|
||||
record.storage_time = False
|
||||
if record.location_status == '禁用':
|
||||
record.storage_time = False
|
||||
|
||||
name = fields.Char('货位名称', required=True, size=20)
|
||||
barcode = fields.Char('货位编码', copy=False, size=15)
|
||||
# 货架
|
||||
shelf_id = fields.Many2one('sf.shelf', string='货架')
|
||||
|
||||
check_state = fields.Selection([
|
||||
('enable', '启用'),
|
||||
('close', '关闭')
|
||||
], string='审核状态', default='close')
|
||||
|
||||
def action_check(self):
|
||||
self.check_state = 'enable'
|
||||
|
||||
# # 仓库类别(selection:库区、库位、货位)
|
||||
# location_type = fields.Selection([
|
||||
# ('货架', '货架'),
|
||||
# ('货位', '货位')
|
||||
# ], string='存储类型')
|
||||
# 绑定库区
|
||||
# shelf_location_id = fields.Many2one('stock.location', string='所属库区', domain=[('location_type', '=', '库区')])
|
||||
location_id = fields.Many2one('stock.location', string='所属库区')
|
||||
# 产品类别 (关联:product.category)
|
||||
# product_type = fields.Many2many('product.category', string='产品类别')
|
||||
|
||||
# picking_product_type = fields.Many2many('stock.picking', string='调拨产品类别', related='location_dest_id.product_type')
|
||||
|
||||
# 货位独有字段:货位状态、产品(关联产品对象)、产品序列号(关联产品序列号对象)
|
||||
location_status = fields.Selection([
|
||||
('空闲', '空闲'),
|
||||
('占用', '占用'),
|
||||
('禁用', '禁用')
|
||||
], string='货位状态', default='空闲', readonly=True)
|
||||
# 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='产品序列号')
|
||||
|
||||
# 修改货位状态为禁用
|
||||
def action_location_status_disable(self):
|
||||
self.location_status = '禁用'
|
||||
|
||||
# 修改货位状态为空闲
|
||||
def action_location_status_enable(self):
|
||||
self.location_status = '空闲'
|
||||
|
||||
@api.depends('product_sn_id')
|
||||
def _compute_product_id(self):
|
||||
"""
|
||||
根据产品序列号,获取产品
|
||||
"""
|
||||
for record in self:
|
||||
if record.product_sn_id:
|
||||
record.sudo().product_id = record.product_sn_id.product_id
|
||||
record.sudo().location_status = '占用'
|
||||
else:
|
||||
record.product_id = False
|
||||
record.location_status = '空闲'
|
||||
|
||||
|
||||
class Sf_stock_move_line(models.Model):
|
||||
_inherit = 'stock.move.line'
|
||||
|
||||
@@ -375,6 +392,112 @@ class Sf_stock_move_line(models.Model):
|
||||
# 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)
|
||||
# lot_qr_code = fields.Binary(string='二维码', compute='_compute_lot_qr_code', store=True)
|
||||
lot_qr_code = fields.Binary(string='二维码', compute='_compute_lot_qr_code', store=True)
|
||||
|
||||
@api.depends('lot_name')
|
||||
def _compute_lot_qr_code(self):
|
||||
for record in self:
|
||||
if record.lot_id:
|
||||
# record.lot_qr_code = record.lot_id.lot_qr_code
|
||||
# 创建一个QRCode对象
|
||||
qr = qrcode.QRCode(
|
||||
version=1, # 设置版本, 1-40,控制二维码的大小
|
||||
error_correction=qrcode.constants.ERROR_CORRECT_L, # 设置错误校正等级
|
||||
box_size=10, # 设置每个格子的像素大小
|
||||
border=4, # 设置边框的格子宽度
|
||||
)
|
||||
|
||||
# 添加数据
|
||||
qr.add_data(record.lot_id.name)
|
||||
qr.make(fit=True)
|
||||
|
||||
# 创建二维码图像
|
||||
img = qr.make_image(fill_color="black", back_color="white")
|
||||
|
||||
# 创建一个内存文件
|
||||
buffer = io.BytesIO()
|
||||
img.save(buffer, format="PNG") # 将图像保存到内存文件中
|
||||
|
||||
# 获取二进制数据
|
||||
binary_data = buffer.getvalue()
|
||||
|
||||
# 使用Base64编码这些二进制数据
|
||||
data = base64.b64encode(binary_data)
|
||||
self.lot_qr_code = data
|
||||
else:
|
||||
record.lot_qr_code = False
|
||||
|
||||
def print_qr_code(self):
|
||||
self.ensure_one() # 确保这个方法只为一个记录调用
|
||||
# if not self.lot_id:
|
||||
# raise UserError("没有找到序列号。")
|
||||
# 假设_lot_qr_code方法已经生成了二维码并保存在字段中
|
||||
qr_code_data = self.lot_qr_code
|
||||
if not qr_code_data:
|
||||
raise UserError("没有找到二维码数据。")
|
||||
|
||||
# 生成下载链接或直接触发下载
|
||||
# 此处的实现依赖于你的具体需求,以下是触发下载的一种示例
|
||||
attachment = self.env['ir.attachment'].sudo().create({
|
||||
'datas': self.lot_qr_code,
|
||||
'type': 'binary',
|
||||
'description': '二维码图片',
|
||||
'name': self.lot_name + '.png',
|
||||
# 'res_id': invoice.id,
|
||||
# 'res_model': 'stock.picking',
|
||||
'public': True,
|
||||
'mimetype': 'application/x-png',
|
||||
# 'model_name': 'stock.picking',
|
||||
})
|
||||
# 返回附件的下载链接
|
||||
download_url = '/web/content/%s?download=true' % attachment.id
|
||||
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||
return {
|
||||
'type': 'ir.actions.act_url',
|
||||
'url': str(base_url) + download_url,
|
||||
'target': 'self',
|
||||
}
|
||||
|
||||
# # # 定义一个方法,用于根据序列号生成二维码
|
||||
# # @api.depends('lot_id')
|
||||
# def generate_lot_qr_code(self):
|
||||
# # 创建一个QRCode对象
|
||||
# qr = qrcode.QRCode(
|
||||
# version=1, # 设置版本, 1-40,控制二维码的大小
|
||||
# error_correction=qrcode.constants.ERROR_CORRECT_L, # 设置错误校正等级
|
||||
# box_size=10, # 设置每个格子的像素大小
|
||||
# border=4, # 设置边框的格子宽度
|
||||
# )
|
||||
#
|
||||
# # 添加数据
|
||||
# qr.add_data(self.lot_id.name)
|
||||
# qr.make(fit=True)
|
||||
#
|
||||
# # 创建二维码图像
|
||||
# img = qr.make_image(fill_color="black", back_color="white")
|
||||
#
|
||||
# # 创建一个内存文件
|
||||
# buffer = io.BytesIO()
|
||||
# img.save(buffer, format="PNG") # 将图像保存到内存文件中
|
||||
#
|
||||
# # 获取二进制数据
|
||||
# binary_data = buffer.getvalue()
|
||||
#
|
||||
# # 使用Base64编码这些二进制数据
|
||||
# data = base64.b64encode(binary_data)
|
||||
# self.lot_qr_code = data
|
||||
# attachment = self.env['ir.attachment'].sudo().create({
|
||||
# 'datas': data,
|
||||
# 'type': 'binary',
|
||||
# 'description': '二维码图片',
|
||||
# 'name': self.lot_id.name + '.png',
|
||||
# # 'res_id': invoice.id,
|
||||
# # 'res_model': 'stock.picking',
|
||||
# 'public': True,
|
||||
# 'mimetype': 'application/pdf',
|
||||
# # 'model_name': 'stock.picking',
|
||||
# })
|
||||
|
||||
# def button_test(self):
|
||||
# print(self.picking_id.name)
|
||||
@@ -652,3 +775,35 @@ class SfStockScrap(models.Model):
|
||||
|
||||
def action_check(self):
|
||||
self.check_state = 'enable'
|
||||
|
||||
|
||||
class CustomStockMove(models.Model):
|
||||
_inherit = 'stock.move'
|
||||
|
||||
def action_assign_serial_show_details(self):
|
||||
# 首先执行原有逻辑
|
||||
result = super(CustomStockMove, self).action_assign_serial_show_details()
|
||||
# 接着为每个 lot_name 生成二维码
|
||||
move_lines = self.move_line_ids # 获取当前 stock.move 对应的所有 stock.move.line 记录
|
||||
for line in move_lines:
|
||||
if line.lot_name: # 确保 lot_name 存在
|
||||
qr_data = self.compute_lot_qr_code(line.lot_name)
|
||||
# 假设 stock.move.line 模型中有一个字段叫做 lot_qr_code 用于存储二维码数据
|
||||
line.lot_qr_code = qr_data
|
||||
return result
|
||||
|
||||
def compute_lot_qr_code(self, lot_name):
|
||||
qr = qrcode.QRCode(
|
||||
version=1,
|
||||
error_correction=qrcode.constants.ERROR_CORRECT_L,
|
||||
box_size=10,
|
||||
border=4,
|
||||
)
|
||||
qr.add_data(lot_name)
|
||||
qr.make(fit=True)
|
||||
img = qr.make_image(fill_color="black", back_color="white")
|
||||
buffer = io.BytesIO()
|
||||
img.save(buffer, format="PNG")
|
||||
binary_data = buffer.getvalue()
|
||||
data = base64.b64encode(binary_data).decode() # 确保返回的是字符串形式的数据
|
||||
return data
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
|
||||
access_sf_shelf_location,sf.shelf.location,model_sf_shelf_location,sf_warehouse.group_sf_stock_user,1,0,0,0
|
||||
access_sf_shelf_location,sf.shelf.location,model_sf_shelf_location,sf_warehouse.group_sf_stock_manager,1,1,1,0
|
||||
access_sf_shelf_location_group_sf_stock_user,sf.shelf.location,model_sf_shelf_location,sf_warehouse.group_sf_stock_user,1,0,0,0
|
||||
access_sf_shelf_location_group_sf_stock_manager,sf.shelf.location,model_sf_shelf_location,sf_warehouse.group_sf_stock_manager,1,1,1,0
|
||||
access_sf_shelf_group_sf_stock_user,sf.shelf.group.sf.stock.user,model_sf_shelf,sf_warehouse.group_sf_stock_user,1,0,0,0
|
||||
access_sf_shelf_group_sf_stock_manager,sf.shelf.group.sf.stock.manager,model_sf_shelf,sf_warehouse.group_sf_stock_manager,1,1,1,0
|
||||
|
||||
access_procurement_group,procurement.group,stock.model_procurement_group,base.group_user,1,1,1,0
|
||||
access_stock_warehouse_manager,stock.warehouse.manager,stock.model_stock_warehouse,sf_warehouse.group_sf_stock_user,1,1,1,0
|
||||
|
||||
|
@@ -11,7 +11,6 @@
|
||||
</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', '=', '空闲')
|
||||
]"/>
|
||||
@@ -51,6 +50,22 @@
|
||||
</xpath>
|
||||
<xpath expr="//form//sheet//group//group//field[@name='location_dest_id']" position="after">
|
||||
<field name="destination_location_id" options="{'no_create': False}"/>
|
||||
|
||||
</xpath>
|
||||
<xpath expr="//form//sheet//group//group//field[@name='create_uid']" position="after">
|
||||
<field name="lot_qr_code" widget="image"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_view_stock_move_line_operation_tree" model="ir.ui.view">
|
||||
<field name="name">sf.stock.move.line.operation.tree</field>
|
||||
<field name="model">stock.move.line</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_move_line_operation_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='product_uom_id']" position="after">
|
||||
<field name="lot_qr_code" widget="image"/>
|
||||
<button name="print_qr_code" string="打印编码" type="object" class="oe_highlight"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -1,14 +1,78 @@
|
||||
<?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="层数容量"/>
|
||||
</group>
|
||||
<field name="location_ids" widget="one2many_list">
|
||||
<tree string="Shelf Location">
|
||||
<field name="barcode" string="编码"/>
|
||||
<field name="name" string="名称"/>
|
||||
</tree>
|
||||
</field>
|
||||
</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_warehouse.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="name" string="名称"/>
|
||||
<field name="barcode" string="编码"/>
|
||||
<field name="location_type"/>
|
||||
<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"-->
|
||||
@@ -53,9 +117,9 @@
|
||||
<field name="model">sf.shelf.location</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Shelf Location">
|
||||
|
||||
<header>
|
||||
<field name="location_status" invisible="1"/>
|
||||
|
||||
<button string="生成货位" name="create_location" type="object" class="oe_highlight"
|
||||
attrs="{'invisible': [('hide_shelf', '=', False)]}"/>
|
||||
<button string="禁用货位" name="action_location_status_disable" type="object"
|
||||
@@ -64,6 +128,11 @@
|
||||
<button string="启用货位" name="action_location_status_enable" type="object"
|
||||
class="oe_highlight"
|
||||
attrs="{'invisible': ['|', ('hide_shelf', '=', True), ('location_status', '!=', '禁用')]}"/>
|
||||
<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">
|
||||
@@ -72,7 +141,6 @@
|
||||
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"
|
||||
@@ -80,36 +148,17 @@
|
||||
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="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)]}"/>
|
||||
<field name="barcode"/>
|
||||
<field name="name"/>
|
||||
<field name="shelf_id"/>
|
||||
<field name="location_id"/>
|
||||
<field name="product_sn_id"/>
|
||||
<field name="product_id"/>
|
||||
<field name="location_status"/>
|
||||
<field name="storage_time" widget="datetime"/>
|
||||
</group>
|
||||
</sheet>
|
||||
@@ -128,13 +177,13 @@
|
||||
#{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>
|
||||
@@ -145,31 +194,31 @@
|
||||
</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> -->
|
||||
<!-- <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>
|
||||
@@ -180,10 +229,12 @@
|
||||
<field name="name">shelf.location.search</field>
|
||||
<field name="model">sf.shelf.location</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="货架货位">
|
||||
<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_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>
|
||||
@@ -191,11 +242,11 @@
|
||||
</record>
|
||||
|
||||
<record id="shelf_location_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="res_model">sf.shelf.location</field>
|
||||
<field name="view_mode">kanban,form</field>
|
||||
<field name="domain">[('location_type', '=', '货位'),('check_state','=','enable')]</field>
|
||||
<!-- <field name="domain">[('check_state','=','enable')]</field> -->
|
||||
</record>
|
||||
|
||||
<!-- <record id="example_action" model="ir.actions.act_window"> -->
|
||||
@@ -212,7 +263,7 @@
|
||||
|
||||
|
||||
<record id="action_sf_shelf_location" model="ir.actions.act_window">
|
||||
<field name="name">货架货位</field>
|
||||
<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>
|
||||
@@ -235,15 +286,14 @@
|
||||
<!-- sequence="50" -->
|
||||
<!-- action="kanban_action_id"/> -->
|
||||
|
||||
|
||||
<menuitem id="shelf_location_kanban_menu" name="货位看板" parent="stock.menu_stock_root"
|
||||
sequence="51"
|
||||
action="shelf_location_kanban_action_id"
|
||||
groups="sf_warehouse.group_sf_stock_user"/>
|
||||
|
||||
<menuitem id="menu_sf_shelf_location" name="货架货位" parent="stock.menu_warehouse_config"
|
||||
sequence="2"
|
||||
action="action_sf_shelf_location"
|
||||
groups="sf_warehouse.group_sf_stock_user"/>
|
||||
sequence="20"/>
|
||||
|
||||
|
||||
</data>
|
||||
|
||||
Reference in New Issue
Block a user