diff --git a/sf_mrs_connect/models/sync_common.py b/sf_mrs_connect/models/sync_common.py index 2795047a..e3ca710b 100644 --- a/sf_mrs_connect/models/sync_common.py +++ b/sf_mrs_connect/models/sync_common.py @@ -2116,19 +2116,21 @@ class CuttingSpeed(models.Model): for item in result['feed_per_tooth_all_list']: feed_per_tooth = self.search([("name", '=', item['name']), ('active', 'in', [True, False])]) if not feed_per_tooth: - self.create({ - 'name': item['name'], - 'standard_library_id': self.env['sf.cutting_tool.standard.library'].search( - [('code', '=', item['standard_library_code'].replace("JKM", result[ - 'factory_short_name']))]).id, - 'materials_type_id': self.env['sf.materials.model'].search( - [('materials_no', '=', item['materials_type_code'])]).id, - 'cutting_width_depth_id': self.env['sf.cutting.width.depth'].search( - [('name', '=', item['cutting_width_depth'])]).id, - 'blade_diameter': item['blade_diameter'], - 'feed_per_tooth': item['feed_per_tooth'], - 'active': item['active'], - }) + _logger.info("item[standard_library_code] %s" % item.get('standard_library_code')) + if item.get('standard_library_code'): + self.create({ + 'name': item['name'], + 'standard_library_id': self.env['sf.cutting_tool.standard.library'].search( + [('code', '=', item['standard_library_code'].replace("JKM", result[ + 'factory_short_name']))]).id, + 'materials_type_id': self.env['sf.materials.model'].search( + [('materials_no', '=', item['materials_type_code'])]).id, + 'cutting_width_depth_id': self.env['sf.cutting.width.depth'].search( + [('name', '=', item['cutting_width_depth'])]).id, + 'blade_diameter': item['blade_diameter'], + 'feed_per_tooth': item['feed_per_tooth'], + 'active': item['active'], + }) else: feed_per_tooth.write({ 'materials_type_id': self.env['sf.materials.model'].search(