diff --git a/addons/resource/resource.py b/addons/resource/resource.py index 962cad9eb92..af077e4f617 100644 --- a/addons/resource/resource.py +++ b/addons/resource/resource.py @@ -20,6 +20,7 @@ ############################################################################## import datetime +import pytz from dateutil import rrule from dateutil.relativedelta import relativedelta from operator import itemgetter @@ -332,11 +333,14 @@ class resource_calendar(osv.osv): intervals.append((start_dt.replace(hour=default_interval[0]), start_dt.replace(hour=default_interval[1]))) return intervals + tzinfo = fields.datetime.context_timestamp(cr, uid, work_dt, context={}).tzinfo working_intervals = [] for calendar_working_day in self.get_attendances_for_weekdays(cr, uid, id, [start_dt.weekday()], context): + hour_from = work_dt.replace(hour=int(calendar_working_day.hour_from)).replace(tzinfo=tzinfo).astimezone(pytz.UTC).hour + hour_to = work_dt.replace(hour=int(calendar_working_day.hour_to)).replace(tzinfo=tzinfo).astimezone(pytz.UTC).hour working_interval = ( - work_dt.replace(hour=int(calendar_working_day.hour_from)), - work_dt.replace(hour=int(calendar_working_day.hour_to)) + work_dt.replace(hour=int(hour_from)), + work_dt.replace(hour=int(hour_to)) ) working_intervals += self.interval_remove_leaves(working_interval, work_limits) diff --git a/openerp/addons/base/module/module.py b/openerp/addons/base/module/module.py index b045cade0b3..b32b3093ed4 100644 --- a/openerp/addons/base/module/module.py +++ b/openerp/addons/base/module/module.py @@ -47,6 +47,7 @@ from openerp import modules, tools, addons from openerp.modules.db import create_categories from openerp.tools.parse_version import parse_version from openerp.tools.translate import _ +from openerp.tools import html_sanitize from openerp.osv import fields, osv, orm _logger = logging.getLogger(__name__) @@ -164,11 +165,12 @@ class module(osv.osv): for element, attribute, link, pos in html.iterlinks(): if element.get('src') and not '//' in element.get('src') and not 'static/' in element.get('src'): element.set('src', "/%s/static/description/%s" % (module.name, element.get('src'))) - res[module.id] = lxml.html.tostring(html) + res[module.id] = html_sanitize(lxml.html.tostring(html)) else: - overrides = dict(embed_stylesheet=False, doctitle_xform=False, output_encoding='unicode') + overrides = dict(embed_stylesheet=False, doctitle_xform=False, + output_encoding='unicode', xml_declaration=False) output = publish_string(source=module.description, settings_overrides=overrides, writer=MyWriter()) - res[module.id] = output + res[module.id] = html_sanitize(output) return res def _get_latest_version(self, cr, uid, ids, field_name=None, arg=None, context=None):