Merge branch 'develop' into feature/修改看板样式
# Conflicts: # sf_warehouse/__manifest__.py # sf_warehouse/static/src/kanban_color_change.scss # sf_warehouse/views/view.xml
This commit is contained in:
@@ -31,3 +31,6 @@ access_sf_functional_fixture,sf_functional_fixture,model_sf_functional_fixture,b
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -12,6 +12,7 @@
|
||||
'data': [
|
||||
'security/group_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'views/production_line_base.py',
|
||||
'views/maintenance_views.xml',
|
||||
'views/maintenance_logs_views.xml',
|
||||
'views/equipment_maintenance_standards_views.xml',
|
||||
|
||||
@@ -3,3 +3,4 @@ from . import sf_maintenance
|
||||
from . import sf_maintenance_logs
|
||||
from . import sf_equipment_maintenance_standards
|
||||
from . import sf_maintenance_requests
|
||||
from . import production_line_base
|
||||
|
||||
30
sf_maintenance/models/production_line_base.py
Normal file
30
sf_maintenance/models/production_line_base.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from odoo import models,fields
|
||||
|
||||
|
||||
class ProductionLine(models.Model):
|
||||
_name = 'sf.production.line'
|
||||
_description = '生产线'
|
||||
|
||||
def _get_code(self):
|
||||
"""
|
||||
自动生成编码
|
||||
:return:
|
||||
"""
|
||||
fixture_material = self.env['sf.production.line'].sudo().search(
|
||||
[('code', '!=', '')],
|
||||
limit=1,
|
||||
order="id desc")
|
||||
if not fixture_material:
|
||||
num = "%03d" % 1
|
||||
else:
|
||||
m = int(fixture_material.code) + 1
|
||||
num = "%03d" % m
|
||||
return num
|
||||
|
||||
name = fields.Char('生产线')
|
||||
code = fields.Char('编码', default=_get_code, readonly=True)
|
||||
remark = fields.Char('备注')
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,4 +4,6 @@ access_sf_maintenance_logs,sf_maintenance_logs,model_sf_maintenance_logs,base.gr
|
||||
access_maintenance_equipment,maintenance_equipment,model_maintenance_equipment,base.group_user,1,1,1,1
|
||||
access_maintenance_standards,maintenance_standards,model_maintenance_standards,base.group_user,1,1,1,1
|
||||
|
||||
access_sf_production_line,sf.production.line,model_sf_production_line,base.group_user,1,1,1,1
|
||||
|
||||
|
||||
|
||||
|
81
sf_maintenance/views/production_line_view.xml
Normal file
81
sf_maintenance/views/production_line_view.xml
Normal file
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="sf_production_line_tree" model="ir.ui.view">
|
||||
<field name="name">生产线</field>
|
||||
<field name="model">sf.production.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="生产线">
|
||||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="remark"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_production_line_form" model="ir.ui.view">
|
||||
<field name="name">生产线</field>
|
||||
<field name="model">sf.production.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="生产线">
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="remark"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="code"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_production_line_search" model="ir.ui.view">
|
||||
<field name="name">生产线</field>
|
||||
<field name="model">sf.production.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="name"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_production_line_kanban" model="ir.ui.view">
|
||||
<field name="name">生产线看板</field>
|
||||
<field name="model">sf.production.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<kanban>
|
||||
<field name="name"/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div class="oe_kanban_global_click">
|
||||
<!-- 在这里定义每个卡片的内容 -->
|
||||
<div>
|
||||
<strong><field name="code"/></strong>
|
||||
<br/>
|
||||
<span><field name="name"/></span>
|
||||
<br/>
|
||||
<span><field name="remark"/></span>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
|
||||
</kanban>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_production_line_act" model="ir.actions.act_window">
|
||||
<field name="name">生产线</field>
|
||||
<field name="res_model">sf.production.line</field>
|
||||
<field name="view_mode">kanban,tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_sf_production_line"
|
||||
parent="menu_sf_base"
|
||||
name="生产线"
|
||||
sequence="20"
|
||||
action="sf_production_line_act"/>
|
||||
</odoo>
|
||||
@@ -10,11 +10,12 @@
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': [],
|
||||
'depends': ['sf_maintenance'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
# 'security/ir.model.access.csv',
|
||||
'views/paln_base_view.xml',
|
||||
'views/menu_view.xml'
|
||||
'views/menu_view.xml',
|
||||
],
|
||||
'demo': [
|
||||
],
|
||||
|
||||
@@ -1,42 +1,55 @@
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class ProductionLine(models.Model):
|
||||
_name = 'sf.production.line'
|
||||
_description = '生产线'
|
||||
|
||||
name = fields.Char(string='生产线名称')
|
||||
|
||||
|
||||
class WorkingProcedure(models.Model):
|
||||
_name = 'sf.working.procedure'
|
||||
_description = '工序'
|
||||
|
||||
name = fields.Char(string='工序名称')
|
||||
content = fields.Char(string='主要加工内容')
|
||||
|
||||
WorkingProcedure_to_ProductionLine_id = fields.Many2one('sf.production.line')
|
||||
from odoo import models, fields, api
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class ProcedureEquipmentResourceSetting(models.Model):
|
||||
_name = 'sf.procedure.equipment.resource.setting'
|
||||
_description = '工序设备资源设置'
|
||||
_description = '产线设备资源设置'
|
||||
|
||||
equipment_to_working_procedure_id = fields.Many2one('sf.working.procedure', string='工序')
|
||||
name = fields.Char(string='设备名称')
|
||||
machine_tool_name = fields.Char(string='机台号')
|
||||
brand = fields.Char(string='品牌')
|
||||
model = fields.Char(string='型号')
|
||||
production_capacity = fields.Char(string='产能')
|
||||
working_calendar = fields.Many2one('sf.work.log.setting', string='工作日历')
|
||||
working_shift = fields.Char(string='班次')
|
||||
create_time = fields.Datetime(string='新增时间', default=lambda self: fields.Datetime.now())
|
||||
stale_dated_time = fields.Datetime(string='过期时间')
|
||||
status = fields.Selection([('0', '正常'), ('1', '故障停机'), ('2', '计划停机')], string='设备状态', default='0')
|
||||
production_line_id = fields.Many2one('sf.production.line', string='生产线', required=True)
|
||||
work_center_name_id = fields.Many2one('mrp.workcenter', string='工作中心名称')
|
||||
equipment_code = fields.Char(string='机台号(原设备编码)', readonly=True, compute='_onchange_equipment_name_id')
|
||||
equipment_name_id = fields.Many2one('maintenance.equipment',
|
||||
string='设备名称',
|
||||
readonly=True,
|
||||
compute='_onchange_work_center_name_id')
|
||||
brand = fields.Char(string='品牌', readonly=True, compute='_onchange_equipment_name_id')
|
||||
model = fields.Char(string='型号', readonly=True, compute='_onchange_equipment_name_id')
|
||||
# todo 传入工序数据
|
||||
working_procedure = fields.Char(string='工序', readonly=True)
|
||||
production_capacity = fields.Float(string='产能', required=True, digits=(4, 1))
|
||||
working_calendar_id = fields.Many2one('sf.work.log.setting', string='工作日历')
|
||||
working_shift = fields.Char(string='班次', readonly=True, compute='_onchange_working_calendar_id')
|
||||
create_time = fields.Datetime(string='新增时间', default=lambda self: fields.Datetime.now(), readonly=True)
|
||||
status = fields.Selection([('正常', '正常'), ('1', '故障停机'), ('2', '计划停机')],
|
||||
string='设备状态',
|
||||
readonly=True,
|
||||
compute='_onchange_equipment_name_id')
|
||||
participate_in_scheduling = fields.Boolean(string='参与排程', default=True)
|
||||
|
||||
|
||||
|
||||
@api.onchange('production_capacity')
|
||||
def _onchange_production_capacity(self):
|
||||
for record in self:
|
||||
if record.production_capacity < 0:
|
||||
raise UserError("输入的产能值不正确,请重新输入!")
|
||||
|
||||
@api.depends('work_center_name_id')
|
||||
def _onchange_work_center_name_id(self):
|
||||
for record in self:
|
||||
record.equipment_name_id = record.work_center_name_id.equipment_ids
|
||||
|
||||
@api.onchange('equipment_name_id')
|
||||
def _onchange_equipment_name_id(self):
|
||||
for record in self:
|
||||
record.equipment_code = record.equipment_name_id.code,
|
||||
record.brand = record.equipment_name_id.brand_id.name,
|
||||
record.model = record.equipment_name_id.type_id.name,
|
||||
record.status = record.equipment_name_id.state
|
||||
|
||||
@api.depends('working_calendar_id')
|
||||
def _onchange_working_calendar_id(self):
|
||||
for record in self:
|
||||
record.working_shift = record.working_calendar_id.working_shift
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,49 +2,123 @@ from odoo import models, fields, api
|
||||
import re
|
||||
|
||||
|
||||
def time_H_selection():
|
||||
return [('00', '00'), ('01', '01'), ('02', '02'), ('03', '03'), ('04', '04'), ('05', '05'),
|
||||
('06', '06'), ('07', '07'), ('08', '08'), ('09', '09'), ('10', '10'), ('11', '11'),
|
||||
('12', '12'), ('13', '13'), ('14', '14'), ('15', '15'), ('16', '16'), ('17', '17'),
|
||||
('18', '18'), ('19', '19'), ('20', '20'), ('21', '21'), ('22', '22'), ('23', '23')]
|
||||
|
||||
|
||||
def time_M_or_S_selection():
|
||||
return [('00', '00'), ('05', '05'), ('10', '10'), ('15', '15'), ('20', '20'), ('25', '25'),
|
||||
('30', '30'), ('35', '35'), ('40', '40'), ('45', '45'), ('50', '50'), ('55', '55')]
|
||||
|
||||
|
||||
class WorkLogSetting(models.Model):
|
||||
_name = 'sf.work.log.setting'
|
||||
_description = '工作日历设置'
|
||||
|
||||
name = fields.Char(string='工作日历名称')
|
||||
# start_time = fields.Char(string='日开始时间')
|
||||
start_time = fields.Datetime(string='日开始时间')
|
||||
end_time = fields.Char(string='日结束时间')
|
||||
duration = fields.Char(string='时长')
|
||||
day_off = fields.Char(string='休息日')
|
||||
def _get_code(self):
|
||||
"""
|
||||
自动生成编码
|
||||
:return:
|
||||
"""
|
||||
fixture_material = self.env['sf.work.log.setting'].sudo().search(
|
||||
[('code', '!=', '')],
|
||||
limit=1,
|
||||
order="id desc")
|
||||
if not fixture_material:
|
||||
num = "%03d" % 1
|
||||
else:
|
||||
m = int(fixture_material.code) + 1
|
||||
num = "%03d" % m
|
||||
return num
|
||||
|
||||
code = fields.Char(string='序号', default=_get_code, readonly=True)
|
||||
name = fields.Char(string='工作日历名称', required=True)
|
||||
|
||||
start_time = fields.Char(string='日开始时间', readonly=True, compute='_compute_start_time')
|
||||
start_time_H = fields.Selection(time_H_selection(), '时', required=True)
|
||||
start_time_M = fields.Selection(time_M_or_S_selection(), '分', required=True)
|
||||
end_time = fields.Char(string='日结束时间', readonly=True, compute='_compute_end_time')
|
||||
end_time_H = fields.Selection(time_H_selection(), '时', required=True)
|
||||
end_time_M = fields.Selection(time_M_or_S_selection(), '分', required=True)
|
||||
|
||||
duration = fields.Char(string='时长', readonly=True, compute='_compute_duration')
|
||||
day_off = fields.Char(string='休息日', required=True)
|
||||
|
||||
user_defined_working_shift_status = fields.Boolean(string='自定义班次', default=False)
|
||||
working_shift = fields.Char(string='班次')
|
||||
working_shift_char = fields.Char(string='班次')
|
||||
working_shift_select = fields.Selection([('0', '早班00:00-08:00'),
|
||||
('1', '白班08:00-16:00'),
|
||||
('2', '晚班16:00-24:00'),
|
||||
('3', '长白班08:00-20:00'),
|
||||
('4', '长晚班20:00-08:00')], string='班次')
|
||||
working_shift_char = fields.Char(string='班次', readonly=True, compute='_compute_working_shift_time')
|
||||
working_shift_select = fields.Selection([('早班00:00-08:00', '早班00:00-08:00'),
|
||||
('白班08:00-16:00', '白班08:00-16:00'),
|
||||
('晚班16:00-24:00', '晚班16:00-24:00'),
|
||||
('长白班08:00-20:00', '长白班08:00-20:00'),
|
||||
('长晚班20:00-08:00', '长晚班20:00-08:00')], string='班次')
|
||||
working_shift_start_time_H = fields.Selection(time_H_selection(), '班次开始时间:时',
|
||||
attr={'required': [('user_defined_working_shift_status', '=', 'True')]})
|
||||
working_shift_start_time_M = fields.Selection(time_M_or_S_selection(), '分',
|
||||
attr={'required': [('user_defined_working_shift_status', '=', 'True')]})
|
||||
working_shift_end_time_H = fields.Selection(time_H_selection(), '班次结束时间:时',
|
||||
attr={'required': [('user_defined_working_shift_status', '=', 'True')]})
|
||||
working_shift_end_time_M = fields.Selection(time_M_or_S_selection(), '分',
|
||||
attr={'required': [('user_defined_working_shift_status', '=', 'True')]})
|
||||
|
||||
status = fields.Boolean(string='状态', default=True)
|
||||
update_person = fields.Char(string='更新人', default=lambda self: self.env.user.name)
|
||||
update_time = fields.Datetime(string='更新时间', default=lambda self: fields.Datetime.now())
|
||||
|
||||
@api.depends('start_time_H', 'start_time_M')
|
||||
def _compute_start_time(self):
|
||||
"""
|
||||
设置输入日开始时间
|
||||
:return:
|
||||
"""
|
||||
for record in self:
|
||||
record.start_time = f"{record.start_time_H}:{record.start_time_M}:00"
|
||||
|
||||
@api.depends('end_time_H', 'end_time_M')
|
||||
def _compute_end_time(self):
|
||||
"""
|
||||
设置输入日结束时间
|
||||
:return:
|
||||
"""
|
||||
for record in self:
|
||||
record.end_time = f"{record.end_time_H}:{record.end_time_M}:00"
|
||||
|
||||
@api.onchange('working_shift_char', 'working_shift_select')
|
||||
def _onchange_working_shift(self):
|
||||
"""
|
||||
对班次是否手动输入是进行不同的展示
|
||||
:return:
|
||||
"""
|
||||
for record in self:
|
||||
if record.working_shift_select:
|
||||
record.working_shift = record.working_shift_select
|
||||
else:
|
||||
record.working_shift = record.working_shift_char
|
||||
|
||||
# @api.onchange('start_time')
|
||||
# def _onchange_start_time(self):
|
||||
# pattern = re.compile(r'^(([0-9]|1[0-9]|2[0-3]):[0-5][0-9])|24:00$')
|
||||
# if self.start_time and not pattern.match(self.start_time):
|
||||
# raise models.ValidationError('输入的日开始时间不正确,请重新输入!')
|
||||
@api.depends(
|
||||
'working_shift_start_time_H', 'working_shift_start_time_M',
|
||||
'working_shift_end_time_H', 'working_shift_end_time_M')
|
||||
def _compute_working_shift_time(self):
|
||||
start_time = f"{self.working_shift_start_time_H}:{self.working_shift_start_time_M}:00"
|
||||
end_time = f"{self.working_shift_end_time_H}:{self.working_shift_end_time_M}:00"
|
||||
self.working_shift_char = f"自定义班次{start_time}-{end_time}"
|
||||
|
||||
@api.onchange('end_time')
|
||||
def _onchange_end_time(self):
|
||||
pattern = re.compile(r'^(([0-9]|1[0-9]|2[0-3]):[0-5][0-9])|24:00$')
|
||||
@api.depends('start_time_H', 'start_time_M', 'end_time_H', 'end_time_M')
|
||||
def _compute_duration(self):
|
||||
"""
|
||||
根据日开始时间和日结束时间计算每日工作时长
|
||||
:return:
|
||||
"""
|
||||
for record in self:
|
||||
if record.end_time and not pattern.match(record.end_time):
|
||||
raise models.ValidationError('输入的日结束时间不正确,请重新输入!')
|
||||
|
||||
|
||||
st_h = float(record.start_time_H)
|
||||
st_m = float(record.start_time_M)
|
||||
end_h = float(record.end_time_H)
|
||||
end_m = float(record.end_time_M)
|
||||
# 日开始时间小于日结束时间
|
||||
if st_h < end_h:
|
||||
record.duration = str(round(end_h-st_h+(end_m-st_m)/60, 2))
|
||||
else:
|
||||
record.duration = str(round(end_h-st_h+(end_m-st_m)/60+24, 2))
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_sf_work_log_setting,sf.work.log.setting,model_sf_work_log_setting,base.group_user,1,1,1,1
|
||||
access_sf_production_line,sf.production.line,model_sf_production_line,base.group_user,1,1,1,1
|
||||
access_sf_working_procedure,sf.working.procedure,model_sf_working_procedure,base.group_user,1,1,1,1
|
||||
access_sf_procedure_equipment_resource_setting,sf.procedure.equipment.resource.setting,model_sf_procedure_equipment_resource_setting,base.group_user,1,1,1,1
|
||||
|
||||
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
/>
|
||||
|
||||
<menuitem id="menu_sf_procedure_equipment_resource_setting"
|
||||
name="工序设备资源设置"
|
||||
name="产线设备资源设置"
|
||||
parent="menu_sf_basic_setting"
|
||||
action="sf_procedure_equipment_resource_setting_act"
|
||||
sequence="10"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<field name="model">sf.work.log.setting</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="start_time"/>
|
||||
<field name="end_time"/>
|
||||
@@ -26,26 +27,61 @@
|
||||
<form>
|
||||
<sheet string-="工作日历设置">
|
||||
<group string="基础信息">
|
||||
<group>
|
||||
<field name="name"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="code"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="选择班次">
|
||||
<group>
|
||||
<field name="user_defined_working_shift_status"/>
|
||||
<field name="working_shift" invisible="True"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="working_shift_char" attrs="{'invisible': [('user_defined_working_shift_status', '=', False)]}"/>
|
||||
<field name="working_shift_select" attrs="{'invisible': [('user_defined_working_shift_status', '!=', False)]}"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="user_defined_working_shift_status"/>
|
||||
<field name="working_shift" invisible="True"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
<group>
|
||||
<field name="working_shift_start_time_H" attrs="{'invisible': [('user_defined_working_shift_status', '=', False)]}"/>
|
||||
<field name="working_shift_end_time_H" attrs="{'invisible': [('user_defined_working_shift_status', '=', False)]}"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="working_shift_start_time_M" attrs="{'invisible': [('user_defined_working_shift_status', '=', False)]}"/>
|
||||
<field name="working_shift_end_time_M" attrs="{'invisible': [('user_defined_working_shift_status', '=', False)]}"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
</group>
|
||||
<group string="工作时间">
|
||||
<group>
|
||||
<!-- <field name="start_time" widget="char" placeholder="请输入的时间为:00:00-24:00"/>-->
|
||||
<field name="start_time" options="{'no_date': True, 'format': 'HH:mm:ss'}"/>
|
||||
<group>
|
||||
<field name="start_time"/>
|
||||
<field name="end_time"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="start_time_H"/>
|
||||
<field name="end_time_H"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
<field name="start_time_M"/>
|
||||
<field name="end_time_M"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
<field name="duration"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="end_time" widget="char" placeholder="请输入的时间为:00:00-24:00"/>
|
||||
<field name="day_off"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -64,40 +100,102 @@
|
||||
</record>
|
||||
|
||||
|
||||
<!--========================================工序设备资源设置========================================-->
|
||||
<!--========================================产线设备资源设置========================================-->
|
||||
<record id="sf_procedure_equipment_resource_setting_tree" model="ir.ui.view">
|
||||
<field name="name">工序设备资源设置</field>
|
||||
<field name="name">产线设备资源设置</field>
|
||||
<field name="model">sf.procedure.equipment.resource.setting</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="machine_tool_name"/>
|
||||
<tree string="产线设备资源设置">
|
||||
<field name="work_center_name_id"/>
|
||||
<field name="equipment_code"/>
|
||||
<field name="equipment_name_id"/>
|
||||
<field name="brand"/>
|
||||
<field name="model"/>
|
||||
<field name="working_procedure"/>
|
||||
<field name="production_capacity"/>
|
||||
<field name="working_calendar"/>
|
||||
<field name="working_calendar_id"/>
|
||||
<field name="working_shift"/>
|
||||
<field name="create_time"/>
|
||||
<field name="stale_dated_time"/>
|
||||
<field name="status"/>
|
||||
<field name="participate_in_scheduling"/>
|
||||
<field name="production_line_id" invisible="True"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- <record id="sf_procedure_equipment_resource_setting_form" model="ir.ui.view">-->
|
||||
<!-- <field name="name">工序设备资源设置</field>-->
|
||||
<!-- <field name="model">sf.procedure.equipment.resource.setting</field>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <form>-->
|
||||
<record id="sf_procedure_equipment_resource_setting_form" model="ir.ui.view">
|
||||
<field name="name">产线设备资源设置</field>
|
||||
<field name="model">sf.procedure.equipment.resource.setting</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="产线设备资源设置">
|
||||
<sheet>
|
||||
<group string="生产线">
|
||||
<group>
|
||||
<field name="production_line_id"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="工作中心信息">
|
||||
<group>
|
||||
<field name="work_center_name_id"/>
|
||||
<field name="production_capacity"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="working_procedure"/>
|
||||
<field name="participate_in_scheduling"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="设备信息">`
|
||||
<group>
|
||||
<field name="equipment_name_id"/>
|
||||
<field name="brand"/>
|
||||
<field name="status"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="equipment_code" string="机台号"/>
|
||||
<field name="model"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="工作日历信息">
|
||||
<group>
|
||||
<field name="working_calendar_id"/>
|
||||
<field name="create_time"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="working_shift"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- </form>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
<record id="sf_procedure_equipment_resource_setting_search" model="ir.ui.view">
|
||||
<field name="name">产线设备资源设置</field>
|
||||
<field name="model">sf.procedure.equipment.resource.setting</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="work_center_name_id"/>
|
||||
<field name="equipment_code"/>
|
||||
<field name="equipment_name_id"/>
|
||||
<field name="brand"/>
|
||||
<field name="model"/>
|
||||
<field name="working_procedure"/>
|
||||
<field name="production_capacity"/>
|
||||
<field name="working_calendar_id"/>
|
||||
<field name="working_shift"/>
|
||||
<field name="create_time"/>
|
||||
<field name="status"/>
|
||||
<field name="participate_in_scheduling"/>
|
||||
<searchpanel>
|
||||
<field name="production_line_id" icon="fa-building" enable_counters="1"/>
|
||||
</searchpanel>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_procedure_equipment_resource_setting_act" model="ir.actions.act_window">
|
||||
<field name="name">工序设备资源设置</field>
|
||||
<field name="name">产线设备资源设置</field>
|
||||
<field name="res_model">sf.procedure.equipment.resource.setting</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">tree,form,search</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
'web.assets_qweb': [
|
||||
],
|
||||
'web.assets_backend': [
|
||||
'sf_warehouse/static/src/change.scss',
|
||||
'sf_warehouse/static/src/kanban_color_change.scss',
|
||||
'sf_warehouse/static/src/colorGuide.js'
|
||||
|
||||
'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',
|
||||
]
|
||||
|
||||
},
|
||||
|
||||
25
sf_warehouse/static/src/css/kanban_color_change.scss
Normal file
25
sf_warehouse/static/src/css/kanban_color_change.scss
Normal file
@@ -0,0 +1,25 @@
|
||||
.oe_kanban_card.kanban_color_1 {
|
||||
background-color: #73b9a2 !important;
|
||||
}
|
||||
|
||||
.oe_kanban_card.kanban_color_2 {
|
||||
background-color: #ac6767 !important;
|
||||
}
|
||||
|
||||
.oe_kanban_card.kanban_color_3 {
|
||||
background-color: #77787b !important;
|
||||
}
|
||||
|
||||
.color-guide {
|
||||
border: 1px solid #ccc;
|
||||
background-color: #f9f9f9;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.color-guide-item {
|
||||
display: inline-block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin-right: 10px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
21
sf_warehouse/static/src/js/custom_kanban_controller.js
Normal file
21
sf_warehouse/static/src/js/custom_kanban_controller.js
Normal file
@@ -0,0 +1,21 @@
|
||||
/** @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);
|
||||
16
sf_warehouse/static/src/xml/custom_kanban_controller.xml
Normal file
16
sf_warehouse/static/src/xml/custom_kanban_controller.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates>
|
||||
<t t-name="sf_warehouse.CustomKanbanView" t-inherit="web.KanbanView" owl="1">
|
||||
<!-- <xpath expr="//Layout" position="before"> -->
|
||||
<!-- <div> -->
|
||||
<!-- Hello world ! -->
|
||||
<!-- </div> -->
|
||||
<!-- </xpath> -->
|
||||
<xpath expr="//t[@t-component='props.Renderer']" position="before">
|
||||
<div>
|
||||
Hello world !
|
||||
</div>
|
||||
</xpath>
|
||||
|
||||
</t>
|
||||
</templates>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<data>
|
||||
<record id="view_location_tree2_sf_inherit" model="ir.ui.view">
|
||||
<field name="name">stock.location.tree.sf.inherit</field>
|
||||
<field name="model">stock.location</field>
|
||||
@@ -27,41 +27,30 @@
|
||||
<field name="hide_location" invisible="1"/>
|
||||
<field name="barcode" string="编码"/>
|
||||
<field name="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="time_test" widget='timepicker'/>
|
||||
<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', '=', '空闲')]}"/>
|
||||
|
||||
</group>
|
||||
<group>
|
||||
<field name="location_category"
|
||||
attrs="{'invisible': [('hide_location_type', '=', False)], 'required': [('hide_location_type', '!=', False)]}"/>
|
||||
<field name="area_type"
|
||||
attrs="{'invisible': [('hide_area', '=', False)], 'required': [('hide_area', '!=', False)]}"/>
|
||||
<field name="shelf_height"
|
||||
attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
|
||||
<field name="shelf_layer"
|
||||
attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
|
||||
<field name="layer_capacity"
|
||||
attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
|
||||
<field name="product_id"
|
||||
attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False), ('location_status', '=', '空闲')]}"/>
|
||||
<field name="location_status"
|
||||
attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False)]}"/>
|
||||
<field name="location_category" attrs="{'invisible': [('hide_location_type', '=', False)], 'required': [('hide_location_type', '!=', False)]}"/>
|
||||
<field name="area_type" attrs="{'invisible': [('hide_area', '=', False)], 'required': [('hide_area', '!=', False)]}"/>
|
||||
<field name="shelf_height" attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
|
||||
<field name="shelf_layer" attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
|
||||
<field name="layer_capacity" attrs="{'invisible': [('hide_shelf', '=', False)], 'required': [('hide_shelf', '!=', False)]}"/>
|
||||
<field name="product_id" attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False), ('location_status', '=', '空闲')]}"/>
|
||||
<field name="location_status" attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False)]}"/>
|
||||
|
||||
</group>
|
||||
|
||||
</group>
|
||||
</xpath>
|
||||
<!-- <xpath expr="//form/sheet/div/button" position="before"> -->
|
||||
<!-- <button string="生成货位" name="create_location" type="object" class="oe_highlight" attrs="{'invisible': [('hide_shelf', '=', False)]}"/> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- <xpath expr="//form/sheet/div/button" position="before"> -->
|
||||
<!-- <button string="生成货位" name="create_location" type="object" class="oe_highlight" attrs="{'invisible': [('hide_shelf', '=', False)]}"/> -->
|
||||
<!-- </xpath> -->
|
||||
<xpath expr="//form/sheet" position="before">
|
||||
<header>
|
||||
<button string="生成货位" name="create_location" type="object" class="oe_highlight"
|
||||
attrs="{'invisible': [('hide_shelf', '=', False)]}"/>
|
||||
<button string="生成货位" name="create_location" type="object" class="oe_highlight" attrs="{'invisible': [('hide_shelf', '=', False)]}"/>
|
||||
</header>
|
||||
</xpath>
|
||||
|
||||
@@ -75,19 +64,17 @@
|
||||
<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_type" icon="fa-filter"/> -->
|
||||
<field name="location_id" select="multi" domain="[('location_type', '=', '货架')]"/>
|
||||
</searchpanel>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<!-- <div class="testss">1023</div>-->
|
||||
<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">
|
||||
<div class="xu">
|
||||
<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
|
||||
@@ -106,38 +93,37 @@
|
||||
</div>
|
||||
<div class="o_kanban_record_bottom">
|
||||
<field name="product_sn_id"/>
|
||||
<span class="spilit">|</span>
|
||||
<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> -->
|
||||
<!-- <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>
|
||||
</div>
|
||||
</kanban>
|
||||
</field>
|
||||
</record>
|
||||
@@ -149,17 +135,17 @@
|
||||
<field name="view_mode">kanban,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> -->
|
||||
<!-- <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"
|
||||
@@ -167,5 +153,5 @@
|
||||
action="kanban_action_id"/>
|
||||
|
||||
|
||||
</data>
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user