[IMP]event:set end_date on the basis of start_date +1h

bzr revid: ssu@tinyerp.com-20121003132314-uptithw82p4pgfhv
This commit is contained in:
Saurang Suthar
2012-10-03 18:53:14 +05:30
parent 2295cbc26d
commit 6ce035da7c
2 changed files with 9 additions and 1 deletions
+8
View File
@@ -19,6 +19,7 @@
#
##############################################################################
from datetime import datetime, timedelta, date
from osv import fields, osv
from tools.translate import _
from openerp import SUPERUSER_ID
@@ -288,6 +289,13 @@ class event_event(osv.osv):
return {'value' : values}
def onchange_start_date(self, cr, uid, ids, date_end, date_begin, context=None):
value = {}
if date_begin:
start = datetime.strptime(date_begin, "%Y-%m-%d %H:%M:%S")
if not date_end or date_end:
date_end = start + timedelta(hours=1.00)
return {'value': {'date_end':date_end.strftime("%Y-%m-%d %H:%M:%S")}}
# ----------------------------------------
# OpenChatter methods and notifications
+1 -1
View File
@@ -134,7 +134,7 @@
</group>
<group>
<field name="type" on_change="onchange_event_type(type,context)"/>
<field name="date_begin"/>
<field name="date_begin" on_change="onchange_start_date(date_end,date_begin,context)"/>
<field name="date_end"/>
</group>
</group>