From a09944e90ffb7235ca62ab4c755b42778c417d00 Mon Sep 17 00:00:00 2001 From: Maksym Yankin Date: Mon, 31 Jan 2022 16:01:30 +0200 Subject: [PATCH] [IMP] sql_export_excel: pylint --- sql_export_excel/models/sql_export.py | 4 +-- sql_export_excel/views/sql_export_view.xml | 37 ++++++++++------------ 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/sql_export_excel/models/sql_export.py b/sql_export_excel/models/sql_export.py index 6165abe48..53cde9f07 100644 --- a/sql_export_excel/models/sql_export.py +++ b/sql_export_excel/models/sql_export.py @@ -93,13 +93,13 @@ class SqlExport(models.Model): sheets = wb.worksheets try: ws = sheets[self.sheet_position - 1] - except IndexError: + except IndexError as err: raise exceptions.ValidationError( _( "The Excel Template file contains less than %s sheets " "Please, adjust the Sheet Position parameter." ) - ) + ) from err row_position = self.row_position or 1 col_position = self.col_position or 1 # Case of excel file creation diff --git a/sql_export_excel/views/sql_export_view.xml b/sql_export_excel/views/sql_export_view.xml index da26c0503..92669eef7 100644 --- a/sql_export_excel/views/sql_export_view.xml +++ b/sql_export_excel/views/sql_export_view.xml @@ -1,7 +1,5 @@ - - - + sql.export @@ -9,28 +7,27 @@ + name="header" + attrs="{'invisible': [('file_format', '=', 'csv')]}" + /> + name="attachment_id" + attrs="{'invisible': [('file_format', '!=', 'excel')]}" + /> + name="sheet_position" + attrs="{'invisible': [('attachment_id', '=', False)]}" + /> + name="row_position" + attrs="{'invisible': [('attachment_id', '=', False)]}" + /> + name="col_position" + attrs="{'invisible': [('attachment_id', '=', False)]}" + /> - - +