Compare commits

...

25 Commits

Author SHA1 Message Date
guyaodong
8b66fda899 增加kanban悬停tip 2025-06-18 14:26:53 +08:00
huziyang@jikimo.com
6321e7ef23 货位看板详情回退修复,删除幽灵卡片。 2025-06-12 15:38:56 +08:00
huziyang@jikimo.com
23dd88b7ba 解决冲突 2025-06-09 10:01:57 +08:00
huziyang@jikimo.com
f164488e48 屏蔽OCC导入 2025-06-09 09:59:47 +08:00
huziyang@jikimo.com
25b53794bb 处理#6973任务:
1货位编码规则简化
2货位看板直观化展示
2025-06-09 09:49:21 +08:00
胡尧
484fab85be Accept Merge Request #2176: (feature/6694 -> develop)
Merge Request: 修改出厂检验报告预览数据

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2176
2025-06-09 09:09:06 +08:00
胡尧
2449b92bc8 Accept Merge Request #2175: (feature/6694 -> develop)
Merge Request: 修复点击智能按钮点击的问题

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2175?initial=true
2025-06-06 09:34:15 +08:00
胡尧
d26e6edd31 Accept Merge Request #2174: (feature/6694 -> develop)
Merge Request: 修改制造订单的采购申请只能按钮判断规则

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2174?initial=true
2025-06-06 09:17:06 +08:00
胡尧
b1a04f8f44 Accept Merge Request #2173: (feature/6694 -> develop)
Merge Request: 在出厂检验报告验证数量时,增加产品的匹配

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2173?initial=true
2025-06-06 08:37:58 +08:00
胡尧
59569806e6 Accept Merge Request #2172: (feature/6694 -> develop)
Merge Request: 修复二次弹窗不能刷新页面的问题,但是js方法还需要修改

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2172
2025-06-06 08:29:51 +08:00
禹翔辉
cdf8fbb12a Accept Merge Request #2171: (feature/销售合同优化 -> develop)
Merge Request: 1、销售订单添加合同编号字段,bfm下单接口添加合同编号同步;2、优化解除装夹工单完工时解绑rfid逻辑,优化工单返工时新工单绑定rfid逻辑

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2171
2025-06-05 17:03:44 +08:00
yuxianghui
5d0f094da7 1 2025-06-05 17:03:06 +08:00
yuxianghui
95cb5251dc 1、销售订单添加合同编号字段,bfm下单接口添加合同编号同步;2、优化解除装夹工单完工时解绑rfid逻辑,优化工单返工时新工单绑定rfid逻辑 2025-06-05 16:59:33 +08:00
禹翔辉
c8fe7504c7 Accept Merge Request #2170: (feature/销售合同优化 -> develop)
Merge Request: 返工优化

Created By: @禹翔辉
Reviewed By: @秦圣
Approved By: @秦圣 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2170
2025-06-05 15:35:03 +08:00
yuxianghui
222efc57c2 返工优化 2025-06-05 15:29:14 +08:00
禹翔辉
735d5c659d Accept Merge Request #2169: (feature/销售合同优化 -> develop)
Merge Request: 处理自动化产线的确认工艺路线报错

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2169
2025-06-05 14:53:53 +08:00
yuxianghui
50d188b737 处理自动化产线的确认工艺路线报错 2025-06-05 14:49:09 +08:00
禹翔辉
af3ea0f702 Accept Merge Request #2168: (feature/销售合同优化 -> develop)
Merge Request: 处理批量修改采购申请报错

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2168
2025-06-05 13:59:35 +08:00
yuxianghui
8bf3b68cee 处理批量修改采购申请报错 2025-06-05 13:52:25 +08:00
禹翔辉
2766bc7d34 Accept Merge Request #2167: (feature/销售合同优化 -> develop)
Merge Request: 返工装夹预调工单时,清除同一个面工单的rfid,并且保留返工工单的rfid记录

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2167
2025-06-05 11:20:09 +08:00
yuxianghui
1082384d00 清除返工工单的rfid,并保留记录 2025-06-05 11:18:47 +08:00
yuxianghui
25aab1576d 返工装夹预调工单时,清除同一个面工单的rfid,并且保留返工工单的rfid记录 2025-06-05 11:11:54 +08:00
禹翔辉
87891b45ef Accept Merge Request #2165: (feature/销售合同优化 -> develop)
Merge Request: 处理返工报错

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2165
2025-06-05 10:23:23 +08:00
胡尧
b2cfdd8d78 Accept Merge Request #2166: (feature/6694 -> develop)
Merge Request: 修改质检单字段显示

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2166?initial=true
2025-06-05 10:21:11 +08:00
yuxianghui
c6cb1d367d 处理返工报错 2025-06-05 10:17:39 +08:00
16 changed files with 2129 additions and 1677 deletions

View File

@@ -9,7 +9,7 @@ class MrpWorkorder(models.Model):
exception_ids = fields.One2many('jikimo.workorder.exception', 'workorder_id', string='工单异常记录')
def write(self, values):
if 'test_results' in values and self.exception_ids:
if values.get('test_results') and self.exception_ids:
pending_exception = self.exception_ids.filtered(
lambda exc: exc.state == 'pending' and exc.exception_code == 'YC0005'
)

View File

@@ -45,8 +45,9 @@ class JikimoSaleRoutePicking(Sf_Bf_Connect):
product.product_tmpl_id.is_customer_provided = True if item['embryo_redundancy_id'] else False
order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item)
i += 1
if kw.get('contract_file_name') and kw.get('contract_file'):
if kw.get('contract_file_name') and kw.get('contract_file') and kw.get('contract_code'):
order_id.create_sale_documents(kw.get('contract_file_name'), kw.get('contract_file'))
order_id.write({'contract_code': kw.get('contract_code')})
res['factory_order_no'] = order_id.name
order_id.confirm_to_supply_method()
except Exception as e:

View File

@@ -1592,25 +1592,17 @@ class ResMrpWorkOrder(models.Model):
len(done_workorder) == len(
record.production_id.workorder_ids.filtered(lambda wo: wo.state != 'cancel'))):
is_production_id = True
if record.routing_type in ['解除装夹'] or (
record.is_rework is True and record.routing_type in ['装夹预调']):
for workorder in record.production_id.workorder_ids:
if workorder.processing_panel == record.processing_panel:
rfid_code = workorder.rfid_code
if record.is_rework is not True:
workorder.write({'rfid_code_old': rfid_code, 'rfid_code': False})
elif workorder.routing_type != '装夹预调' and workorder.state != 'rework':
workorder.write({'rfid_code_old': False, 'rfid_code': False})
elif workorder.routing_type == '装夹预调' and workorder.state != 'rework':
workorder.write({'rfid_code_old': rfid_code, 'rfid_code': False})
self.env['stock.lot'].sudo().search([('rfid', '=', rfid_code)]).write(
{'tool_material_status': '可用'})
if workorder.rfid_code:
raise ValidationError(f'{workorder.name}】工单解绑失败,请重新点击完成按钮!!!')
# workorder.rfid_code_old = rfid_code
# workorder.rfid_code = False
logging.info('workorder.rfid_code:%s' % workorder.rfid_code)
if record.routing_type in ['解除装夹']:
rfid_code = record.rfid_code
work_ids = record.production_id.workorder_ids.filtered(
lambda wo: wo.processing_panel == record.processing_panel and wo.state != 'rework')
work_ids.write({'rfid_code_old': rfid_code, 'rfid_code': False})
self.env['stock.lot'].sudo().search([('rfid', '=', rfid_code)]).write(
{'tool_material_status': '可用'})
if any(wo.rfid_code for wo in work_ids):
raise ValidationError(f'{record.name}】工单解绑失败,请重新点击完成按钮!!!')
logging.info('work_ids.rfid_code:%s' % [wo.rfid_code for wo in work_ids])
if is_production_id is True:
logging.info('product_qty:%s' % record.production_id.product_qty)
for move_raw_id in record.production_id.move_raw_ids:

View File

@@ -10,8 +10,8 @@ from odoo.exceptions import ValidationError, UserError
from odoo.modules import get_resource_path
from OCC.Extend.DataExchange import read_step_file
from OCC.Extend.DataExchange import write_stl_file
# from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file
class ResProductMo(models.Model):

View File

@@ -46,10 +46,10 @@ class ProductionWizard(models.TransientModel):
mrp_workorder_list = self.mrp_production_id.workorder_ids.filtered(lambda kw: kw.rfid_code)
for workorder in mrp_workorder_list:
rfid_code = workorder.rfid_code
workorder.filtered(lambda wo: wo.routing_type == '装夹预调' and wo.rfid_code is not False).write(
workorder.filtered(lambda wo: wo.routing_type == '装夹预调' and wo.rfid_code and wo.state != 'rework').write(
{'rfid_code_old': rfid_code, 'rfid_code': False})
workorder.filtered(lambda wo: (wo.routing_type != '装夹预调' and
(wo.rfid_code_old is not False or wo.rfid_code is not False))).write(
(wo.rfid_code_old or wo.rfid_code) and wo.state != 'rework')).write(
{'rfid_code_old': False, 'rfid_code': False})
if self.is_remanufacture is True:

View File

@@ -126,18 +126,27 @@ class ReworkWizard(models.TransientModel):
# 2、返工CNC工单和装夹预调工单则自动解绑RFID
clamp_workorder_ids = rework_workorder_ids.filtered(lambda rp: rp.routing_type == '装夹预调')
vals_list = [{
'id': order.id,
'rfid_code_old': order.rfid_code,
'rfid_code': False
} for order in rework_workorder_ids]
rework_workorder_ids.write(vals_list)
if clamp_workorder_ids:
for clamp_workorder_id in clamp_workorder_ids:
self.production_id.workorder_ids.filtered(lambda wk: (
wk.processing_panel == clamp_workorder_id.processing_panel)).write({'rfid_code': None})
# for order in rework_workorder_ids:
# order.write({
# 'rfid_code_old': order.rfid_code,
# 'rfid_code': False
# })
# 返工工单状态设置为【返工】
rework_workorder_ids.write({'state': 'rework'})
if clamp_workorder_ids:
for clamp_workorder_id in clamp_workorder_ids:
# 清除返工的装夹预调工单以及其他同面返工工单的RFID并保存rfid记录
self.production_id.workorder_ids.filtered(lambda wk: (
wk.processing_panel == clamp_workorder_id.processing_panel
and wk.state == 'rework' and wk.rfid_code)).write(
{'rfid_code_old': clamp_workorder_id.rfid_code, 'rfid_code': None})
# 清除返工的装夹预调工单同面的非返工工单的RFID
self.production_id.workorder_ids.filtered(lambda wk: (
wk.processing_panel == clamp_workorder_id.processing_panel and wk.state != 'rework')).write(
{'rfid_code_old': None, 'rfid_code': None})
# 清除其他返工工单的RFID
for work in rework_workorder_ids.filtered(lambda wk: wk.rfid_code):
work.write({'rfid_code_old': work.rfid_code, 'rfid_code': None})
# 查询返工工单对应的工艺设计记录,并调用方法拼接数据,用于创建新的工单
workorders_values = []
for work in rework_workorder_ids:
@@ -164,8 +173,12 @@ class ReworkWizard(models.TransientModel):
# ====新工单绑定rfid===
for new_work_id in new_work_ids:
if new_work_id.routing_type in ['CNC加工', '解除装夹']:
new_work_id.write({'rfid_code': self.production_id.workorder_ids.filtered(
lambda wk: wk.sequence == new_work_id.sequence - 1).rfid_code})
# 获取new_work_id同一个加工面已经绑定rfid的非返工的装夹预调工单
work_id = self.production_id.workorder_ids.filtered(
lambda wk: (wk.processing_panel == new_work_id.processing_panel and wk.rfid_code
and wk.routing_type == '装夹预调' and wk.state != 'rework'))
if work_id:
new_work_id.write({'rfid_code': work_id.rfid_code})
self.production_id.detection_result_ids.filtered(
lambda ap1: ap1.handle_result == '待处理').write({'handle_result': '已处理'})
panels = [] # 返工的加工面
@@ -219,11 +232,13 @@ class ReworkWizard(models.TransientModel):
self.production_id.get_new_program(panel_name)
if self.reprogramming_num >= 0 and self.programming_state == '已下发':
# ============= 处理CNC加工加工工单的 CNC程序和cmm程序 信息=============
for cnc_work in new_work_ids.filtered(lambda wk: wk.name == 'CNC加工' or wk.name == '人工线下加工'):
for cnc_work in new_work_ids.filtered(
lambda wk: wk.name == 'CNC加工' or wk.name == '人工线下加工'):
ret = {'programming_list': []}
old_cnc_rework = max(self.production_id.workorder_ids.filtered(
lambda crw: crw.processing_panel == cnc_work.processing_panel
and crw.state == 'rework' and (crw.routing_type == 'CNC加工' or crw.routing_type == '人工线下加工')),
and crw.state == 'rework' and (
crw.routing_type == 'CNC加工' or crw.routing_type == '人工线下加工')),
key=lambda w: w.create_date
)
# 获取当前工单的CNC程序和cmm程序
@@ -265,7 +280,8 @@ class ReworkWizard(models.TransientModel):
new_cnc_workorder = self.production_id.workorder_ids.filtered(
lambda ap1: ap1.processing_panel == cnc_work.processing_panel
and ap1.state not in (
'rework', 'done') and (ap1.routing_type == 'CNC加工' or ap1.routing_type == '人工线下加工')
'rework', 'done') and (
ap1.routing_type == 'CNC加工' or ap1.routing_type == '人工线下加工')
)
if not new_cnc_workorder.cnc_ids:
new_cnc_workorder.write({
@@ -302,7 +318,8 @@ class ReworkWizard(models.TransientModel):
'is_rework': False})
# ==================申请重新编程=======================
if self.is_reprogramming is True:
self.production_id.update_programming_state(trigger_time=datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
self.production_id.update_programming_state(
trigger_time=datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
self.production_id.write(
{'programming_state': '编程中', 'work_state': '编程中', 'state': 'progress'})
# ================= 返工完成,制造订单状态置为加工中 ==============
@@ -323,7 +340,7 @@ class ReworkWizard(models.TransientModel):
for p in production_id.detection_result_ids.filtered(
lambda ap1: ap1.handle_result == '待处理'):
if p.processing_panel is not False and p.processing_panel not in panel_arr:
if len(panel_arr)>0:
if len(panel_arr) > 0:
panel_arr += ','.join(p.processing_panel)
else:
panel_arr = p.processing_panel

View File

@@ -10,10 +10,13 @@ class SFMessagePurchaseRequest(models.Model):
_inherit = ['purchase.request', 'jikimo.message.dispatch']
def write(self, vals):
original_state = self.state
original_state = {}
for item in self:
original_state.update({f'{item.id}': item.state})
res = super(SFMessagePurchaseRequest, self).write(vals)
if vals.get('state') == 'approved' and original_state != 'approved':
self.add_queue('采购申请待处理通知')
for item in self:
if vals.get('state') == 'approved' and original_state.get(f'{item.id}') != 'approved':
item.add_queue('采购申请待处理通知')
return res
def _get_message(self, message_queue_ids):

View File

@@ -8,8 +8,8 @@ from datetime import datetime
import requests
from odoo import http
from odoo.http import request
from OCC.Extend.DataExchange import read_step_file
from OCC.Extend.DataExchange import write_stl_file
# from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file
from odoo import models, fields, api
from odoo.modules import get_resource_path
from odoo.exceptions import ValidationError, UserError

View File

@@ -5,8 +5,8 @@ import requests
import os
from datetime import datetime
# from OCC.Core.GProp import GProp_GProps
from OCC.Extend.DataExchange import read_step_file
from OCC.Extend.DataExchange import write_stl_file
# from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file
from odoo.addons.sf_base.commons.common import Common
from odoo import models, fields, api
from odoo.modules import get_resource_path

View File

@@ -63,6 +63,7 @@ class ReSaleOrder(models.Model):
model_display_version = fields.Char('模型展示版本', default="v1")
contract_code = fields.Char('合同编号')
contract_document_id = fields.Many2one('documents.document', string='合同文件')
contract_file = fields.Binary(related='contract_document_id.datas', string='合同文件内容')
contract_file_name = fields.Char(related='contract_document_id.attachment_id.name', string='文件名')
@@ -374,12 +375,13 @@ class RePurchaseOrder(models.Model):
@api.depends('partner_id')
def _compute_user_id(self):
if not self.user_id:
if self.partner_id:
self.user_id = self.partner_id.purchase_user_id.id
# self.state = 'purchase'
else:
self.user_id = self.env.user.id
for item in self:
if not item.user_id:
if item.partner_id:
item.user_id = item.partner_id.purchase_user_id.id
# self.state = 'purchase'
else:
item.user_id = item.env.user.id
@api.constrains('order_line')
def check_order_line(self):

View File

@@ -2,7 +2,7 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': '机企猫智能工厂 库存管理',
'version': '1.0',
'version': '1.2',
'summary': '智能工厂库存管理',
'sequence': 1,
'description': """
@@ -23,17 +23,16 @@
'demo': [
],
'assets': {
'web.assets_qweb': [
],
'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',
'sf_warehouse/static/src/css/kanban_location_custom.scss',
'sf_warehouse/static/src/js/shelf_location_search.js',
]
},
'license': 'LGPL-3',
'installable': True,

View File

@@ -0,0 +1,15 @@
from odoo import api, SUPERUSER_ID
def migrate(cr, version):
env = api.Environment(cr, SUPERUSER_ID, {})
sf_shelf_model = env["sf.shelf"]
sf_shelf_location_model = env["sf.shelf.location"]
shelves = sf_shelf_model.search([])
for shelf in shelves:
shelf_barcode = shelf.barcode or ""
if not shelf_barcode:
continue
locations = sf_shelf_location_model.search([("shelf_id", "=", shelf.id)], order="id asc")
for index, location in enumerate(locations, start=1):
new_barcode = f"{shelf_barcode}-{index:03d}"
location.barcode = new_barcode

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,198 @@
// 定义看板公共样式的Mixin
@mixin kanban-common-styles($record-count-each-row, $record-gap: 16px) {
$record-gap-total-width: $record-gap * ($record-count-each-row - 1);
display: flex !important;
flex-wrap: wrap !important;
overflow-x: hidden !important;
overflow-y: auto !important;
padding: 0 !important;
gap: $record-gap !important;
width: 100% !important;
height: 100% !important;
// === 卡片基础样式(完全保留)===
.o_kanban_record {
flex: 0 0 calc((100% - #{$record-gap-total-width}) / #{$record-count-each-row}) !important;
height: calc((100% - #{$record-gap * 6}) / 6) !important;
margin: 0 !important;
padding: 0 !important;
background-color: white !important;
border: 1px solid #dee2e6 !important;
border-radius: 4px !important;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
min-width: calc((100% - #{$record-gap-total-width}) / #{$record-count-each-row}) !important;
max-width: calc((100% - #{$record-gap-total-width}) / #{$record-count-each-row}) !important;
position: relative;
transition: all 0.25s ease !important;
overflow: visible !important; // 允许悬停条溢出卡片边界
// === 状态标签(保留原设计)===
.status-label {
position: absolute;
top: 8px;
right: 8px;
padding: 3px 8px;
background: rgba(255, 255, 255, 0.9);
border: 1px solid #e0e0e0;
border-radius: 3px;
font-size: 11px;
color: #424242;
z-index: 2;
}
// === 优化:悬停信息条(核心改动)===
.status-hover-bar {
position: absolute;
bottom: calc(100% + 8px); // 默认显示在卡片上方
left: 0;
z-index: 1000;
min-width: max-content; // 宽度自适应内容
max-width: 300px; // 防止过宽
padding: 10px 12px;
background: rgba(255, 255, 255, 0.95);
border: 1px solid #e0e0e0;
border-radius: 4px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
font-size: 12px;
color: #424242;
white-space: nowrap; // 强制单行显示
opacity: 0;
pointer-events: none; // 避免阻挡卡片交互
transition: opacity 0.2s ease, transform 0.2s ease;
transform: translateY(10px);
// 三角形指示器
&::after {
content: '';
position: absolute;
top: 100%;
left: 15px;
border: 6px solid transparent;
border-top-color: rgba(0, 0, 0, 0.85);
}
div {
margin-bottom: 4px;
line-height: 1.4;
}
}
// === 悬停触发逻辑 ===
&:hover {
transform: translateY(-4px) !important;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
z-index: 10;
.status-hover-bar {
background: rgba(50, 50, 50, 0.9);
color: #fff !important;
font-size: 12px;
opacity: 0.9;
transform: translateY(0);
pointer-events: auto; // 悬停时允许交互
}
}
// === 边界保护(智能定位)===
// 左侧卡片:左对齐
&:nth-child(#{$record-count-each-row}n+1) .status-hover-bar {
left: 0;
right: auto;
&::after { left: 15px; }
}
// 右侧卡片:右对齐
&:nth-child(#{$record-count-each-row}n) .status-hover-bar {
left: auto;
right: 0;
&::after {
left: auto;
right: 15px;
}
}
&:nth-child(#{$record-count-each-row}n + #{$record-count-each-row - 1}) .status-hover-bar {
left: auto;
right: 0;
&::after {
left: auto;
right: 15px;
}
}
// 顶部卡片:悬停条显示在下方
&:nth-child(-n+#{$record-count-each-row}) .status-hover-bar {
bottom: auto;
top: calc(100% + 8px);
&::after {
top: auto;
bottom: 100%;
border-top-color: transparent;
border-bottom-color: rgba(255, 255, 255, 0.95);
}
}
// === 禁用状态样式(保留原效果)===
&.kanban_color_3 {
opacity: 0.6;
&:hover {
opacity: 0.85;
.status-hover-bar {
background:rgba(0, 0, 0, 0.85);
color: white !important;
border: 1px solid rgba(255, 255, 255, 0.15) !important;
}
}
}
}
}
// === 看板视图样式(完全保留)===
.o_kanban_view {
// 卡片内部结构(不修改)
.o_kanban_record {
.o_kanban_record_bottom {
margin: 0;
}
.oe_kanban_card.kanban_color_3,
.oe_kanban_card.kanban_color_1,
.oe_kanban_card.kanban_color_2 {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
.sf_kanban_custom_location_info_style {
display: flex !important;
justify-content: center !important;
align-items: center !important;
width: 100%;
font-size: 15px;
color: #000000;
padding:0px;
}
.sf_kanban_no {
display: flex !important;
justify-content: center !important;
align-items: center !important;
font-size: 18px;
color: #000000;
}
}
}
// 不同列数的看板样式
.sf_kanban_location_style12 {
@include kanban-common-styles(12);
}
.sf_kanban_location_style19 {
@include kanban-common-styles(19);
}
.sf_kanban_location_style4 {
@include kanban-common-styles(4);
}
.sf_kanban_location_style3 {
@include kanban-common-styles(3);
}
}

View File

@@ -1,21 +1,177 @@
/** @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);
/** @odoo-module */
import { KanbanController } from "@web/views/kanban/kanban_controller";
import { KanbanRenderer } from "@web/views/kanban/kanban_renderer";
import { kanbanView } from "@web/views/kanban/kanban_view";
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
import { useState, onWillStart, onWillUnmount, onMounted } from "@odoo/owl";
// 自定义看板渲染器
class CustomKanbanRenderer extends KanbanRenderer {
}
// 自定义看板控制器
class CustomKanbanController extends KanbanController {
setup() {
super.setup();
this.orm = useService("orm");
this.searchModel = this.model.env.searchModel;
this.defaultPagerLimit = this.getSystemDefaultLimit();
this._onUpdate = (payload) => {
this._handleSearchUpdate(payload);
};
this.env.services.user.updateContext({
isBaseStyle: true
});
let self = this;
// 获取货架分层数据
onWillStart(async () => {
this.searchModel.on('update', self, self._onUpdate);
await this.loadShelfLayersData();
});
// 组件销毁时移除监听
onWillUnmount(() => {
this.searchModel.off('update', self, self._onUpdate);
});
// 监听视图切换事件以监控面包屑
onMounted(() => {
this.handleRouteChange()
});
}
handleRouteChange() {
this.render(true);
let domain = this.searchModel.domain;
if (domain.length > 0) {
let shelfDomain = domain.find(item => item[0] === 'shelf_id');
this.onShelfChange(shelfDomain[2]);
} else {
this.setKanbanStyle('sf_kanban_location_style');
}
}
_handleSearchUpdate() {
try {
let domain = this.searchModel.domain;
if (domain.length > 0) {
let shelfDomain = domain.find(item => item[0] === 'shelf_id');
if (shelfDomain) {
let shelfId = shelfDomain[2];
// 如果货架ID存在则设置相应的样式
if (shelfId) {
this.onShelfChange(shelfId);
return;
}
}
}
//设置默认样式
this.updatePagerLimit(this.defaultPagerLimit);
this.setKanbanStyle('sf_kanban_location_style');
} catch (error) {
}
}
// 加载所有货架的层数数据
async loadShelfLayersData() {
this.shelfLayersMap = {};
const shelfIds = await this.orm.search('sf.shelf', []);
const shelves = await this.orm.read('sf.shelf', shelfIds, ['id', 'layer_capacity']);
shelves.forEach(shelf => {
this.shelfLayersMap[shelf.id] = shelf.layer_capacity;
});
}
setKanbanStyle(style) {
this.env.services.user.updateContext({
isBaseStyle: style === 'sf_kanban_location_style'
});
const kanbanViewEl = document.querySelector('.o_kanban_renderer');
if (kanbanViewEl) {
let isHave = false;
// 移除所有现有的 sf_kanban_* 类
Array.from(kanbanViewEl.classList).forEach(cls => {
if (cls.startsWith('sf_kanban_location_style')) {
kanbanViewEl.classList.remove(cls);
isHave = true;
}
});
// 添加新类
if (isHave) kanbanViewEl.classList.add(style);
}
const ghostCards = document.querySelectorAll('.o_kanban_ghost');
ghostCards.forEach(card => {
card.remove();
});
}
updatePagerLimit(limit) {
if (this.model.root.limit !== limit) {
this.model.root.limit = limit;
this.render(true);
}
}
// 处理货架变更事件
async onShelfChange(shelfId) {
let style = 'sf_kanban_location_style';
let isBaseStyle = true;
if (shelfId) {
// 如果没有缓存,从服务器加载数据
if (!(shelfId in this.shelfLayersMap)) {
const [shelf] = await this.orm.read('sf.shelf', [shelfId], ['layer_capacity']);
this.shelfLayersMap[shelfId] = shelf.layer_capacity;
}
// 获取该货架的层数
const layerCapacity = this.shelfLayersMap[shelfId];
// 根据层数设置不同的样式
if (layerCapacity >= 1) {
style = `sf_kanban_location_style${layerCapacity}`;
isBaseStyle = false;
}
}
if (isBaseStyle) {
this.updatePagerLimit(this.defaultPagerLimit);
}
else {
this.updatePagerLimit(500);
}
this.setKanbanStyle(style);
}
/**
* 获取系统默认分页记录数
*/
getSystemDefaultLimit() {
// 方法1从用户服务获取默认值
const userService = this.env.services.user;
// 获取用户配置的默认分页大小
if (userService && userService.user_context && userService.user_context.limit) {
return userService.user_context.limit;
}
// 方法3使用Odoo核心默认值通常为80
return 80;
}
}
// 设置自定义模板
CustomKanbanController.template = "sf_warehouse.CustomKanbanView";
export const customKanbanView = {
...kanbanView,
Controller: CustomKanbanController,
Renderer: CustomKanbanRenderer,
};
registry.category("views").add("custom_kanban", customKanbanView);

View File

@@ -1,330 +1,344 @@
<?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="o_kanban_mobile" js_class="custom_kanban" create="0">
<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="货位">
<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>
<?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>