[MERGE] [FIX] base_calendar: when computing the reccurency of an event, skip if no recurrency period is set (opw 598737)

Fix the calendar view so that the recurrency period is editable when checking the 'recurrency' checkbox

bzr revid: mat@openerp.com-20140307153610-seud49l3oh1nq836
This commit is contained in:
Martin Trigaux
2014-03-07 16:36:10 +01:00
2 changed files with 5 additions and 3 deletions
+4 -1
View File
@@ -1626,6 +1626,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
def _set_recurrency_end_date(self, data, context=None):
end_date = data.get('end_date')
rel_date = False
if data.get('recurrency') and data.get('end_type') in ('count', unicode('count')):
data_date_deadline = datetime.strptime(data.get('date_deadline'), '%Y-%m-%d %H:%M:%S')
if data.get('rrule_type') in ('daily', unicode('count')):
@@ -1636,7 +1637,9 @@ rule or repeating pattern of time to exclude from the recurring rule."),
rel_date = relativedelta(months=data.get('count')+1)
elif data.get('rrule_type') in ('yearly', unicode('yearly')):
rel_date = relativedelta(years=data.get('count')+1)
end_date = data_date_deadline + rel_date
end_date = data_date_deadline
if rel_date:
end_date += rel_date
return end_date
def create(self, cr, uid, vals, context=None):
+1 -2
View File
@@ -161,8 +161,7 @@
<page string="Recurrency Option" attrs="{'invisible': [('recurrency','=',False)]}">
<group col="4" colspan="4" name="rrule">
<group col="4" colspan="4">
<field name="rrule_type" string="Recurrency period"
attrs="{'readonly':[('recurrent_id','!=',False)]}"/>
<field name="rrule_type" string="Recurrency period" />
<field name="interval"/>
<separator string="End of Recurrence" colspan="4"/>
<field name="end_type"/>