← Back to team overview

openerp-india team mailing list archive

[Bug 1274986] [NEW] Contract - recurring invoice not working if YEARS is selected

 

Public bug reported:

Hello,

Re:  trunk (9089) and saas-2(9111)

If you setup a contract with recurring invoices and select to repeat on
a yearly basis it will not work. Will repeat monthly instead or yearly.
Looking at code we observe that "yearly" option in recurring_rule_type
is not handled.

            if contract.recurring_rule_type == 'daily':
                new_date = next_date+relativedelta(days=+interval)
            elif contract.recurring_rule_type == 'weekly':
                new_date = next_date+relativedelta(weeks=+interval)
            else:
                new_date = next_date+relativedelta(months=+interval)

I suggest this change:


+++ account_analytic_analysis/account_analytic_analysis.py	2014-01-31 15:49:05 +0000
@@ -721,8 +721,10 @@
                 new_date = next_date+relativedelta(days=+interval)
             elif contract.recurring_rule_type == 'weekly':
                 new_date = next_date+relativedelta(weeks=+interval)
-            else:
+            elif contract.recurring_rule_type == 'monthly':
                 new_date = next_date+relativedelta(months=+interval)
+            elif contract.recurring_rule_type == 'yearly':
+                new_date = next_date+relativedelta(years=+interval)
             self.write(cr, uid, [contract.id], {'recurring_next_date': new_date.strftime('%Y-%m-%d')}, context=context)
         return True

Please let me know if you need more information

Thank you

** Affects: openobject-addons
     Importance: Undecided
         Status: New


** Tags: contract interval invoice recurring

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1274986

Title:
  Contract - recurring invoice not working if YEARS  is selected

Status in OpenERP Addons (modules):
  New

Bug description:
  Hello,

  Re:  trunk (9089) and saas-2(9111)

  If you setup a contract with recurring invoices and select to repeat
  on a yearly basis it will not work. Will repeat monthly instead or
  yearly. Looking at code we observe that "yearly" option in
  recurring_rule_type is not handled.

              if contract.recurring_rule_type == 'daily':
                  new_date = next_date+relativedelta(days=+interval)
              elif contract.recurring_rule_type == 'weekly':
                  new_date = next_date+relativedelta(weeks=+interval)
              else:
                  new_date = next_date+relativedelta(months=+interval)

  I suggest this change:

  
  +++ account_analytic_analysis/account_analytic_analysis.py	2014-01-31 15:49:05 +0000
  @@ -721,8 +721,10 @@
                   new_date = next_date+relativedelta(days=+interval)
               elif contract.recurring_rule_type == 'weekly':
                   new_date = next_date+relativedelta(weeks=+interval)
  -            else:
  +            elif contract.recurring_rule_type == 'monthly':
                   new_date = next_date+relativedelta(months=+interval)
  +            elif contract.recurring_rule_type == 'yearly':
  +                new_date = next_date+relativedelta(years=+interval)
               self.write(cr, uid, [contract.id], {'recurring_next_date': new_date.strftime('%Y-%m-%d')}, context=context)
           return True

  Please let me know if you need more information

  Thank you

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1274986/+subscriptions


Follow ups

References