def run(self): # Recupera il record dal database self.filedata_obj = self.pool['pricelist.import'] self.pricelistImportRecord = self.filedata_obj.browse( self.cr, self.uid, self.pricelistImportID, context=self.context) self.file_name = self.pricelistImportRecord.file_name.split('\\')[-1] self.pricelist_id = self.pricelistImportRecord.pricelist_id Config = getattr(settings, self.pricelistImportRecord.format) self.HEADER = Config.HEADER_PRICELIST_ITEM self.REQUIRED = Config.REQUIRED_PRICELIST_ITEM self.RecordPriceListItem = namedtuple('RecordPriceListItem', Config.COLUMNS_PRICELIST_ITEM) table, self.numberOfLines = import_sheet( self.file_name, self.pricelistImportRecord.content_text) if DEBUG: # Importa il file self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, self.message_title, 'Importazione completata', record=self.pricelistImportRecord) else: # Elaborazione del file try: # Importa il listino self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, self.message_title, 'Importazione completata', record=self.pricelistImportRecord) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = "Errore alla linea %s" % ( str(self.processed_lines) + "\nDettaglio:\n\n" + str(e)) if DEBUG: # Debug _logger.debug(message) pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.pricelistImportRecord)
def run(self): # Recupera il record dal database self.filedata_obj = self.pool['invoice.import'] self.invoiceImportRecord = self.filedata_obj.browse(self.cr, self.uid, self.invoiceImportID, context=self.context) self.file_name = self.invoiceImportRecord.file_name.split('\\')[-1] self.partner_id = self.invoiceImportRecord.partner_id self.date_invoice = self.invoiceImportRecord.date_invoice self.origin = self.invoiceImportRecord.origin or '' self.journal_id = self.invoiceImportRecord.journal_id self.location_id = self.invoiceImportRecord.location_id self.update_price = self.invoiceImportRecord.update_price self.account_id = self.invoiceImportRecord.account_id self.type = self.invoiceImportRecord.type self.format = self.invoiceImportRecord.format # =================================================== Config = getattr(settings, self.invoiceImportRecord.format) self.HEADER = Config.HEADER_INVOICE_ITEM self.REQUIRED = Config.REQUIRED_INVOICE_ITEM if not len(self.HEADER) == len(Config.COLUMNS_INVOICE_ITEM.split(',')): pprint(zip(self.HEADER, Config.COLUMNS_INVOICE_ITEM.split(','))) raise orm.except_orm('Error: wrong configuration!', 'The length of columns and headers must be the same') self.RecordSales = namedtuple('RecordSales', Config.COLUMNS_INVOICE_ITEM) # =================================================== table, self.numberOfLines = import_sheet(self.file_name, self.invoiceImportRecord.content_text) if DEBUG: # Importa il file self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, self.message_title, 'Importazione completata', record=self.invoiceImportRecord) else: # Elaborazione del file try: # Importa il sale order self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, self.message_title, 'Importazione completata', record=self.invoiceImportRecord) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = "Errore alla linea %s" % self.processed_lines + "\nDettaglio:\n\n" + str(e) if DEBUG: ### Debug _logger.debug(message) pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.invoiceImportRecord)
def run(self): # Recupera il record dal database self.filedata_obj = self.pool['product.import'] self.productImportRecord = self.filedata_obj.browse(self.cr, self.uid, self.productImportID, context=self.context) self.file_name = self.productImportRecord.file_name.split('\\')[-1] self.update_product_name = self.productImportRecord.update_product_name # =================================================== Config = getattr(settings, self.productImportRecord.format) self.HEADER = Config.HEADER_PRODUCT self.REQUIRED = Config.REQUIRED_PRODUCT self.PRODUCT_SEARCH = Config.PRODUCT_SEARCH self.PRODUCT_WARNINGS = Config.PRODUCT_WARNINGS self.PRODUCT_ERRORS = Config.PRODUCT_ERRORS # Default values self.PRODUCT_DEFAULTS = Config.PRODUCT_DEFAULTS if not len(self.HEADER) == len(Config.COLUMNS_PRODUCT.split(',')): pprint(zip(self.HEADER, Config.COLUMNS_PRODUCT.split(','))) raise orm.except_orm('Error: wrong configuration!', 'The length of columns and headers must be the same') self.RecordProduct = namedtuple('RecordProduct', Config.COLUMNS_PRODUCT) # =================================================== table, self.numberOfLines = import_sheet(self.file_name, self.productImportRecord.content_text) if DEBUG: # Importa il listino self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, self.message_title, 'Importazione completata', record=self.productImportRecord) else: # Elaborazione del listino prezzi try: # Importa il listino self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, self.message_title, 'Importazione completata', record=self.productImportRecord) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = "Errore alla linea %s" % self.processed_lines + "\nDettaglio:\n\n" + str(e) if DEBUG: ### Debug _logger.debug(message) pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.productImportRecord)
def run(self): # Recupera il record dal database self.filedata_obj = self.pool['sales.import'] self.salesImportRecord = self.filedata_obj.browse(self.cr, self.uid, self.salesImportID, context=self.context) self.file_name = self.salesImportRecord.file_name.split('\\')[-1] self.partner_id = self.salesImportRecord.partner_id self.date_order = self.salesImportRecord.date_order self.origin = self.salesImportRecord.origin or '' self.shop_id = self.salesImportRecord.shop_id self.location_id = self.salesImportRecord.location_id self.auto_approve = self.salesImportRecord.auto_approve self.update_price = self.salesImportRecord.update_price # =================================================== Config = getattr(settings, self.salesImportRecord.format) self.HEADER = Config.HEADER_SALES_ITEM self.REQUIRED = Config.REQUIRED_SALES_ITEM if not len(self.HEADER) == len(Config.COLUMNS_SALES_ITEM.split(',')): pprint(zip(self.HEADER, Config.COLUMNS_SALES_ITEM.split(','))) raise orm.except_orm('Error: wrong configuration!', 'The length of columns and headers must be the same') self.RecordSales = namedtuple('RecordSales', Config.COLUMNS_SALES_ITEM) # =================================================== table, self.numberOfLines = import_sheet(self.file_name, self.salesImportRecord.content_text) if DEBUG: # Importa il file self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, self.message_title, 'Importazione completata', record=self.salesImportRecord) else: # Elaborazione del file try: # Importa il sale order self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, self.message_title, 'Importazione completata', record=self.salesImportRecord) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = "Errore alla linea %s" % str(self.processed_lines) + "\nDettaglio:\n\n" + str(e) if DEBUG: ### Debug _logger.debug(message) pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.salesImportRecord)
def run(self): self.setup() try: table, self.numberOfLines = import_sheet( self.file_name, self.statementLineImportRecord.content_text) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = 'Import failed' message = "Errore nell'importazione del file %s" % self.file_name + "\nDettaglio:\n\n" + str( e) if DEBUG: # Debug _logger.debug(message) pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.statementLineImportRecord) try: # Import account_bank_statement self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, 'Importazione Bank Statement', record=self.statementLineImportRecord) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = u"Errore alla linea %s" % str( self.processed_lines) + "\nDettaglio:\n\n" + str(e) if DEBUG: raise e self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.statementLineImportRecord)
def run(self): self.setup() try: table, self.numberOfLines = import_sheet(self.file_name, self.partnerImportRecord.content_text) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = "Errore nell'importazione del file %s" % self.file_name + "\nDettaglio:\n\n" + str(e) if DEBUG: ### Debug _logger.debug(message) pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.productImportRecord) if DEBUG: # Importa i partner # self.process(self.cr, self.uid, sheet, book.datemode) self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, 'Importazione partner', record=self.partnerImportRecord) else: # Elaborazione del Partner try: # Import partner # self.process(self.cr, self.uid, sheet, book.datemode) self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, 'Importazione partner', record=self.partnerImportRecord) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = u"Errore alla linea %s" % str(self.processed_lines) + "\nDettaglio:\n\n" + str(e) if DEBUG: ### Debug print message pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.partnerImportRecord)
def run(self): self.setup() try: table, self.numberOfLines = import_sheet(self.file_name, self.productImportRecord.content_text) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = "Errore nell'importazione del file %s" % self.file_name + "\nDettaglio:\n\n" + str(e) if DEBUG: ### Debug _logger.debug(message) pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.productImportRecord) if DEBUG: # Importa il listino self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, self.message_title, 'Importazione completata', record=self.productImportRecord) else: # Elaborazione del listino prezzi try: # Importa il listino self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, self.message_title, 'Importazione completata', record=self.productImportRecord) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = "Errore alla linea %s" % str(self.processed_lines) + "\nDettaglio:\n\n" + str(e) if DEBUG: ### Debug _logger.debug(message) pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.productImportRecord)
def run(self): self.setup() try: table, self.numberOfLines = import_sheet(self.file_name, self.statementLineImportRecord.content_text) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = 'Import failed' message = "Errore nell'importazione del file %s" % self.file_name + "\nDettaglio:\n\n" + str(e) if DEBUG: # Debug _logger.debug(message) pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.statementLineImportRecord) try: # Import account_bank_statement self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, 'Importazione Bank Statement', record=self.statementLineImportRecord) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = u"Errore alla linea %s" % str(self.processed_lines) + "\nDettaglio:\n\n" + str(e) if DEBUG: raise e self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.statementLineImportRecord)
def run(self): # Recupera il record dal database self.filedata_obj = self.pool['inventory.import'] self.productImportRecord = self.filedata_obj.browse(self.cr, self.uid, self.productImportID, context=self.context) self.file_name = self.productImportRecord.file_name.split('\\')[-1] self.date = self.productImportRecord.date self.location_id = self.productImportRecord.location_id # =================================================== Config = getattr(settings, self.productImportRecord.format) self.HEADER = Config.HEADER_INVENTORY_ITEM self.REQUIRED_INVENTORY_ITEM = Config.REQUIRED_INVENTORY_ITEM self.PRODUCT_SEARCH = Config.INVENTORY_PRODUCT_SEARCH # Default values if not len(self.HEADER) == len(Config.COLUMNS_INVENTORY_ITEM.split(',')): pprint(zip(self.HEADER, Config.COLUMNS_INVENTORY_ITEM.split(','))) raise orm.except_orm('Error: wrong configuration!', 'The length of columns and headers must be the same') self.RecordProduct = namedtuple('RecordProduct', Config.COLUMNS_INVENTORY_ITEM) # =================================================== try: table, self.numberOfLines = import_sheet(self.file_name, self.productImportRecord.content_text) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = "Errore nell'importazione del file %s" % self.file_name + "\nDettaglio:\n\n" + str(e) if DEBUG: ### Debug _logger.debug(message) pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.productImportRecord) if DEBUG: # Importa inventario self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, self.message_title, 'Importazione completata', record=self.productImportRecord) else: # Elaborazione dell'inventario try: # Importa il listino self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, self.message_title, 'Importazione completata', record=self.productImportRecord) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = "Errore alla linea %s" % str(self.processed_lines) + "\nDettaglio:\n\n" + str(e) if DEBUG: ### Debug _logger.debug(message) pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.productImportRecord)
def run(self): # Recupera il record dal database self.filedata_obj = self.pool['pricelist.import'] self.pricelistImportRecord = self.filedata_obj.browse( self.cr, self.uid, self.pricelistImportID, context=self.context ) self.format = self.pricelistImportRecord.format self.partner_id = self.pricelistImportRecord.partner_id self.file_name = self.pricelistImportRecord.file_name.split('\\')[-1] self.pricelist_id = self.pricelistImportRecord.pricelist_id Config = getattr(settings, self.pricelistImportRecord.format) self.HEADER = Config.HEADER_PRICELIST_ITEM self.REQUIRED = Config.REQUIRED_PRICELIST_ITEM self.RecordPriceListItem = namedtuple( 'RecordPriceListItem', Config.COLUMNS_PRICELIST_ITEM ) table, self.numberOfLines = import_sheet( self.file_name, self.pricelistImportRecord.content_text ) if DEBUG: # Importa il file self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result( self.cr, self.uid, self.message_title, 'Importazione completata', record=self.pricelistImportRecord ) else: # Elaborazione del file try: # Importa il listino self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result( self.cr, self.uid, self.message_title, 'Importazione completata', record=self.pricelistImportRecord ) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = "Errore nell'importazione del file %s" % self.file_name + "\nDettaglio:\n\n" + str(e) if DEBUG: # Debug _logger.debug(message) pdb.set_trace() self.notify_import_result( self.cr, self.uid, title, message, error=True, record=self.pricelistImportRecord )
def run(self): # Recupera il record dal database self.filedata_obj = self.pool['partner.import'] self.partnerImportRecord = self.filedata_obj.browse(self.cr, self.uid, self.partnerImportID, context=self.context) self.file_name = self.partnerImportRecord.file_name.split('\\')[-1] self.strict = self.partnerImportRecord.strict self.UPDATE_ON_CODE = self.partnerImportRecord.update_on_code self.partner_template_id = self.partnerImportRecord.partner_template_id #=================================================== Config = getattr(settings, self.partnerImportRecord.format) self.FORMAT = self.partnerImportRecord.format self.HEADER = Config.HEADER_CUSTOMER self.REQUIRED = Config.REQUIRED self.PARTNER_SEARCH = Config.PARTNER_SEARCH self.ADDRESS_TYPE = Config.ADDRESS_TYPE self.PARTNER_UNIQUE_OFFICE_CODE = Config.PARTNER_UNIQUE_OFFICE_CODE if not len(self.HEADER) == len(Config.COLUMNS.split(',')): pprint(zip(self.HEADER, Config.COLUMNS.split(','))) raise orm.except_orm('Error: wrong configuration!', 'The length of columns and headers must be the same') self.Record = namedtuple('Record', Config.COLUMNS) #=================================================== self.partner_type = self.partnerImportRecord.partner_type # for encoding in ('utf-8', 'latin-1', 'cp1252'): # try: # book = xlrd.open_workbook(file_contents=self.partnerImportRecord.content_text, encoding_override=encoding) # break # except: # pass # else: # raise orm.except_orm('Error', _('Unknown encoding')) # sheet = [] # sh = book.sheet_by_index(0) # # for rx in range(sh.nrows): # row = [] # for cx in range(sh.ncols): # row.append(sh.cell_value(rowx=rx, colx=cx)) # sheet.append(row) # # self.numberOfLines = sh.nrows try: table, self.numberOfLines = import_sheet(self.file_name, self.partnerImportRecord.content_text) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = "Errore nell'importazione del file %s" % self.file_name + "\nDettaglio:\n\n" + str(e) if DEBUG: ### Debug _logger.debug(message) pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.productImportRecord) if DEBUG: # Importa i partner # self.process(self.cr, self.uid, sheet, book.datemode) self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, 'Importazione partner', record=self.partnerImportRecord) else: # Elaborazione del Partner try: # Import partner # self.process(self.cr, self.uid, sheet, book.datemode) self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, 'Importazione partner', record=self.partnerImportRecord) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = u"Errore alla linea %s" % str(self.processed_lines) + "\nDettaglio:\n\n" + str(e) if DEBUG: ### Debug print message pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.partnerImportRecord)
def run(self): try: # Recupera il record dal database self.filedata_obj = self.pool['picking.import'] self.pickingImportRecord = self.filedata_obj.browse( self.cr, self.uid, self.pickingImportID, context=self.context) self.file_name = self.pickingImportRecord.file_name.split('\\')[-1] self.address_id = self.pickingImportRecord.address_id self.stock_journal_id = self.pickingImportRecord.stock_journal_id self.location_id = self.pickingImportRecord.location_id self.location_dest_id = self.pickingImportRecord.location_dest_id # =================================================== Config = getattr(settings, self.pickingImportRecord.format) self.HEADER = Config.HEADER_PICKING self.REQUIRED = Config.REQUIRED_PICKING if not len(self.HEADER) == len(Config.COLUMNS_PICKING.split(',')): pprint(zip(self.HEADER, Config.COLUMNS_PICKING.split(','))) raise orm.except_orm( 'Error: wrong configuration!', 'The length of columns and headers must be the same') self.RecordPicking = namedtuple('RecordPicking', Config.COLUMNS_PICKING) # =================================================== table, self.numberOfLines = import_sheet( self.file_name, self.pickingImportRecord.content_text) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = "Errore nell'importazione del file %s" % self.file_name + "\nDettaglio:\n\n" + str( e) if DEBUG: ### Debug _logger.debug(message) pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.pickingImportRecord) if DEBUG: # Importa il file self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, self.message_title, 'Importazione completata', record=self.pickingImportRecord) else: # Elaborazione del file try: # Importa il listino self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, self.message_title, 'Importazione completata', record=self.pickingImportRecord) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = "Errore alla linea %s" % str( self.processed_lines) + "\nDettaglio:\n\n" + str(e) if DEBUG: ### Debug _logger.debug(message) pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.pickingImportRecord)
def run(self): # Recupera il record dal database self.filedata_obj = self.pool['crm.import'] self.CrmImportRecord = self.filedata_obj.browse(self.cr, self.uid, self.crmImportID, context=self.context) self.file_name = self.CrmImportRecord.file_name.split('\\')[-1] self.shop_id = self.CrmImportRecord.shop_id # =================================================== Config = getattr(settings, self.CrmImportRecord.format) self.HEADER = Config.HEADER_CRM self.REQUIRED = Config.REQUIRED_CRM self.COLUMNS_CRM = Config.COLUMNS_CRM self.CRM_SEARCH = Config.CRM_SEARCH self.CRM_WARNINGS = Config.CRM_WARNINGS self.CRM_ERRORS = Config.CRM_ERRORS self.FORMAT = self.CrmImportRecord.format # Default values self.CRM_DEFAULTS = Config.CRM_DEFAULTS if not len(self.HEADER) == len(Config.COLUMNS_CRM): pprint(zip(self.HEADER, Config.COLUMNS_CRM)) raise orm.except_orm('Error: wrong configuration!', 'The length of columns and headers must be the same') self.RecordCrm = namedtuple('RecordProduct', Config.COLUMNS_CRM) # =================================================== try: table, self.numberOfLines = import_sheet(self.file_name, self.CrmImportRecord.content_text) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = "Errore nell'importazione del file %s" % self.file_name + "\nDettaglio:\n\n" + str(e) if DEBUG: ### Debug _logger.debug(message) # pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.CrmImportRecord) if DEBUG: # Importa il listino try: self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, self.message_title, 'Importazione completata', record=self.CrmImportRecord) except Exception as e: title = "Import failed" message = "Errore alla linea %s" % self.processed_lines + "\nDettaglio:\n\n" + str(e) else: # Elaborazione del listino prezzi try: # Importa il listino self.process(self.cr, self.uid, table) # Genera il report sull'importazione self.notify_import_result(self.cr, self.uid, self.message_title, 'Importazione completata', record=self.CrmImportRecord) except Exception as e: # Annulla le modifiche fatte self.cr.rollback() self.cr.commit() title = "Import failed" message = "Errore alla linea %s" % self.processed_lines + "\nDettaglio:\n\n" + str(e) if DEBUG: ### Debug _logger.debug(message) # pdb.set_trace() self.notify_import_result(self.cr, self.uid, title, message, error=True, record=self.CrmImportRecord)