简化打印代码
This commit is contained in:
@@ -128,15 +128,15 @@ class JikimoPrinting(models.AbstractModel):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# 使用正确的格式打印
|
# 使用正确的格式打印
|
||||||
try:
|
# try:
|
||||||
if is_pdf:
|
# if is_pdf:
|
||||||
_logger.info("使用PDF格式打印")
|
# _logger.info("使用PDF格式打印")
|
||||||
printer.print_document(report=None, content=pdf_content, doc_format='pdf')
|
printer.print_document(report=None, content=pdf_content, doc_format='pdf')
|
||||||
else:
|
# else:
|
||||||
_logger.info("使用RAW格式打印")
|
# _logger.info("使用RAW格式打印")
|
||||||
printer.print_document(report=None, content=pdf_content, doc_format='raw')
|
# printer.print_document(report=None, content=pdf_content, doc_format='raw')
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
_logger.error(f"打印时出错: {str(e)}")
|
# _logger.error(f"打印时出错: {str(e)}")
|
||||||
|
|
||||||
# 清理资源
|
# 清理资源
|
||||||
pdf_buffer.close()
|
pdf_buffer.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user