Calendar View breaks if the data contains a date with value close to the lower threshold (i.e. 1900)

Bug #693330 reported by Hery Atmadja
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo GTK Client (MOVED TO GITHUB)
Confirmed
Wishlist
OpenERP sa GTK client R&D

Bug Description

Calendar view of GTK client breaks down when trying to display records that contain a date field with value that is close to the date lowest threshold (1 Jan 1900) (web client tested and worked fine).

The attached screen shot shows the data used for testing.

This bug was shared with Jay(OpenERP) during our technical training (Dec 2010).

The resulting error message from the GTK client is as follow:

Traceback (most recent call last):
  File "/home/heryatmadja/workspace/openerp-training/6.0/trunk/openobject-client/bin/modules/gui/main.py", line 1339, in _sig_child_call
    res = wid.handlers[button_name]()
  File "/home/heryatmadja/workspace/openerp-training/6.0/trunk/openobject-client/bin/modules/gui/window/form.py", line 150, in sig_switch_calendar
    return self.sig_switch(widget, 'calendar')
  File "/home/heryatmadja/workspace/openerp-training/6.0/trunk/openobject-client/bin/modules/gui/window/form.py", line 239, in sig_switch
    self.screen.switch_view(mode=mode)
  File "/home/heryatmadja/workspace/openerp-training/6.0/trunk/openobject-client/bin/widget/screen/screen.py", line 564, in switch_view
    self.current_model.validate_set()
  File "/home/heryatmadja/workspace/openerp-training/6.0/trunk/openobject-client/bin/widget/model/record.py", line 188, in validate_set
    self.reload()
  File "/home/heryatmadja/workspace/openerp-training/6.0/trunk/openobject-client/bin/widget/model/record.py", line 263, in reload
    return self._reload(self.mgroup.mfields.keys() + [CONCURRENCY_CHECK_FIELD])
  File "/home/heryatmadja/workspace/openerp-training/6.0/trunk/openobject-client/bin/widget/model/record.py", line 277, in _reload
    self.set(value)
  File "/home/heryatmadja/workspace/openerp-training/6.0/trunk/openobject-client/bin/widget/model/record.py", line 260, in set
    self.signal('record-changed')
  File "/home/heryatmadja/workspace/openerp-training/6.0/trunk/openobject-client/bin/signal_event.py", line 28, in signal
    fnct(self, signal_data, *data)
  File "/home/heryatmadja/workspace/openerp-training/6.0/trunk/openobject-client/bin/widget/model/group.py", line 310, in _record_changed
    self.signal('model-changed', model)
  File "/home/heryatmadja/workspace/openerp-training/6.0/trunk/openobject-client/bin/signal_event.py", line 28, in signal
    fnct(self, signal_data, *data)
  File "/home/heryatmadja/workspace/openerp-training/6.0/trunk/openobject-client/bin/widget/screen/screen.py", line 443, in _model_changed
    self.display()
  File "/home/heryatmadja/workspace/openerp-training/6.0/trunk/openobject-client/bin/widget/screen/screen.py", line 823, in display
    self.current_view.display()
  File "/home/heryatmadja/workspace/openerp-training/6.0/trunk/openobject-client/bin/widget/view/calendar.py", line 62, in display
    self.view.display(self.screen.models)
  File "/home/heryatmadja/workspace/openerp-training/6.0/trunk/openobject-client/bin/widget/view/calendar_gtk/parser.py", line 333, in display
    self.cal_model.add_events(self.__get_events())
  File "/home/heryatmadja/workspace/openerp-training/6.0/trunk/openobject-client/bin/widget/view/calendar_gtk/parser.py", line 391, in __get_events
    e = self.__get_event(model)
  File "/home/heryatmadja/workspace/openerp-training/6.0/trunk/openobject-client/bin/widget/view/calendar_gtk/parser.py", line 472, in __get_event
    ends= time.localtime(time.mktime(starts)+(h * 60 * 60) + (n * 24 * 60 * 60))
OverflowError: mktime argument out of range

Revision history for this message
Hery Atmadja (heryatmadja) wrote :
description: updated
Changed in openobject-client:
assignee: nobody → OpenERP sa GTK client R&D (openerp-dev-gtk)
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello,
I just faced the similar one.

This looks like a blocking behavior for those who uses records of nostalgic data.(i.e. historical updations).

The problem is, it doesn't skip the CULPRIT one and blocks all other INNOCENT records.

Hope this helps.

Thanks.

Changed in openobject-client:
importance: Wishlist → Low
Revision history for this message
xrg (xrg) wrote : Re: [Bug 693330] Re: Calendar View breaks if the data contains a date with value close to the lower threshold (i.e. 1900)

On Wednesday 22 December 2010, you wrote:
> Hello,
> I just faced the similar one.
>
> This looks like a blocking behavior for those who uses records of
> nostalgic data.(i.e. historical updations).
>
> The problem is, it doesn't skip the CULPRIT one and blocks all other
> INNOCENT records.
>
> Hope this helps.

There is one more test you can do:

We have made a beta branch of the Gtk client, using the updated
SpiffGtkWidgets. It would be interesting to see if this error happens in that
branch, too:

git: http://members.hellug.gr/xrg/repos/openobject-client
("trunk-spiff" branch)

bzr: http://bazaar.launchpad.net/~xrg/openobject-client/trunk-spiff/

Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

hello xrg,

yes, the problem still persists after merging the branch.
but looking at the traceback:

client/bin/widget/view/calendar_gtk/parser.py", line 472, in __get_event
    ends= time.localtime(time.mktime(starts)+(h * 60 * 60) + (n * 24 * 60 * 60))
OverflowError: mktime argument out of range

 It seems the problem is from the time library itself.
it does not accept values range from 1900 as year

Thanks,

Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

we should use datetime:

something like this

from datetime import datetime
epoch = datetime(1900, 1, 1)
t = datetime(1920,1, 1)
diff = t-epoch

Thanks,

Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

I would convert it to wishlist as the calendar needs much improvement in terms of library used in the calculations of the timedeltas. currently the time.mktime is used which does not support date range from 1900. This has to be changed to some reliable datetime library like I suggested in comment #5.

marking it as wishlist for future improvement probable in v6.1

Thanks

Changed in openobject-client:
importance: Low → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.