date_from = member_line.date_from
date_to = member_line.date_to
if line.product_id.membership_date2date:
- date_from = context['date_from'] and datetime.strptime(context['date_from'], "%Y-%m-%d") or date.today()
+ date_from = ('date_from' in context
+ and context['date_from']
+ and datetime.strptime(context['date_from'], "%Y-%m-%d")
+ or date.today())
date_to = date_from + relativedelta(months = +12) # TODO: parameterize this delta?
date_from = date_from.strftime("%Y-%m-%d")
date_to = date_to .strftime("%Y-%m-%d")