[FIX]l10n_in_hr_payroll:default category set
authorKhushboo Bhatt (Open ERP) <kbh@tinyerp.com>
Thu, 9 Aug 2012 11:00:10 +0000 (16:30 +0530)
committerKhushboo Bhatt (Open ERP) <kbh@tinyerp.com>
Thu, 9 Aug 2012 11:00:10 +0000 (16:30 +0530)
bzr revid: kbh@tinyerp.com-20120809110010-7v74el735iu6lhe3

addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py
addons/l10n_in_hr_payroll/wizard/hr_salary_employee_bymonth.py

index 27f46d1..7a414b4 100644 (file)
@@ -69,17 +69,14 @@ class report_hr_salary_employee_bymonth(report_sxw.rml_parse):
         return [mnth_name]
 
     def get_salary(self, form, emp_id, emp_salary, total_mnths):
-        categories = form.get('category_id', [])
-        category_ids = []
-        category_ids.append(categories[0])
-
+        categories = form.get('category_id', [])[0]
         self.cr.execute("select to_char(date_to,'mm-yyyy') as to_date ,sum(pl.total) \
                              from hr_payslip_line as pl \
                              left join hr_payslip as p on pl.slip_id = p.id \
                              left join hr_employee as emp on emp.id = p.employee_id \
                              left join resource_resource as r on r.id = emp.resource_id  \
                             where p.state = 'done' and p.employee_id = %s and pl.category_id = %s \
-                            group by r.name, p.date_to,emp.id",(emp_id,tuple(category_ids),))
+                            group by r.name, p.date_to,emp.id",(emp_id,categories,))
         sal = self.cr.fetchall()
         salary = dict(sal)
         total = 0.0
index e939273..9408251 100644 (file)
@@ -34,9 +34,13 @@ class hr_salary_employee_bymonth(osv.osv_memory):
         'category_id': fields.many2one('hr.salary.rule.category', 'Category', required=True),
     }
 
+    def _get_default_category(self, cr, uid, context=None):
+        return self.pool.get('hr.salary.rule.category').search(cr, uid, [('code', '=', 'NET')], context=context)
+
     _defaults = {
          'start_date': lambda *a: time.strftime('%Y-01-01'),
          'end_date': lambda *a: time.strftime('%Y-%m-%d'),
+         'category_id': _get_default_category
     }
 
     def print_report(self, cr, uid, ids, context=None):