X-Git-Url: http://git.cyclocoop.org/?p=burette%2Fremembership.git;a=blobdiff_plain;f=remembership.py;h=849afcf3a3a3f99399fe514cffa4a155b6e902e3;hp=48b1b45a7d1778f3d4d40a6d98fe84777bb46e09;hb=514e61eeeea5e8c2e804726185ead891420460ce;hpb=e2563614ac9e783ec70c77bc495a516e4b41a8db diff --git a/remembership.py b/remembership.py index 48b1b45..849afcf 100644 --- a/remembership.py +++ b/remembership.py @@ -249,7 +249,10 @@ class account_invoice_line(osv.osv): 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")