diff --git a/tryton/common/date_widget.py b/tryton/common/date_widget.py index 508aebd5bd..6524a6264a 100644 --- a/tryton/common/date_widget.py +++ b/tryton/common/date_widget.py @@ -245,20 +245,20 @@ class ComplexEntry(gtk.HBox): def compute_date(cmd, dt, format): lst = { - '^=(\d+)w$': lambda dt, r: dt + \ - RelativeDateTime(day=0, month=0, weeks=int(r.group(1))), '^=(\d+)d$': lambda dt, r: dt + \ RelativeDateTime(day=int(r.group(1))), '^=(\d+)m$': lambda dt, r: dt + \ - RelativeDateTime(day=0, month=int(r.group(1))), - '^=(2\d\d\d)y$': lambda dt, r: dt + \ + RelativeDateTime(month=int(r.group(1))), + '^=(\d\d)y$': lambda dt, r: dt + \ + RelativeDateTime(year=int(str(dt.year)[:-2] + r.group(1))), + '^=(\d+)y$': lambda dt, r: dt + \ RelativeDateTime(year=int(r.group(1))), '^=(\d+)h$': lambda dt, r: dt + \ RelativeDateTime(hour=int(r.group(1))), '^([\\+-]\d+)h$': lambda dt, r: dt + \ RelativeDateTime(hours=int(r.group(1))), '^([\\+-]\d+)w$': lambda dt, r: dt + \ - RelativeDateTime(days=7 * int(r.group(1))), + RelativeDateTime(weeks=int(r.group(1))), '^([\\+-]\d+)d$': lambda dt, r: dt + \ RelativeDateTime(days=int(r.group(1))), '^([\\+-]\d+)$': lambda dt, r: dt + \ @@ -270,7 +270,7 @@ def compute_date(cmd, dt, format): '^=$': lambda dt,r: now(), '^-$': lambda dt,r: False } - for r,f in lst.items(): + for r, f in lst.items(): groups = re.match(r, cmd) if groups: if not dt: diff --git a/tryton/gui/window/shortcuts.py b/tryton/gui/window/shortcuts.py index dc6056a3c3..10323f2ee7 100644 --- a/tryton/gui/window/shortcuts.py +++ b/tryton/gui/window/shortcuts.py @@ -63,14 +63,14 @@ class Shortcuts(object): Available variables are: h for hours d for days -w for weeks +w for weeks (only with +/-) m for months y for years Examples: "+21d" increase of 21 days the date -"=23w" set the date to the 23th week of the year -"-10m" decrease of 10 months the date'''),) +"=11m" set the date to the 11th month of the year +"-2w" decrease of 2 weeks the date'''),) ] notebook.append_page(self._fill_table(shortcuts), gtk.Label(_('Edition Widgets')))