~openerp-chinese-team/openobject-client/V6

« back to all changes in this revision

Viewing changes to bin/widget/view/form_gtk/calendar.py

  • Committer: Tony Gu
  • Date: 2010-12-19 08:36:20 UTC
  • Revision ID: tony@wonderland-20101219083620-dfo1exweh3h4qk2q
[IMP]temp solution for not able to set date in calendar widget

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
        if str == '':
91
91
            return False
92
92
        try:
93
 
            date1 = DT.strptime(str[:10], self.format)
 
93
            date1 = DT.strptime(str, self.format)
94
94
        except:
95
95
            return False
96
96
 
116
116
        if not value:
117
117
            self.entry.clear()
118
118
        else:
119
 
            if len(value)>10:
120
 
                value=value[:10]
121
 
            date=DT.strptime(value[:10], DT_FORMAT)
 
119
            date=DT.strptime(value, DT_FORMAT)
122
120
            t=date.strftime(self.format)
123
121
            if len(t) > self.entry.get_width_chars():
124
122
                self.entry.set_width_chars(len(t))
232
230
        if not dt_val:
233
231
            self.entry.clear()
234
232
        else:
235
 
            t = tools.datetime_util.server_to_local_timestamp(dt_val[:19],
 
233
            t = tools.datetime_util.server_to_local_timestamp(dt_val,
236
234
                    DHM_FORMAT, self.format, tz_offset=timezone)
237
235
            if len(t) > self.entry.get_width_chars():
238
236
                self.entry.set_width_chars(len(t))
321
319
        if str=='':
322
320
            res = False
323
321
        try:
324
 
            t = time.strptime(str[:8], self.format)
 
322
            t = time.strptime(str, self.format)
325
323
        except:
326
324
            return False
327
325
        return time.strftime(HM_FORMAT, t)
345
343
        if not dt_val:
346
344
            self.entry.clear()
347
345
        else:
348
 
            t = tools.datetime_util.server_to_local_timestamp(dt_val[:8], HM_FORMAT,
 
346
            t = tools.datetime_util.server_to_local_timestamp(dt_val, HM_FORMAT,
349
347
                    self.format, tz_offset=timezone)
350
348
            if len(t) > self.entry.get_width_chars():
351
349
                self.entry.set_width_chars(len(t))