[MERGE] forward port of branch 7.0 up to a7ff110
This commit is contained in:
commit
d48aa27cce
|
@ -20,6 +20,7 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import pytz
|
||||||
from dateutil import rrule
|
from dateutil import rrule
|
||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
from operator import itemgetter
|
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])))
|
intervals.append((start_dt.replace(hour=default_interval[0]), start_dt.replace(hour=default_interval[1])))
|
||||||
return intervals
|
return intervals
|
||||||
|
|
||||||
|
tzinfo = fields.datetime.context_timestamp(cr, uid, work_dt, context={}).tzinfo
|
||||||
working_intervals = []
|
working_intervals = []
|
||||||
for calendar_working_day in self.get_attendances_for_weekdays(cr, uid, id, [start_dt.weekday()], context):
|
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 = (
|
working_interval = (
|
||||||
work_dt.replace(hour=int(calendar_working_day.hour_from)),
|
work_dt.replace(hour=int(hour_from)),
|
||||||
work_dt.replace(hour=int(calendar_working_day.hour_to))
|
work_dt.replace(hour=int(hour_to))
|
||||||
)
|
)
|
||||||
working_intervals += self.interval_remove_leaves(working_interval, work_limits)
|
working_intervals += self.interval_remove_leaves(working_interval, work_limits)
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ from openerp import modules, tools, addons
|
||||||
from openerp.modules.db import create_categories
|
from openerp.modules.db import create_categories
|
||||||
from openerp.tools.parse_version import parse_version
|
from openerp.tools.parse_version import parse_version
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
|
from openerp.tools import html_sanitize
|
||||||
from openerp.osv import fields, osv, orm
|
from openerp.osv import fields, osv, orm
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
@ -164,11 +165,12 @@ class module(osv.osv):
|
||||||
for element, attribute, link, pos in html.iterlinks():
|
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'):
|
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')))
|
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:
|
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())
|
output = publish_string(source=module.description, settings_overrides=overrides, writer=MyWriter())
|
||||||
res[module.id] = output
|
res[module.id] = html_sanitize(output)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _get_latest_version(self, cr, uid, ids, field_name=None, arg=None, context=None):
|
def _get_latest_version(self, cr, uid, ids, field_name=None, arg=None, context=None):
|
||||||
|
|
Loading…
Reference in New Issue