[MERGE] forward port of branch 7.0 up to a7ff110

This commit is contained in:
Christophe Simonis 2015-09-11 16:16:27 +02:00
commit d48aa27cce
2 changed files with 11 additions and 5 deletions

View File

@ -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)

View File

@ -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):