diff --git a/sf_tool_management/__manifest__.py b/sf_tool_management/__manifest__.py index 8baa540f..837a8f2e 100644 --- a/sf_tool_management/__manifest__.py +++ b/sf_tool_management/__manifest__.py @@ -38,6 +38,7 @@ 'web.assets_qweb': [ ], 'web.assets_backend': [ + 'sf_tool_management/static/src/change.scss' ] }, diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index 505ede36..3d9ec5ee 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -387,7 +387,7 @@ class FunctionalToolAssembly(models.Model): else: raise ValidationError('刀柄选择错误,请重新确认!!!') else: - location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', barcode)]) + location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', barcode.upper())]) if location: if location == record.integral_freight_barcode_id: tool_assembly_id.integral_verify = True @@ -782,10 +782,11 @@ class FunctionalToolAssembly(models.Model): """根据BOM对刀具物料进行初始配置""" options = bom.get('options') # 配置刀柄信息 - for handle_id in bom.get('handle_ids'): + handle_ids = self._get_old_tool_material_lot(bom.get('handle_ids')) + for handle_id in handle_ids: if handle_id: if not self.handle_product_id: - self.handle_product_id = handle_id.id + self.handle_product_id = handle_id.product_id.id break # 刀柄之外的物料配置 @@ -820,19 +821,20 @@ class FunctionalToolAssembly(models.Model): location_id = self.env['stock.location'].search([('name', '=', '刀具房')]) stock_quant = self.env['stock.quant'].sudo().search( [('location_id', '=', location_id.id), ('product_id', 'in', material_ids.ids), ('quantity', '>', '0')], - order='lot_id', limit=1) + order='lot_id') if stock_quant: - return stock_quant.lot_id + return [quant.lot_id for quant in stock_quant] else: raise ValidationError(f'【{material_ids[0].cutting_tool_material_id.name}】物料库存不足,请先进行盘点或采购') - def _get_shelf_location_lot(self, lot_id): + def _get_shelf_location_lot(self, lot_ids): """根据所给的刀具物料批次号,返回一个刀具物料货位、批次信息""" - location_lots = self.env['sf.shelf.location.lot'].sudo().search([('lot_id', '=', lot_id.id)]) - if not location_lots: - raise ValidationError(f'没有查询到批次为【{lot_id.name}】物料的货位信息!') - else: - return location_lots[0] + for lot_id in lot_ids: + location_lots = self.env['sf.shelf.location.lot'].sudo().search([('lot_id', '=', lot_id.id)]) + if location_lots: + return location_lots[0] + raise ValidationError(f'【{lot_ids[0].product_id.cutting_tool_material_id.name}】物料在货位库存不足,请先进行盘点入库') + def _get_inventory_bom(self, inventory_id): """获取BOM的刀具物料产品信息""" diff --git a/sf_tool_management/static/images/replaceIcon.png b/sf_tool_management/static/images/replaceIcon.png new file mode 100644 index 00000000..12d2852f Binary files /dev/null and b/sf_tool_management/static/images/replaceIcon.png differ diff --git a/sf_tool_management/static/src/change.scss b/sf_tool_management/static/src/change.scss index 4c857c8c..20298bdf 100644 --- a/sf_tool_management/static/src/change.scss +++ b/sf_tool_management/static/src/change.scss @@ -1,17 +1,41 @@ -.modal-content .o_cp_buttons { - display:none -} +// .modal-content .o_cp_buttons { +// display:none +// } -.modal-content .o_control_panel { - display:none -} +// .modal-content .o_control_panel { +// display:none +// } -.modal-content .o_list_button { +// .modal-content .o_list_button { + +// } + +// .o_form_view .o_field_widget .o_list_renderer { +// width: 100%!important; +// margin:0 auto; +// overflow: auto; +// } +.o_field_widget.o_readonly_modifier.o_field_char.text-success[name=handle_freight_rfid], +.o_field_widget.o_readonly_modifier.o_field_many2one.text-success[name=integral_freight_barcode_id] { + a.text-success{ + span { + color: #999; + } + } + &::after{ + content: ''; + display: block; + width: 18px; + height: 18px; + background: url('/sf_tool_management/static/images/replaceIcon.png') no-repeat center center; + background-size: 100%; + } } - -.o_form_view .o_field_widget .o_list_renderer { - width: 100%!important; - margin:0 auto; - overflow: auto; -} +.o_field_widget.o_readonly_modifier.o_field_char.text-success[name=handle_freight_rfid] { + display: flex; + align-items: center; + > span { + color: #999; + } +} \ No newline at end of file diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml index 8f986858..be0b5a3f 100644 --- a/sf_tool_management/views/tool_base_views.xml +++ b/sf_tool_management/views/tool_base_views.xml @@ -534,7 +534,7 @@ - + @@ -555,14 +555,14 @@ - + - + diff --git a/sf_warehouse/security/ir.model.access.csv b/sf_warehouse/security/ir.model.access.csv index 88514fd3..1510e854 100644 --- a/sf_warehouse/security/ir.model.access.csv +++ b/sf_warehouse/security/ir.model.access.csv @@ -150,4 +150,4 @@ access_sf_shelf_lot_group_user,sf.shelf.location.lot.group_user,model_sf_shelf_l access_ir_model_group_sf_stock_user,ir_model_group_sf_stock_user,base.model_ir_model,sf_base.group_sf_stock_user,1,1,0,0 -access_mrp_workorder_group_sf_stock_user,mrp_workorder_group_sf_stock_user,mrp.model_mrp_workorder,sf_base.group_sf_stock_user,1,0,0,0 +access_mrp_workorder_group_sf_stock_user,mrp_workorder_group_sf_stock_user,mrp.model_mrp_workorder,sf_base.group_sf_stock_user,1,1,0,0