[DATE2DATE] fix delta in between date_from and date_to
[burette/remembership.git] / remembership.py
index fcd89fe..ad6438f 100644 (file)
@@ -253,7 +253,7 @@ class account_invoice_line(osv.osv):
                               and context.get('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_to   = date_from + relativedelta(months=+12, days=-1) # TODO: parameterize this delta?
                             date_from = date_from.strftime("%Y-%m-%d")
                             date_to   = date_to  .strftime("%Y-%m-%d")
                         print ("DEV: [remembership] [account_invoice_line] [write] date_from: %s" % str(date_from))
@@ -325,7 +325,8 @@ class account_invoice_line(osv.osv):
                       and context.get('date_from')
                       and datetime.strptime(context.get('date_from'), "%Y-%m-%d")
                       or date.today())
-                    date_to   = date_from + relativedelta(days = +364) # TODO: parameterize this delta?
+                    print("#DEBUG: Date de début - %s" % str(date_from))
+                    date_to   = date_from + relativedelta(months=+12, days=-1) # TODO: parameterize this delta?
                     date_from = date_from.strftime("%Y-%m-%d")
                     date_to   = date_to  .strftime("%Y-%m-%d")
                 print ("DEV: [remembership] [account_invoice_line] [create] date_from: %s" % str(date_from))