Skip to content

Commit

Permalink
[FIX][report_xls] Protect xlwt import.
Browse files Browse the repository at this point in the history
Given `xlwt` could happen to not be installed because it is an optional dependency.

See odoo/odoo#12897 (comment).
  • Loading branch information
yajo committed Jul 25, 2016
1 parent 8cc6325 commit 2bf93a1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions report_xls/report_xls.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#
##############################################################################

import xlwt
from xlwt.Style import default_style
import cStringIO
from datetime import datetime
from openerp.osv.fields import datetime as datetime_field
Expand All @@ -33,6 +31,12 @@
import logging
_logger = logging.getLogger(__name__)

try:
import xlwt
from xlwt.Style import default_style
except ImportError:
_logger.debug("Cannot import xlwt. This module will not be functional.")


class AttrDict(dict):
def __init__(self, *args, **kwargs):
Expand Down

0 comments on commit 2bf93a1

Please sign in to comment.