parameters: (self, data)
docstring: Save the type of device.
          We need that in order to keep the selected type of device after a reboot.
docstring_summary: Save the type of device.
          We need that in order to keep the selected type of device after a reboot.
docstring_tokens: Save the type of device . We need that in order to keep the selected type of device after a reboot .
function: def _save_is_scanner(self, data):
          """Save the type of device.
          We need that in order to keep the selected type of device after a reboot.
          """
          is_scanner = {'is_scanner': data.get('is_scanner')}
          file_path = Path.home() / 'odoo-keyboard-is-scanner.conf'
          if file_path.exists():
              data = json.loads(file_path.read_text())
          else:
              data = {}
          data[self.device_identifier] = is_scanner
          helpers.write_file('odoo-keyboard-is-scanner.conf', json.dumps(data))
          self._set_device_type('scanner') if is_scanner.get('is_scanner') else self._set_device_type()
function_tokens: def _save_is_scanner ( self , data ) : is_scanner = { 'is_scanner' : data . get ( 'is_scanner' ) } file_path = Path . home ( ) / 'odoo-keyboard-is-scanner.conf' if file_path . exists ( ) : data = json . loads ( file_path . read_text ( ) ) else : data = { } data [ self . device_identifier ] = is_scanner helpers . write_file ( 'odoo-keyboard-is-scanner.conf' , json . dumps ( data ) ) self . _set_device_type ( 'scanner' ) if is_scanner . get ( 'is_scanner' ) else self . _set_device_type ( )