Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/新增采购权限组
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
'jikimo_frontend/static/src/js/custom_form_status_indicator.js',
|
||||
'jikimo_frontend/static/src/scss/rowno_in_tree.scss',
|
||||
# 'jikimo_frontend/static/src/views/list_nums/list_render.xml',
|
||||
'jikimo_frontend/static/src/list/list_up_down_button.xml',
|
||||
# 'jikimo_frontend/static/src/list/list_up_down_button.xml',
|
||||
# 'jikimo_frontend/static/src/list/custom_import.js',
|
||||
# 'jikimo_frontend/static/src/list/custom_width.js',
|
||||
'jikimo_frontend/static/src/views/list_nums/extent_purchase.xml',
|
||||
|
||||
@@ -543,7 +543,7 @@ class WorkCenterBarcode(models.Model):
|
||||
|
||||
# 如果没有附件,直接返回
|
||||
if not self.cnc_ids:
|
||||
return
|
||||
return None
|
||||
|
||||
# 处理第一个附件的文件名
|
||||
first_attachment = self.cnc_ids[0].cnc_id
|
||||
|
||||
@@ -873,3 +873,13 @@ class SfMaintenanceEquipmentTool(models.Model):
|
||||
for record in self:
|
||||
if record.code:
|
||||
record.name = record.code
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
tools = super().create(vals_list)
|
||||
for tool in tools:
|
||||
self.env['sf.machine.table.tool.changing.apply'].sudo().create({
|
||||
'maintenance_equipment_id': tool.equipment_id.id,
|
||||
'cutter_spacing_code_id': tool.id
|
||||
})
|
||||
return tools
|
||||
|
||||
@@ -23,6 +23,21 @@ class ProcedureEquipmentResourceSetting(models.Model):
|
||||
create_time = fields.Datetime(string='新增时间', default=lambda self: fields.Datetime.now(), readonly=True)
|
||||
participate_in_scheduling = fields.Boolean(string='参与排程', default=True)
|
||||
|
||||
# check_status = fields.Selection([('unchecked', '未审核'), ('checked', '已审核')], '审核状态', default='unchecked')
|
||||
check_status = fields.Boolean(string='启用状态', default=False, readonly=True)
|
||||
|
||||
def action_check(self):
|
||||
"""
|
||||
审核启用
|
||||
"""
|
||||
self.check_status = True
|
||||
|
||||
def action_uncheck(self):
|
||||
"""
|
||||
审核禁用
|
||||
"""
|
||||
self.check_status = False
|
||||
|
||||
@api.depends('work_center_name_id')
|
||||
def _compute_equipment_name_id(self):
|
||||
for record in self:
|
||||
|
||||
@@ -38,6 +38,19 @@ class WorkLogSetting(models.Model):
|
||||
update_time = fields.Datetime(string='更新时间', default=lambda self: fields.Datetime.now())
|
||||
|
||||
setting_to_calendar_ids = fields.One2many('sf.work.schedule.calendar', 'name_id', '工作日历')
|
||||
check_status = fields.Boolean(string='启用状态', default=False, readonly=True)
|
||||
|
||||
def action_check(self):
|
||||
"""
|
||||
审核启用
|
||||
"""
|
||||
self.check_status = True
|
||||
|
||||
def action_uncheck(self):
|
||||
"""
|
||||
审核禁用
|
||||
"""
|
||||
self.check_status = False
|
||||
|
||||
@api.depends('working_shift_ids')
|
||||
def _compute_working_shift_ids(self):
|
||||
@@ -157,13 +170,13 @@ class WorkLogSetting(models.Model):
|
||||
:return:
|
||||
"""
|
||||
weekdays = {
|
||||
'星期一': 'Monday', 'Monday': 'Monday',
|
||||
'星期二': 'Tuesday', 'Tuesday': 'Tuesday',
|
||||
'星期一': 'Monday', 'Monday': 'Monday',
|
||||
'星期二': 'Tuesday', 'Tuesday': 'Tuesday',
|
||||
'星期三': 'Wednesday', 'Wednesday': 'Wednesday',
|
||||
'星期四': 'Thursday', 'Thursday': 'Thursday',
|
||||
'星期五': 'Friday', 'Friday': 'Friday',
|
||||
'星期六': 'Saturday', 'Saturday': 'Saturday',
|
||||
'星期日': 'Sunday', 'Sunday': 'Sunday',
|
||||
'星期四': 'Thursday', 'Thursday': 'Thursday',
|
||||
'星期五': 'Friday', 'Friday': 'Friday',
|
||||
'星期六': 'Saturday', 'Saturday': 'Saturday',
|
||||
'星期日': 'Sunday', 'Sunday': 'Sunday',
|
||||
}
|
||||
english_weekdays = []
|
||||
for chinese_weekday in chinese_weekdays:
|
||||
@@ -179,13 +192,13 @@ class WorkLogSetting(models.Model):
|
||||
:return:
|
||||
"""
|
||||
weekdays = {
|
||||
'星期一': 'Monday', 'Monday': 'Monday',
|
||||
'星期二': 'Tuesday', 'Tuesday': 'Tuesday',
|
||||
'星期一': 'Monday', 'Monday': 'Monday',
|
||||
'星期二': 'Tuesday', 'Tuesday': 'Tuesday',
|
||||
'星期三': 'Wednesday', 'Wednesday': 'Wednesday',
|
||||
'星期四': 'Thursday', 'Thursday': 'Thursday',
|
||||
'星期五': 'Friday', 'Friday': 'Friday',
|
||||
'星期六': 'Saturday', 'Saturday': 'Saturday',
|
||||
'星期日': 'Sunday', 'Sunday': 'Sunday',
|
||||
'星期四': 'Thursday', 'Thursday': 'Thursday',
|
||||
'星期五': 'Friday', 'Friday': 'Friday',
|
||||
'星期六': 'Saturday', 'Saturday': 'Saturday',
|
||||
'星期日': 'Sunday', 'Sunday': 'Sunday',
|
||||
}
|
||||
weekday = weekdays.get(chinese_weekday)
|
||||
if weekday:
|
||||
@@ -233,6 +246,19 @@ class WorkingShift(models.Model):
|
||||
start_time = fields.Datetime('班次开始时间')
|
||||
end_time = fields.Datetime('班次结束时间')
|
||||
remark = fields.Char('备注')
|
||||
check_status = fields.Boolean(string='启用状态', default=False, readonly=True)
|
||||
|
||||
def action_check(self):
|
||||
"""
|
||||
审核启用
|
||||
"""
|
||||
self.check_status = True
|
||||
|
||||
def action_uncheck(self):
|
||||
"""
|
||||
审核禁用
|
||||
"""
|
||||
self.check_status = False
|
||||
|
||||
|
||||
class DayOff(models.Model):
|
||||
@@ -247,6 +273,19 @@ class DayOff(models.Model):
|
||||
('Friday ', '星期五'),
|
||||
('Saturday ', '星期六'),
|
||||
('Sunday ', '星期日')], '休息日名称')
|
||||
check_status = fields.Boolean(string='启用状态', default=False, readonly=True)
|
||||
|
||||
def action_check(self):
|
||||
"""
|
||||
审核启用
|
||||
"""
|
||||
self.check_status = True
|
||||
|
||||
def action_uncheck(self):
|
||||
"""
|
||||
审核禁用
|
||||
"""
|
||||
self.check_status = False
|
||||
|
||||
|
||||
class WorkScheduleCalendar(models.Model):
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
<field name="status"/>
|
||||
<field name="update_person"/>
|
||||
<field name="update_time"/>
|
||||
|
||||
<field name="check_status" widget="boolean_toggle"/>
|
||||
<button name="action_check" string="启用" type="object" class="oe_highlight" attrs="{'invisible': [('check_status', '=', True)]}" groups="sf_base.group_plan_director"/>
|
||||
<button name="action_uncheck" string="禁用" type="object" class="oe_highlight" attrs="{'invisible': [('check_status', '=', False)]}" groups="sf_base.group_plan_director"/>
|
||||
<button string="查看日历"
|
||||
type="object"
|
||||
name="open_work_schedule_calendar"
|
||||
@@ -46,6 +50,8 @@
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
|
||||
<field name="check_status" widget="boolean_toggle"/>
|
||||
<field name="code"/>
|
||||
<field name="day_off_ids" widget="many2many_tags" placeholder="请选择"
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
@@ -82,6 +88,9 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree string="休息日" editable="bottom" delete="0">
|
||||
<field name="name"/>
|
||||
<field name="check_status" widget="boolean_toggle"/>
|
||||
<button name="action_check" string="启用" type="object" class="oe_highlight" attrs="{'invisible': [('check_status', '=', True)]}" groups="sf_base.group_plan_director"/>
|
||||
<button name="action_uncheck" string="禁用" type="object" class="oe_highlight" attrs="{'invisible': [('check_status', '=', False)]}" groups="sf_base.group_plan_director"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -104,6 +113,9 @@
|
||||
<field name="start_time" placeholder="请选择"/>
|
||||
<field name="end_time" placeholder="请选择"/>
|
||||
<field name="remark"/>
|
||||
<field name="check_status" widget="boolean_toggle"/>
|
||||
<button name="action_check" string="启用" type="object" class="oe_highlight" attrs="{'invisible': [('check_status', '=', True)]}" groups="sf_base.group_plan_director"/>
|
||||
<button name="action_uncheck" string="禁用" type="object" class="oe_highlight" attrs="{'invisible': [('check_status', '=', False)]}" groups="sf_base.group_plan_director"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -221,6 +233,10 @@
|
||||
<field name="status"/>
|
||||
<field name="participate_in_scheduling"/>
|
||||
<field name="name" invisible="True"/>
|
||||
|
||||
<field name="check_status" widget="boolean_toggle"/>
|
||||
<button name="action_check" string="启用" type="object" class="oe_highlight" attrs="{'invisible': [('check_status', '=', True)]}" groups="sf_base.group_plan_director"/>
|
||||
<button name="action_uncheck" string="禁用" type="object" class="oe_highlight" attrs="{'invisible': [('check_status', '=', False)]}" groups="sf_base.group_plan_director"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -230,6 +246,10 @@
|
||||
<field name="model">sf.procedure.equipment.resource.setting</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="产线设备资源设置">
|
||||
<header>
|
||||
<button name="action_check" string="启用" type="object" class="oe_highlight" attrs="{'invisible': [('check_status', '=', True)]}" groups="sf_base.group_plan_director"/>
|
||||
<button name="action_uncheck" string="禁用" type="object" class="oe_highlight" attrs="{'invisible': [('check_status', '=', False)]}" groups="sf_base.group_plan_director"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<div>
|
||||
<h1>
|
||||
@@ -238,6 +258,8 @@
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
|
||||
<field name="check_status" widget="boolean_toggle"/>
|
||||
<field name="work_center_name_id" placeholder="请选择"/>
|
||||
<field name="production_capacity"/>
|
||||
<field name="working_calendar_id" placeholder="请选择"/>
|
||||
|
||||
@@ -42,10 +42,12 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
# 计算库存位置数量
|
||||
# """
|
||||
# for obj in self:
|
||||
# if obj.current_location_id.name in ('组装后', '刀具房'):
|
||||
# obj.tool_room_num = 1
|
||||
# obj.line_edge_knife_library_num = 0
|
||||
# obj.machine_knife_library_num = 0
|
||||
# if obj.current_location_id:
|
||||
# if obj.current_location_id.name in ('组装后', '刀具房'):
|
||||
# obj.tool_room_num = 1
|
||||
# obj.line_edge_knife_library_num = 0
|
||||
# obj.machine_knife_library_num = 0
|
||||
#
|
||||
|
||||
@api.model
|
||||
def _read_group_mrs_cutting_tool_type_id(self, categories, domain, order):
|
||||
@@ -81,7 +83,8 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
suitable_machining_method_ids = fields.Many2many(
|
||||
'maintenance.equipment.image', 'rel_machining_product_template_tool_entity', '适合加工方式',
|
||||
domain=[('type', '=', '加工能力')], related='cutting_tool_integral_model_id.suitable_machining_method_ids')
|
||||
blade_tip_characteristics_id = fields.Many2one('maintenance.equipment.image', '刀尖特征',
|
||||
blade_tip_characteristics_id = fields.Many2one(
|
||||
'maintenance.equipment.image', '刀尖特征',
|
||||
domain=[('type', '=', '刀尖特征')], related='cutting_tool_integral_model_id.blade_tip_characteristics_id')
|
||||
handle_type_id = fields.Many2one(
|
||||
'maintenance.equipment.image', '柄部类型',
|
||||
@@ -202,13 +205,13 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
||||
'maintenance.equipment.image', 'rel_machining_product_template_distribution', '适合加工方式',
|
||||
domain=[('type', '=', '加工能力')],
|
||||
related='sf_functional_cutting_tool_entity_ids.suitable_machining_method_ids')
|
||||
blade_tip_characteristics_id = fields.Many2many(
|
||||
'maintenance.equipment.image', 'rel_blade_tip_product_template_distribution', '刀尖特征',
|
||||
blade_tip_characteristics_id = fields.Many2one(
|
||||
'maintenance.equipment.image', '刀尖特征',
|
||||
domain=[('type', '=', '刀尖特征')],
|
||||
related='sf_functional_cutting_tool_entity_ids.blade_tip_characteristics_id')
|
||||
handle_type_ids = fields.Many2many(
|
||||
'maintenance.equipment.image', 'rel_handle_product_template_distribution', '柄部类型',
|
||||
domain=[('type', '=', '柄部类型')], related='sf_functional_cutting_tool_entity_ids.handle_type_ids')
|
||||
handle_type_id = fields.Many2one(
|
||||
'maintenance.equipment.image', '柄部类型',
|
||||
domain=[('type', '=', '柄部类型')], related='sf_functional_cutting_tool_entity_ids.handle_type_id')
|
||||
cutting_direction_ids = fields.Many2many(
|
||||
'maintenance.equipment.image', 'rel_cutting_product_template_distribution', '走刀方向',
|
||||
domain=[('type', '=', '走刀方向')], related='sf_functional_cutting_tool_entity_ids.cutting_direction_ids')
|
||||
@@ -229,7 +232,13 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
||||
def _compute_tool_stock_total(self):
|
||||
for record in self:
|
||||
if record:
|
||||
self.tool_stock_total = record.tool_stock_num + record.side_shelf_num + record.on_tool_stock_num
|
||||
record.tool_stock_total = record.tool_stock_num + record.side_shelf_num + record.on_tool_stock_num
|
||||
|
||||
# @api.depends('tool_stock_total', 'min_stock_num', 'max_stock_num')
|
||||
# def _compute_batch_replenishment_num(self):
|
||||
# for record in self:
|
||||
# if record.tool_stock_total < record.min_stock_num:
|
||||
# record.batch_replenishment_num = record.max_stock_num - record.tool_stock_total
|
||||
|
||||
def create_or_edit_safety_stock(self, vals, sf_functional_cutting_tool_entity_ids):
|
||||
"""
|
||||
@@ -257,14 +266,14 @@ class MachineTableToolChangingApply(models.Model):
|
||||
|
||||
name = fields.Char('名称', related='maintenance_equipment_id.name', store=True)
|
||||
# 设备信息
|
||||
maintenance_equipment_id = fields.Many2one('maintenance.equipment', string='CNC机床', required=True, readonly=False,
|
||||
maintenance_equipment_id = fields.Many2one('maintenance.equipment', string='CNC机床', readonly=True,
|
||||
domain=[('category_id.equipment_type', '=', '机床')])
|
||||
production_line_id = fields.Many2one('sf.production.line', string='生产线', readonly=True,
|
||||
group_expand='_read_group_names')
|
||||
machine_table_type_id = fields.Many2one('maintenance.equipment.category', string='机床类型', readonly=True,
|
||||
compute='_compute_machine_table_type_id')
|
||||
machine_tool_code = fields.Char(string='机台号', store=True, invisible=True, readonly=True)
|
||||
cutter_spacing_code_id = fields.Many2one('maintenance.equipment.tool', string='刀位号', readonly=False,
|
||||
cutter_spacing_code_id = fields.Many2one('maintenance.equipment.tool', string='刀位号', readonly=True,
|
||||
required=True, domain="[('equipment_id', '=', maintenance_equipment_id)]")
|
||||
# 功能刀具信息
|
||||
functional_tool_name = fields.Char(string='刀具名称', related='functional_tool_name_id.name', store=True)
|
||||
@@ -278,7 +287,7 @@ class MachineTableToolChangingApply(models.Model):
|
||||
tool_position_interface_type = fields.Selection(
|
||||
[('BT刀柄式', 'BT刀柄式'), ('SK刀柄式', 'SK刀柄式'), ('HSK刀柄式', 'HSK刀柄式'),
|
||||
('CAT刀柄式', 'CAT刀柄式'), ('ISO刀盘式', 'ISO刀盘式'), ('DIN刀盘式', 'DIN刀盘式'),
|
||||
('直装固定式', '直装固定式')], string='刀位接口型号', required=True)
|
||||
('直装固定式', '直装固定式')], string='刀位接口型号')
|
||||
diameter = fields.Integer(string='刀具直径(mm)', )
|
||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)')
|
||||
max_lifetime_value = fields.Integer(string='最大寿命值(min)')
|
||||
@@ -304,7 +313,7 @@ class MachineTableToolChangingApply(models.Model):
|
||||
@api.depends('alarm_value', 'used_value')
|
||||
def _compute_functional_tool_status(self):
|
||||
for record in self:
|
||||
if record.alarm_value <= record.used_value:
|
||||
if record.alarm_value < record.used_value:
|
||||
record.functional_tool_status = '报警'
|
||||
else:
|
||||
record.functional_tool_status = '正常'
|
||||
@@ -362,7 +371,7 @@ class MachineTableToolChangingApply(models.Model):
|
||||
'use_tool_time': fields.Datetime.now() + timedelta(hours=4),
|
||||
'production_line_name_id': self.production_line_id.id,
|
||||
'machine_tool_name_id': self.maintenance_equipment_id.id,
|
||||
'applicant': self.applicant,
|
||||
'applicant': '系统自动',
|
||||
'apply_time': fields.Datetime.now(),
|
||||
'cutter_spacing_code_id': self.cutter_spacing_code_id.id,
|
||||
'whether_standard_knife': self.whether_standard_knife,
|
||||
@@ -684,6 +693,20 @@ class FunctionalToolAssembly(models.Model):
|
||||
code = False
|
||||
return code
|
||||
|
||||
def get_functional_tool(self, val):
|
||||
functional_tools = self.env['sf.functional.tool.assembly'].search(
|
||||
[('after_assembly_functional_tool_name', '=', val.get('after_assembly_functional_tool_name')),
|
||||
('after_assembly_functional_tool_diameter', '=', val.get('after_assembly_functional_tool_diameter')),
|
||||
('after_assembly_knife_tip_r_angle', '=', val.get('after_assembly_knife_tip_r_angle')),
|
||||
('after_assembly_coarse_middle_thin', '=', val.get('after_assembly_coarse_middle_thin'))])
|
||||
for functional_tool in functional_tools:
|
||||
if functional_tool.barcode_id.quant_ids[-1].location_id.name == '刀具线边库':
|
||||
return functional_tool
|
||||
for functional_tool in functional_tools:
|
||||
if functional_tool.barcode_id.quant_ids[-1].location_id.name == '刀具房':
|
||||
return functional_tool
|
||||
return False
|
||||
|
||||
def automated_assembly(self):
|
||||
"""
|
||||
todo 自动组装
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import fields, models, api, SUPERUSER_ID
|
||||
|
||||
|
||||
# from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
@@ -100,8 +102,8 @@ class SfToolMaterialSearch(models.Model):
|
||||
'rel_machining_product_template_material_search', '适合加工方式',
|
||||
domain=[('type', '=', '加工能力')])
|
||||
blade_tip_characteristics_id = fields.Many2one('maintenance.equipment.image', '刀尖特征',
|
||||
domain=[('type', '=', '刀尖特征')])
|
||||
handle_type_id = fields.Many2many('maintenance.equipment.image', '柄部类型',domain=[('type', '=', '柄部类型')])
|
||||
domain=[('type', '=', '刀尖特征')])
|
||||
handle_type_id = fields.Many2one('maintenance.equipment.image', '柄部类型', domain=[('type', '=', '柄部类型')])
|
||||
cutting_direction_ids = fields.Many2many('maintenance.equipment.image',
|
||||
'rel_cutting_product_template_material_search', '走刀方向',
|
||||
domain=[('type', '=', '走刀方向')])
|
||||
|
||||
@@ -301,7 +301,7 @@
|
||||
<field name="name">功能刀具安全库存</field>
|
||||
<field name="model">sf.real.time.distribution.of.functional.tools</field>
|
||||
<field name="arch" type="xml">
|
||||
<form create="0" edit="0" delete="0">
|
||||
<form create="0" edit="1" delete="0">
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
@@ -310,40 +310,44 @@
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="sf_cutting_tool_type_id"/>
|
||||
<field name="diameter"/>
|
||||
<field name="knife_tip_r_angle"/>
|
||||
<field name="coarse_middle_thin"/>
|
||||
<field name="whether_standard_knife"/>
|
||||
<field name="sf_cutting_tool_type_id" readonly="1"/>
|
||||
<field name="diameter" readonly="1"/>
|
||||
<field name="knife_tip_r_angle" readonly="1"/>
|
||||
<field name="coarse_middle_thin" readonly="1"/>
|
||||
<field name="whether_standard_knife" readonly="1"/>
|
||||
<field name="min_stock_num"/>
|
||||
<field name="max_stock_num"/>
|
||||
<field name="batch_replenishment_num"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="image" widget='image'/>
|
||||
<field name="image" widget='image' readonly="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<group col="1">
|
||||
<group string="适合加工方式">
|
||||
<field name="suitable_machining_method_ids" string=""
|
||||
widget="custom_many2many_checkboxes"
|
||||
widget="custom_many2many_checkboxes" readonly="1"
|
||||
domain="[('id','in',suitable_machining_method_ids)]"/>
|
||||
</group>
|
||||
<group>
|
||||
<group string="刀尖特征">
|
||||
<field name="blade_tip_characteristics_id" string=""
|
||||
widget="custom_many2many_checkboxes"
|
||||
widget="many2one_radio" readonly="1"
|
||||
domain="[('id','in',blade_tip_characteristics_id)]"/>
|
||||
</group>
|
||||
<group string="柄部类型">
|
||||
<field name="handle_type_ids" string="" widget="custom_many2many_checkboxes"
|
||||
domain="[('id','in',handle_type_ids)]"/>
|
||||
<field name="handle_type_id" string=""
|
||||
widget="many2one_radio" readonly="1"
|
||||
domain="[('id','in',handle_type_id)]"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<group string="走刀方向">
|
||||
<field name="cutting_direction_ids" string="" widget="custom_many2many_checkboxes"
|
||||
<field name="cutting_direction_ids" string="" widget="custom_many2many_checkboxes" readonly="1"
|
||||
domain="[('id','in',cutting_direction_ids)]"/>
|
||||
</group>
|
||||
<group string="适合冷却液">
|
||||
<field name="suitable_coolant_ids" string="" widget="custom_many2many_checkboxes"
|
||||
<field name="suitable_coolant_ids" string="" widget="custom_many2many_checkboxes" readonly="1"
|
||||
domain="[('id','in',suitable_coolant_ids)]"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -351,7 +355,7 @@
|
||||
<notebook>
|
||||
<page string="刀具信息">
|
||||
<field name="sf_functional_cutting_tool_entity_ids" widget="many2many">
|
||||
<tree>
|
||||
<tree edit="0" create="0" delete="0">
|
||||
<field name="barcode_id"/>
|
||||
<field name="functional_tool_name_id"/>
|
||||
<field name="new_former"/>
|
||||
@@ -467,7 +471,7 @@
|
||||
<field name="name">机床换刀申请</field>
|
||||
<field name="model">sf.machine.table.tool.changing.apply</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<tree create="0" delete="0">
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="production_line_id" invisible="1"/>
|
||||
<field name="maintenance_equipment_id"/>
|
||||
@@ -633,15 +637,15 @@
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
<field name="maintenance_equipment_id" readonly="0" placeholder="请选择"/>
|
||||
<field name="maintenance_equipment_id" readonly="1" placeholder="请选择"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="production_line_id"/>
|
||||
<field name="machine_table_type_id"/>
|
||||
<field name="cutter_spacing_code_id"/>
|
||||
<field name="tool_position_interface_type" placeholder="请选择"/>
|
||||
<field name="cutter_spacing_code_id" options="{'no_create': True}"/>
|
||||
<field name="tool_position_interface_type" placeholder="请选择" required="1"/>
|
||||
<field name="sf_functional_tool_assembly_id" string="组装单"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -697,6 +701,7 @@
|
||||
<field name="applicant" optional="hide"/>
|
||||
<searchpanel>
|
||||
<field name="production_line_id" enable_counters="1" icon="fa-building"/>
|
||||
<field name="maintenance_equipment_id" enable_counters="1" icon="fa-building"/>
|
||||
<field name="functional_tool_status" enable_counters="1" icon="fa-building"/>
|
||||
</searchpanel>
|
||||
</search>
|
||||
|
||||
@@ -62,33 +62,47 @@ class ToolChangeRequirementInformation(models.TransientModel):
|
||||
('cutter_spacing_code_id', '=', self.cutter_spacing_code_id.id)
|
||||
])
|
||||
|
||||
# 功能刀具组装创建新任务(new_assembly_task)
|
||||
sf_functional_tool_assembly = self.env['sf.functional.tool.assembly'].sudo().create({
|
||||
'functional_tool_name': self.replacement_tool_name,
|
||||
'functional_tool_type_id': self.replacement_tool_type_id.id,
|
||||
'functional_tool_diameter': self.replacement_diameter,
|
||||
'knife_tip_r_angle': self.replacement_knife_tip_r_angle,
|
||||
'coarse_middle_thin': self.replacement_tool_coarse_middle_thin,
|
||||
'new_former': self.new_former,
|
||||
'tool_loading_length': self.replacement_tool_setting_length,
|
||||
'functional_tool_length': self.replacement_extension_length,
|
||||
'effective_length': self.replacement_effective_length,
|
||||
'loading_task_source': '1',
|
||||
'use_tool_time': self.used_tool_time,
|
||||
'production_line_name_id': self.production_line_id.id,
|
||||
'machine_tool_name_id': self.maintenance_equipment_id.id,
|
||||
'applicant': self.applicant,
|
||||
'apply_time': fields.Datetime.now(),
|
||||
'cutter_spacing_code_id': self.cutter_spacing_code_id.id,
|
||||
'whether_standard_knife': self.whether_standard_knife,
|
||||
'reason_for_applying': self.reason_for_applying,
|
||||
'sf_machine_table_tool_changing_apply_id': record.id
|
||||
})
|
||||
# 修改机床换刀申请状态
|
||||
record.write({
|
||||
'status': '1',
|
||||
'sf_functional_tool_assembly_id': sf_functional_tool_assembly.id
|
||||
# 搜索满足需求的功能刀具
|
||||
functional_tool = self.env['sf.functional.tool.assembly'].get_functional_tool({
|
||||
'after_assembly_functional_tool_name': self.replacement_tool_name,
|
||||
'after_assembly_functional_tool_diameter': self.replacement_diameter,
|
||||
'after_assembly_knife_tip_r_angle': self.replacement_knife_tip_r_angle,
|
||||
'after_assembly_coarse_middle_thin': self.replacement_tool_coarse_middle_thin
|
||||
})
|
||||
# 如果有满足需求的刀具,就返回刀具信息
|
||||
if functional_tool:
|
||||
record.write({'status': '3'})
|
||||
# todo 将功能刀具信息传递到机床
|
||||
return functional_tool
|
||||
# 如果没有满足需求的刀具,就创建功能刀具组装单
|
||||
else:
|
||||
# 功能刀具组装创建新任务(new_assembly_task)
|
||||
sf_functional_tool_assembly = self.env['sf.functional.tool.assembly'].sudo().create({
|
||||
'functional_tool_name': self.replacement_tool_name,
|
||||
'functional_tool_type_id': self.replacement_tool_type_id.id,
|
||||
'functional_tool_diameter': self.replacement_diameter,
|
||||
'knife_tip_r_angle': self.replacement_knife_tip_r_angle,
|
||||
'coarse_middle_thin': self.replacement_tool_coarse_middle_thin,
|
||||
'new_former': self.new_former,
|
||||
'tool_loading_length': self.replacement_tool_setting_length,
|
||||
'functional_tool_length': self.replacement_extension_length,
|
||||
'effective_length': self.replacement_effective_length,
|
||||
'loading_task_source': '1',
|
||||
'use_tool_time': self.used_tool_time,
|
||||
'production_line_name_id': self.production_line_id.id,
|
||||
'machine_tool_name_id': self.maintenance_equipment_id.id,
|
||||
'applicant': self.applicant,
|
||||
'apply_time': fields.Datetime.now(),
|
||||
'cutter_spacing_code_id': self.cutter_spacing_code_id.id,
|
||||
'whether_standard_knife': self.whether_standard_knife,
|
||||
'reason_for_applying': self.reason_for_applying,
|
||||
'sf_machine_table_tool_changing_apply_id': record.id
|
||||
})
|
||||
# 修改机床换刀申请状态
|
||||
record.write({
|
||||
'status': '1',
|
||||
'sf_functional_tool_assembly_id': sf_functional_tool_assembly.id
|
||||
})
|
||||
|
||||
# 关闭弹出窗口
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
@@ -323,14 +337,14 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
string='组装后功能刀具类型')
|
||||
after_assembly_functional_tool_diameter = fields.Integer(string='组装后功能刀具直径(mm)')
|
||||
after_assembly_knife_tip_r_angle = fields.Float(string='组装后刀尖R角(mm)')
|
||||
after_assembly_new_former = fields.Selection([('0', '新'), ('1', '旧')], string='组装后新/旧')
|
||||
after_assembly_new_former = fields.Selection([('0', '新'), ('1', '旧')], string='组装后新/旧', default='0')
|
||||
cut_time = fields.Integer(string='已切削时间(min)')
|
||||
cut_length = fields.Float(string='已切削长度(mm)')
|
||||
cut_number = fields.Integer(string='已切削次数')
|
||||
|
||||
after_assembly_whether_standard_knife = fields.Boolean(string='组装后是否标准刀', default=True)
|
||||
after_assembly_coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')],
|
||||
string='组装后粗/中/精')
|
||||
string='组装后粗/中/精', default='3')
|
||||
after_assembly_max_lifetime_value = fields.Integer(string='组装后最大寿命值(min)')
|
||||
after_assembly_alarm_value = fields.Integer(string='组装后报警值(min)')
|
||||
after_assembly_used_value = fields.Integer(string='组装后已使用值(min)')
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
'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
|
||||
|
||||
@@ -184,38 +185,35 @@ 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': '空闲'
|
||||
})
|
||||
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):
|
||||
"""
|
||||
生成货位条码
|
||||
"""
|
||||
# 这里是你生成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
|
||||
|
||||
# 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)
|
||||
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)
|
||||
@@ -226,9 +224,12 @@ class ShelfLocation(models.Model):
|
||||
('货位', '货位')
|
||||
], 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='产品类别')
|
||||
# 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([
|
||||
@@ -252,6 +253,16 @@ class ShelfLocation(models.Model):
|
||||
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):
|
||||
"""
|
||||
@@ -263,7 +274,7 @@ class ShelfLocation(models.Model):
|
||||
record.location_status = '占用'
|
||||
else:
|
||||
record.product_id = False
|
||||
# record.location_status = '空闲'
|
||||
record.location_status = '空闲'
|
||||
|
||||
@api.depends('location_type')
|
||||
def _compute_hide_what(self):
|
||||
@@ -281,7 +292,6 @@ class ShelfLocation(models.Model):
|
||||
else:
|
||||
pass
|
||||
|
||||
# 生成货位
|
||||
def create_location(self):
|
||||
"""
|
||||
当仓库类型为货架时,自动生成其下面的货位,数量为货架层数*层数容量
|
||||
@@ -289,13 +299,17 @@ class ShelfLocation(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):
|
||||
"""
|
||||
@@ -308,11 +322,121 @@ class ShelfLocation(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):
|
||||
|
||||
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>
|
||||
@@ -28,15 +28,18 @@
|
||||
<field name="name" string="名称"/>
|
||||
<field name="barcode" string="编码"/>
|
||||
<field name="location_type"/>
|
||||
<field name="location_id"/>
|
||||
<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)], 'required': [('hide_location', '!=', False), ('location_status', '=', '空闲')]}"/>
|
||||
<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)], '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>
|
||||
@@ -44,108 +47,49 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- 自己生成 -->
|
||||
<!-- <record id="view_shelf_location_search" model="ir.ui.view"> -->
|
||||
<!-- <field name="name">Shelf Location</field> -->
|
||||
<!-- <field name="model">sf.shelf.location</field> -->
|
||||
<!-- <field name="arch" type="xml"> -->
|
||||
<!-- <search string="Shelf Location"> -->
|
||||
<!-- <field name="name" string="名称"/> -->
|
||||
<!-- <field name="barcode" string="编码"/> -->
|
||||
<!-- <field name="location_type"/> -->
|
||||
<!-- <field name="channel"/> -->
|
||||
<!-- <field name="direction"/> -->
|
||||
<!-- <field name="shelf_height"/> -->
|
||||
<!-- <field name="shelf_layer"/> -->
|
||||
<!-- <field name="layer_capacity"/> -->
|
||||
<!-- </search> -->
|
||||
<!-- </field> -->
|
||||
<!-- </record> -->
|
||||
<!-- -->
|
||||
<!-- <record id="view_shelf_location_kanban" model="ir.ui.view"> -->
|
||||
<!-- <field name="name">Shelf Location</field> -->
|
||||
<!-- <field name="model">sf.shelf.location</field> -->
|
||||
<!-- <field name="arch" type="xml"> -->
|
||||
<!-- <kanban class="o_kanban_mobile" js_class="custom_kanban"> -->
|
||||
<!-- <field name="name"/> -->
|
||||
<!-- <field name="barcode"/> -->
|
||||
<!-- <field name="location_type"/> -->
|
||||
<!-- <field name="channel"/> -->
|
||||
<!-- <field name="direction"/> -->
|
||||
<!-- <field name="shelf_height"/> -->
|
||||
<!-- <field name="shelf_layer"/> -->
|
||||
<!-- <field name="layer_capacity"/> -->
|
||||
<!-- </kanban> -->
|
||||
<!-- </field> -->
|
||||
<!-- </record> -->
|
||||
<!-- -->
|
||||
<!-- <record id="action_shelf_location" model="ir.actions.act_window"> -->
|
||||
<!-- <field name="name">Shelf Location</field> -->
|
||||
<!-- <field name="res_model">sf.shelf.location</field> -->
|
||||
<!-- <field name="view_mode">tree,form,kanban</field> -->
|
||||
<!-- <field name="search_view_id" ref="view_shelf_location_search"/> -->
|
||||
<!-- </record> -->
|
||||
<!-- -->
|
||||
<!-- <menuitem id="menu_shelf_location" name="Shelf Location" parent="sf_stock.menu_stock" sequence="1"/> -->
|
||||
<!-- <menuitem id="menu_shelf_location_tree" name="Shelf Location" parent="menu_shelf_location" action="action_shelf_location" sequence="1"/> -->
|
||||
|
||||
|
||||
<!-- <record id="view_location_search_sf_inherit" model="ir.ui.view"> -->
|
||||
<!-- <field name="name">stock.location.search.sf.inherit</field> -->
|
||||
<!-- <field name="model">stock.location</field> -->
|
||||
<!-- <field name="inherit_id" ref="stock.view_location_search"/> -->
|
||||
<!-- <field name="arch" type="xml"> -->
|
||||
<!-- <xpath expr="//search[1]" position="inside"> -->
|
||||
<!-- <searchpanel class="account_root"> -->
|
||||
<!-- <field name="location_type" icon="fa-filter"/> -->
|
||||
<!-- <field name="location_id" select="multi" domain="[('location_type', '=', '货架')]"/> -->
|
||||
<!-- </searchpanel> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- </field> -->
|
||||
<!-- </record> -->
|
||||
<!-- <record id="example_kanban_view" model="ir.ui.view"> -->
|
||||
<!-- <field name="name">example.kanban</field> -->
|
||||
<!-- <field name="model">stock.location</field> -->
|
||||
<!-- <field name="arch" type="xml"> -->
|
||||
<!-- <kanban class="o_kanban_mobile" js_class="custom_kanban"> -->
|
||||
<!-- <templates> -->
|
||||
<!-- <t t-name="kanban-box"> -->
|
||||
<!-- <div t-attf-class="oe_kanban_card oe_kanban_global_click -->
|
||||
<!-- #{record.location_status.raw_value == '空闲' ? 'kanban_color_1' : ''} -->
|
||||
<!-- #{record.location_status.raw_value == '占用' ? 'kanban_color_2' : ''} -->
|
||||
<!-- #{record.location_status.raw_value == '禁用' ? 'kanban_color_3' : ''}"> -->
|
||||
<!-- --><!-- 标题 -->
|
||||
<!-- <div class="o_kanban_card_header"> -->
|
||||
<!-- <div class="o_kanban_card_header_title"> -->
|
||||
<!-- <field name="name"/> -->
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
<!-- --><!-- 内容 -->
|
||||
<!-- <div class="o_kanban_record_bottom"> -->
|
||||
<!-- <field name="location_status"/> -->
|
||||
<!-- </div> -->
|
||||
<!-- <div class="o_kanban_record_bottom"> -->
|
||||
<!-- <field name="product_sn_id"/> -->
|
||||
<!-- <span> | </span> -->
|
||||
<!-- <field name="product_id"/> -->
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
<!-- </t> -->
|
||||
<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> -->
|
||||
@@ -156,17 +100,50 @@
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
<!-- </t> -->
|
||||
<!-- </templates> -->
|
||||
<!-- </kanban> -->
|
||||
<!-- </field> -->
|
||||
<!-- </record> -->
|
||||
</templates>
|
||||
</kanban>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- <record id="kanban_action_id" model="ir.actions.act_window"> -->
|
||||
<!-- <field name="name">货位状态</field> -->
|
||||
<!-- <field name="type">ir.actions.act_window</field> -->
|
||||
<!-- <field name="res_model">stock.location</field> -->
|
||||
<!-- <field name="view_mode">kanban,form</field> -->
|
||||
<!-- </record> -->
|
||||
<!-- 搜索视图 -->
|
||||
<record id="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>
|
||||
|
||||
@@ -158,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