I'm relatively new to python and openerp and in my new module, I'm trying to write a function that does this:
monthly_pay = float(int(annual_pay_1 / number_of_months))
annual_pay_2 = monthly_pay * number_of_months
diff = annual_pay_1 - annual_pay_2
jan_pay = monthly_pay + diff
feb_pay = jan_pay + monthly_pay
mar_pay = feb_pay + monthly_pay
apr_pay = mar_pay + monthly_pay
may_pay = apr_pay + monthly_pay
jun_pay = may_pay + monthly_pay
jul_pay = jun_pay + monthly_pay
aug_pay = jul_pay + monthly_pay
sep_pay = aug_pay + monthly_pay
oct_pay = sep_pay + monthly_pay
nov_pay = oct_pay + monthly_pay
dec_pay = nov_pay + monthly_pay
Sometimes, the number or months may not be up to 12. It could be say 8 or 9 for instance and it doesn't necessarily start from january or end in december.
Is this a proper recursion or for loop problem? Whats the best way to write the function to handle this?
↧