Ejemplo n.º 1
0
    def __init__(self, **attrs):
        super(DateTime, self).__init__(**attrs)
        self.format = format.get_datetime_format(attrs['type'])

        if attrs['type'] == 'date':
            self.picker_shows_time = False

        self.validator = validators.DateTime(kind=attrs['type'])
Ejemplo n.º 2
0
    def __init__(self, **attrs):
        super(DateTime, self).__init__(**attrs)
        self.format = format.get_datetime_format(attrs['type'])

        if attrs['type'] == 'date':
            self.picker_shows_time = False

        self.validator = validators.DateTime(kind=attrs['type'])
Ejemplo n.º 3
0
 def __init__(self, kind="datetime", *args, **kwargs):
     super(DateTime, self).__init__(*args, **kwargs)
     self.format = format.get_datetime_format(kind)
     self.kind = kind
Ejemplo n.º 4
0
    def __init__(self, model, ids, view, domain=[], context={}, options=None):

        super(ICalendar, self).__init__()

        self.info_fields = []
        self.fields = {}

        self.events = []

        self.colors = {}
        self.color_values = []

        self.calendar_fields = {}
        self.concurrency_info = None

        self.ids = ids
        self.model = model
        self.domain = domain or []
        self.context = context or {}
        self.options = options

        self.date_format = format.get_datetime_format('date')
        self.use_search = (options or None) and options.use_search

        try:
            dt = parse_datetime(options.selected_day)
            self.selected_day = Day(dt.year, dt.month, dt.day)
        except:
            pass

        view_id = view.get('view_id', False)

        dom = xml.dom.minidom.parseString(view['arch'].encode('utf-8'))
        root = dom.childNodes[0]
        attrs = node_attributes(root)

        self.string = attrs.get('string', '')
        self.date_start = attrs.get('date_start')
        self.date_delay = attrs.get('date_delay')
        self.date_stop = attrs.get('date_stop')
        self.color_field = attrs.get('color')
        self.day_length = int(attrs.get('day_length', 24))

        if options and options.mode:
            self.mode = options.mode
        else:
            self.mode = attrs.get('mode') or self.mode or 'month'

        self.info_fields = self.parse(root, view['fields'])

        fields = view['fields']
        fields = fields.keys() + [
            self.date_start, self.date_stop, self.date_delay, self.color_field,
            'state'
        ]

        fields = list(set([x for x in fields if x]))

        self.fields = cache.fields_get(model, fields, rpc.session.context)

        if self.color_field and options and options.colors:
            self.colors = options.colors

        if self.color_field and options and options.color_values:
            self.color_values = options.color_values

        self.calendar_fields['date_start'] = dict(
            name=self.date_start, kind=self.fields[self.date_start]['type'])

        if self.date_delay:
            self.calendar_fields['date_delay'] = dict(
                name=self.date_delay,
                kind=self.fields[self.date_delay]['type'])

        if self.date_stop:
            self.calendar_fields['date_stop'] = dict(
                name=self.date_stop, kind=self.fields[self.date_stop]['type'])

        self.calendar_fields['day_length'] = self.day_length
Ejemplo n.º 5
0
 def export_html(self, fields, result, view_name):
     cherrypy.response.headers['Content-Type'] = 'application/vnd.ms-excel'
     cherrypy.response.headers['Content-Disposition'] = 'attachment; filename="%s_%s.xls"'%(view_name, time.strftime('%Y%m%d'))
     return {'fields': fields, 'result': result, 'title': 'Export %s %s'%(view_name, time.strftime(format.get_datetime_format())), 're': re}
 def __init__(self, kind="datetime", *args, **kwargs):
     super(DateTime, self).__init__(*args, **kwargs)
     self.format = format.get_datetime_format(kind)
     self.kind = kind
Ejemplo n.º 7
0
    def __init__(self, model, ids, view, domain=[], context={}, options=None):

        super(ICalendar, self).__init__()

        self.info_fields = []
        self.fields = {}

        self.events = []

        self.colors = {}
        self.color_values = []

        self.calendar_fields = {}
        self.concurrency_info = None

        self.ids = ids
        self.model = model
        self.domain = domain or []
        self.context = context or {}
        self.options = options

        self.date_format = format.get_datetime_format("date")
        self.use_search = (options or None) and options.use_search

        try:
            dt = parse_datetime(options.selected_day)
            self.selected_day = Day(dt.year, dt.month, dt.day)
        except:
            pass

        view_id = view.get("view_id", False)

        dom = xml.dom.minidom.parseString(view["arch"].encode("utf-8"))
        root = dom.childNodes[0]
        attrs = node_attributes(root)

        self.string = attrs.get("string", "")
        self.date_start = attrs.get("date_start")
        self.date_delay = attrs.get("date_delay")
        self.date_stop = attrs.get("date_stop")
        self.color_field = attrs.get("color")
        self.day_length = int(attrs.get("day_length", 8))

        if options and options.mode:
            self.mode = options.mode
        else:
            self.mode = attrs.get("mode") or self.mode or "month"

        self.info_fields = self.parse(root, view["fields"])

        fields = view["fields"]
        fields = fields.keys() + [self.date_start, self.date_stop, self.date_delay, self.color_field, "state"]

        fields = list(set([x for x in fields if x]))

        self.fields = cache.fields_get(model, fields, rpc.get_session().context)

        if self.color_field and options and options.colors:
            self.colors = options.colors

        if self.color_field and options and options.color_values:
            self.color_values = options.color_values

        self.calendar_fields["date_start"] = dict(name=self.date_start, kind=self.fields[self.date_start]["type"])

        if self.date_delay:
            self.calendar_fields["date_delay"] = dict(name=self.date_delay, kind=self.fields[self.date_delay]["type"])

        if self.date_stop:
            self.calendar_fields["date_stop"] = dict(name=self.date_stop, kind=self.fields[self.date_stop]["type"])

        self.calendar_fields["day_length"] = self.day_length
Ejemplo n.º 8
0
    def __init__(self, model, ids, view, domain=[], context={}, options=None):

        super(ICalendar, self).__init__()

        self.info_fields = []
        self.fields = {}

        self.events = []

        self.colors = {}
        self.color_values = []

        self.calendar_fields = {}
        self.concurrency_info = None

        self.ids = ids
        self.model = model
        self.domain = domain or []
        self.context = context or {}
        self.options = options

        self.date_format = format.get_datetime_format('date')
        self.use_search = (options or None) and options.use_search

        try:
            dt = parse_datetime(options.selected_day)
            self.selected_day = Day(dt.year, dt.month, dt.day)
        except:
            pass

        view_id = view.get('view_id', False)

        dom = xml.dom.minidom.parseString(view['arch'].encode('utf-8'))
        root = dom.childNodes[0]
        attrs = node_attributes(root)

        self.string = attrs.get('string', '')
        self.date_start = attrs.get('date_start')
        self.date_delay = attrs.get('date_delay')
        self.date_stop = attrs.get('date_stop')
        self.color_field = attrs.get('color')
        self.day_length = int(attrs.get('day_length', 24))

        if options and options.mode:
            self.mode = options.mode
        else:
            self.mode = attrs.get('mode') or self.mode or 'month'

        self.info_fields = self.parse(root, view['fields'])

        fields = view['fields']
        fields = fields.keys() + [self.date_start, self.date_stop, self.date_delay, self.color_field, 'state']

        fields = list(set([x for x in fields if x]))

        self.fields = cache.fields_get(model, fields, rpc.session.context)

        if self.color_field and options and options.colors:
            self.colors = options.colors

        if self.color_field and options and options.color_values:
            self.color_values = options.color_values

        self.calendar_fields['date_start'] = dict(name=self.date_start,
                                                  kind=self.fields[self.date_start]['type'])

        if self.date_delay:
            self.calendar_fields['date_delay'] = dict(name=self.date_delay,
                                                      kind=self.fields[self.date_delay]['type'])

        if self.date_stop:
            self.calendar_fields['date_stop'] = dict(name=self.date_stop,
                                                         kind=self.fields[self.date_stop]['type'])

        self.calendar_fields['day_length'] = self.day_length