Merge branch 'feature/修复cnc工单按钮显示问题' into develop
This commit is contained in:
@@ -62,6 +62,13 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
|
|
||||||
manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
|
manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
|
||||||
|
|
||||||
|
def _compute_working_users(self):
|
||||||
|
super()._compute_working_users()
|
||||||
|
for item in self:
|
||||||
|
if item.state == 'to be detected':
|
||||||
|
if self.env.user.has_group('sf_base.group_sf_equipment_user'):
|
||||||
|
item.is_user_working = True
|
||||||
|
|
||||||
@api.onchange('users_ids')
|
@api.onchange('users_ids')
|
||||||
def get_user_permissions(self):
|
def get_user_permissions(self):
|
||||||
uid = self.env.uid
|
uid = self.env.uid
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ class StockRule(models.Model):
|
|||||||
productions_values)
|
productions_values)
|
||||||
|
|
||||||
# self.env['stock.move'].sudo().create(productions._get_moves_raw_values())
|
# self.env['stock.move'].sudo().create(productions._get_moves_raw_values())
|
||||||
self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
# self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
||||||
|
|
||||||
'''
|
'''
|
||||||
创建工单
|
创建工单
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ access_mrp_workorder_group_sf_mrp_user,mrp_workorder,model_mrp_workorder,sf_base
|
|||||||
access_mrp_workorder_manager,mrp_workorder,model_mrp_workorder,sf_base.group_sf_mrp_manager,1,1,1,0
|
access_mrp_workorder_manager,mrp_workorder,model_mrp_workorder,sf_base.group_sf_mrp_manager,1,1,1,0
|
||||||
access_mrp_workcenter_group_sf_mrp_user,mrp_workcenter,model_mrp_workcenter,sf_base.group_sf_mrp_user,1,0,0,0
|
access_mrp_workcenter_group_sf_mrp_user,mrp_workcenter,model_mrp_workcenter,sf_base.group_sf_mrp_user,1,0,0,0
|
||||||
access_mrp_workcenter_manager,mrp_workcenter,model_mrp_workcenter,sf_base.group_sf_mrp_manager,1,1,1,0
|
access_mrp_workcenter_manager,mrp_workcenter,model_mrp_workcenter,sf_base.group_sf_mrp_manager,1,1,1,0
|
||||||
access_mrp_workcenter_productivity_group_sf_mrp_user,mrp_workcenter_productivity,model_mrp_workcenter_productivity,sf_base.group_sf_mrp_user,1,0,0,0
|
access_mrp_workcenter_productivity_group_sf_equipment_user,mrp_workcenter_productivity,model_mrp_workcenter_productivity,sf_base.group_sf_equipment_user,1,1,1,0
|
||||||
access_mrp_workcenter_productivity_manager,mrp_workcenter_productivity,model_mrp_workcenter_productivity,sf_base.group_sf_mrp_manager,1,1,1,0
|
access_mrp_workcenter_productivity_manager,mrp_workcenter_productivity,model_mrp_workcenter_productivity,sf_base.group_sf_mrp_manager,1,1,1,0
|
||||||
access_sf_workpiece_delivery_group_sf_order_user,sf_workpiece_delivery_group_sf_order_user,model_sf_workpiece_delivery,sf_base.group_sf_order_user,1,1,1,0
|
access_sf_workpiece_delivery_group_sf_order_user,sf_workpiece_delivery_group_sf_order_user,model_sf_workpiece_delivery,sf_base.group_sf_order_user,1,1,1,0
|
||||||
access_sf_workpiece_delivery_group_sf_equipment_user,sf_workpiece_delivery_group_sf_equipment_user,model_sf_workpiece_delivery,sf_base.group_sf_equipment_user,1,1,0,0
|
access_sf_workpiece_delivery_group_sf_equipment_user,sf_workpiece_delivery_group_sf_equipment_user,model_sf_workpiece_delivery,sf_base.group_sf_equipment_user,1,1,0,0
|
||||||
|
|||||||
|
@@ -354,7 +354,7 @@
|
|||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//tree//button[@name='button_finish']" position="replace">
|
<xpath expr="//tree//button[@name='button_finish']" position="replace">
|
||||||
<button name="button_finish" type="object" string="Done" class="btn-success"
|
<button name="button_finish" type="object" string="Done" class="btn-success"
|
||||||
attrs="{'invisible': ['|', '|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False), ('routing_type', '=', 'CNC加工')]}"
|
attrs="{'invisible': ['|', '|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"
|
||||||
groups="sf_base.group_sf_mrp_user"
|
groups="sf_base.group_sf_mrp_user"
|
||||||
confirm="是否确认完成?"/>
|
confirm="是否确认完成?"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
<attribute name="attrs">{'invisible': ['|', '|', '|','|','|', ('production_state','in', ('draft',
|
<attribute name="attrs">{'invisible': ['|', '|', '|','|','|', ('production_state','in', ('draft',
|
||||||
'done',
|
'done',
|
||||||
'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel')),
|
'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel')),
|
||||||
('is_user_working', '!=', False),("user_permissions","=",False),("name","=","获取CNC加工程序")]}
|
('is_user_working', '!=', False),("user_permissions","=",False),("name","=","CNC加工")]}
|
||||||
</attribute>
|
</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//button[@name='%(mrp.act_mrp_block_workcenter_wo)d']" position="attributes">
|
<xpath expr="//button[@name='%(mrp.act_mrp_block_workcenter_wo)d']" position="attributes">
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
<!-- groups="sf_base.group_sf_mrp_user" confirm="是否确认完工"/> -->
|
<!-- groups="sf_base.group_sf_mrp_user" confirm="是否确认完工"/> -->
|
||||||
|
|
||||||
<button name="button_start" type="object" string="开始" class="btn-success" confirm="是否确认开始"
|
<button name="button_start" type="object" string="开始" class="btn-success" confirm="是否确认开始"
|
||||||
attrs="{'invisible': ['|', '|', '|', ('production_state','in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel')), ('is_user_working', '!=', False)]}"/>
|
attrs="{'invisible': ['|', '|', '|', ('production_state','in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel','to be detected')), ('is_user_working', '!=', False)]}"/>
|
||||||
<button name="button_pending" type="object" string="暂停" class="btn-warning"
|
<button name="button_pending" type="object" string="暂停" class="btn-warning"
|
||||||
attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"/>
|
attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"/>
|
||||||
<button name="button_finish" type="object" string="完成" class="btn-success" confirm="是否确认完工"
|
<button name="button_finish" type="object" string="完成" class="btn-success" confirm="是否确认完工"
|
||||||
@@ -165,7 +165,7 @@
|
|||||||
<!-- groups="sf_base.group_sf_mrp_user" -->
|
<!-- groups="sf_base.group_sf_mrp_user" -->
|
||||||
<!-- attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked'),('state','=','done')]}"/> -->
|
<!-- attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked'),('state','=','done')]}"/> -->
|
||||||
<button name="button_workpiece_delivery" type="object" string="工件配送" class="btn-primary"
|
<button name="button_workpiece_delivery" type="object" string="工件配送" class="btn-primary"
|
||||||
attrs="{'invisible': ['|','|',('routing_type','!=','装夹预调'),('is_delivery','=',True),('state','!=','done')]}"/>
|
attrs="{'invisible': ['|','|','|',('routing_type','!=','装夹预调'),('is_delivery','=',True),('state','!=','done'),('is_rework','=',True),('rfid_code','in',['',False])]}"/>
|
||||||
<button name="button_rework_pre" type="object" string="返工"
|
<button name="button_rework_pre" type="object" string="返工"
|
||||||
class="btn-primary"
|
class="btn-primary"
|
||||||
attrs="{'invisible': ['|','|',('routing_type','!=','装夹预调'),('state','!=','progress'),('is_rework','=',True)]}"/>
|
attrs="{'invisible': ['|','|',('routing_type','!=','装夹预调'),('state','!=','progress'),('is_rework','=',True)]}"/>
|
||||||
|
|||||||
@@ -15,20 +15,32 @@
|
|||||||
attrs='{"invisible": [("routing_type","=","装夹预调")]}' widget="many2many_tags"/>
|
attrs='{"invisible": [("routing_type","=","装夹预调")]}' widget="many2many_tags"/>
|
||||||
</group>
|
</group>
|
||||||
<div attrs='{"invisible": [("reprogramming_num","=",0)]}'>
|
<div attrs='{"invisible": [("reprogramming_num","=",0)]}'>
|
||||||
注意*: 该制造订单的产品已重复编程过<field name="reprogramming_num" string=""
|
注意: 该制造订单的产品已重复编程过<field
|
||||||
readonly="1"
|
name="reprogramming_num" string=""
|
||||||
style='color:red;'/>次,且当前编程状态为
|
readonly="1"
|
||||||
|
style='color:red;'/>次,且当前编程状态为
|
||||||
<field name="programming_state" string=""
|
<field name="programming_state" string=""
|
||||||
decoration-info="programming_state == '待编程'"
|
decoration-info="programming_state == '待编程'"
|
||||||
decoration-success="programming_state == '已下发'"
|
decoration-success="programming_state == '已下发'"
|
||||||
decoration-warning="programming_state =='编程中'"
|
decoration-warning="programming_state =='编程中'"
|
||||||
decoration-danger="programming_state =='已编程'" readonly="1"/>
|
decoration-danger="programming_state =='已编程'" readonly="1"/>
|
||||||
</div>
|
</div>
|
||||||
|
<div attrs='{"invisible": ["|",("routing_type","in",["装夹预调","CNC加工"]),("programming_state","not in",["已下发"])]}'>
|
||||||
|
<span style='font-weight:bold;'>申请重新编程
|
||||||
|
<field name="is_reprogramming" force_save="1"/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div attrs='{"invisible": ["|",("routing_type","in",["装夹预调","CNC加工"]),("programming_state","in",["已下发"])],"readonly": [("is_reprogramming_readonly","=",False)]}'>
|
||||||
|
<span style='font-weight:bold;'>申请重新编程
|
||||||
|
<field name="is_reprogramming_readonly"
|
||||||
|
attrs='{"readonly": [("is_reprogramming_readonly","=",False)]}'/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<group>
|
<group>
|
||||||
<field name="is_reprogramming" force_save="1"
|
<!-- <field name="is_reprogramming" force_save="1"-->
|
||||||
attrs='{"invisible": ["|",("routing_type","in",["装夹预调","CNC加工"]),("programming_state","not in",["已下发"])]}'/>
|
<!-- attrs='{"invisible": ["|",("routing_type","in",["装夹预调","CNC加工"]),("programming_state","not in",["已下发"])]}'/>-->
|
||||||
<field name="is_reprogramming_readonly" string="申请重新编程"
|
<!-- <field name="is_reprogramming_readonly" string="申请重新编程"-->
|
||||||
attrs='{"invisible": ["|",("routing_type","in",["装夹预调","CNC加工"]),("programming_state","in",["已下发"])],"readonly": [("is_reprogramming_readonly","=",False)]}'/>
|
<!-- attrs='{"invisible": ["|",("routing_type","in",["装夹预调","CNC加工"]),("programming_state","in",["已下发"])],"readonly": [("is_reprogramming_readonly","=",False)]}'/>-->
|
||||||
<field name="rework_reason"
|
<field name="rework_reason"
|
||||||
attrs='{"invisible": [("routing_type","not in",["装夹预调","CNC加工"])],"required": [("routing_type","in",["装夹预调"])]}'/>
|
attrs='{"invisible": [("routing_type","not in",["装夹预调","CNC加工"])],"required": [("routing_type","in",["装夹预调"])]}'/>
|
||||||
<field name="detailed_reason"
|
<field name="detailed_reason"
|
||||||
|
|||||||
@@ -82,31 +82,31 @@ class Sf_Mrs_Connect(http.Controller):
|
|||||||
# if pre_workorder:
|
# if pre_workorder:
|
||||||
# pre_workorder.write(
|
# pre_workorder.write(
|
||||||
# {'processing_drawing': base64.b64encode(open(panel_file_path, 'rb').read())})
|
# {'processing_drawing': base64.b64encode(open(panel_file_path, 'rb').read())})
|
||||||
# for panel in ret['processing_panel'].split(','):
|
for panel in ret['processing_panel'].split(','):
|
||||||
# # 查询状态为进行中且工序类型为CNC加工的工单
|
# 查询状态为进行中且工序类型为CNC加工的工单
|
||||||
# cnc_workorder = productions.workorder_ids.filtered(
|
cnc_workorder = productions.workorder_ids.filtered(
|
||||||
# lambda ac: ac.routing_type == 'CNC加工' and ac.state not in ['progress', 'done',
|
lambda ac: ac.routing_type == 'CNC加工' and ac.state not in ['progress', 'done',
|
||||||
# 'cancel'] and ac.processing_panel == panel)
|
'cancel'] and ac.processing_panel == panel)
|
||||||
# if cnc_workorder:
|
if cnc_workorder:
|
||||||
# # program_path_tmp_panel = os.path.join('C://Users//43484//Desktop//fsdownload//test',
|
# program_path_tmp_panel = os.path.join('C://Users//43484//Desktop//fsdownload//test',
|
||||||
# # panel)
|
# panel)
|
||||||
# program_path_tmp_panel = os.path.join('/tmp', ret['folder_name'], 'return', panel)
|
program_path_tmp_panel = os.path.join('/tmp', ret['folder_name'], 'return', panel)
|
||||||
# logging.info('program_path_tmp_panel:%s' % program_path_tmp_panel)
|
logging.info('program_path_tmp_panel:%s' % program_path_tmp_panel)
|
||||||
# files_panel = os.listdir(program_path_tmp_panel)
|
files_panel = os.listdir(program_path_tmp_panel)
|
||||||
# if files_panel:
|
if files_panel:
|
||||||
# for file in files_panel:
|
for file in files_panel:
|
||||||
# file_extension = os.path.splitext(file)[1]
|
file_extension = os.path.splitext(file)[1]
|
||||||
# logging.info('file_extension:%s' % file_extension)
|
logging.info('file_extension:%s' % file_extension)
|
||||||
# if file_extension.lower() == '.pdf':
|
if file_extension.lower() == '.pdf':
|
||||||
# panel_file_path = os.path.join(program_path_tmp_panel, file)
|
panel_file_path = os.path.join(program_path_tmp_panel, file)
|
||||||
# logging.info('panel_file_path:%s' % panel_file_path)
|
logging.info('panel_file_path:%s' % panel_file_path)
|
||||||
# cnc_workorder.write({'cnc_worksheet': base64.b64encode(open(panel_file_path, 'rb').read())})
|
cnc_workorder.write({'cnc_worksheet': base64.b64encode(open(panel_file_path, 'rb').read())})
|
||||||
# pre_workorder = productions.workorder_ids.filtered(
|
pre_workorder = productions.workorder_ids.filtered(
|
||||||
# lambda ap: ap.routing_type == '装夹预调' and ap.state not in ['done',
|
lambda ap: ap.routing_type == '装夹预调' and ap.state not in ['done',
|
||||||
# 'cancel'] and ap.processing_panel == panel)
|
'cancel'] and ap.processing_panel == panel)
|
||||||
# if pre_workorder:
|
if pre_workorder:
|
||||||
# pre_workorder.write(
|
pre_workorder.write(
|
||||||
# {'processing_drawing': base64.b64encode(open(panel_file_path, 'rb').read())})
|
{'processing_drawing': base64.b64encode(open(panel_file_path, 'rb').read())})
|
||||||
productions.write({'programming_state': '已编程', 'work_state': '已编程'})
|
productions.write({'programming_state': '已编程', 'work_state': '已编程'})
|
||||||
cnc_program_ids = [item.id for item in productions]
|
cnc_program_ids = [item.id for item in productions]
|
||||||
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
|
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ class CNCprocessing(models.Model):
|
|||||||
else:
|
else:
|
||||||
production_id.write({
|
production_id.write({
|
||||||
'tool_state_remark': tool_state_remark2,
|
'tool_state_remark': tool_state_remark2,
|
||||||
'tool_state_remark2': f'{production_id.tool_state_remark1}\n{tool_state_remark1}'
|
'tool_state_remark2': f'{production_id.tool_state_remark}\n{tool_state_remark1}'
|
||||||
})
|
})
|
||||||
logging.info('工单cnc程序用刀校验已完成!')
|
logging.info('工单cnc程序用刀校验已完成!')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user