Skip to content

Commit

Permalink
[MERGE] forward port of branch 7.0 up to a7ff110
Browse files Browse the repository at this point in the history
  • Loading branch information
KangOl committed Sep 11, 2015
2 parents 10e6ad1 + a7ff110 commit d48aa27
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 6 additions & 2 deletions addons/resource/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
##############################################################################

import datetime
import pytz
from dateutil import rrule
from dateutil.relativedelta import relativedelta
from operator import itemgetter
Expand Down Expand Up @@ -332,11 +333,14 @@ def get_working_intervals_of_day(self, cr, uid, id, start_dt=None, end_dt=None,
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)

Expand Down
8 changes: 5 additions & 3 deletions openerp/addons/base/module/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
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__)
Expand Down Expand Up @@ -164,11 +165,12 @@ def _get_desc(self, cr, uid, ids, field_name=None, arg=None, context=None):
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):
Expand Down

0 comments on commit d48aa27

Please sign in to comment.