X-Git-Url: https://git.heureux-cyclage.org/?p=burette%2Fremembership.git;a=blobdiff_plain;f=remembership.py;h=b88034f48cea079796643cea69620b6823a72a86;hp=999f8c8add0240399696c4e4cf39194efcdb65f6;hb=7c2f716cce71fba66bc0136ef804fa22eca29a8e;hpb=c6482d69cb97eee19be531276e88b5144ef8376d diff --git a/remembership.py b/remembership.py index 999f8c8..b88034f 100644 --- a/remembership.py +++ b/remembership.py @@ -182,7 +182,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")