Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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?
Could be this (not complete):
start_month=3 number_of_months=7 annual_pay_1=40000 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 pay =  * 12 pay[start_month] = monthly_pay + diff for i in range(start_month+1, start_month+number_of_months): pay[i] = monthly_pay print(pay)
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 12/8/13, 2:42 AM|
|Seen: 1113 times|
|Last updated: 3/16/15, 8:10 AM|