[FIX] fixed extra_concept function

Merged Brian Misael López requested to merge rr-212 into 12.0-stage
Compare and
1 file
+ 7
6
Preferences
File browser
Compare changes
+ 7
6
@@ -9,7 +9,6 @@ class ExtraConcept(models.TransientModel):
extra_concept_month_date = fields.Date(string='Start Moth')
extra_concept_month_end_date = fields.Date(string='End Moth')
def get_loan_salary_rule(self):
loan_salary_rule = self.env['ir.config_parameter'].sudo().get_param(
'hr_employee_loans.loans_salary_rule_id') or False
@@ -21,11 +20,13 @@ class ExtraConcept(models.TransientModel):
loan_salary_rule_id = self.get_loan_salary_rule()
loan_lines = []
loans = self.env['hr.employee.loans'].search([('state', '=', 'in_progress')])
for loan in loans:
if self.employee_id:
loan_lines.append(loan.employee_loan_ids.filtered(lambda
r: r.employee_id.id == self.employee_id.id and r.start_date <= self.extra_concept_month_date and r.end_date >= self.extra_concept_month_end_date and r.state == 'draft'))
else:
employee_loans = loans.filtered(lambda l: l.employee_id.id == self.employee_id)
if employee_loans:
for sing_loan in employee_loans:
loan_lines.append(sing_loan.employee_loan_ids.filtered(lambda
r: r.start_date <= self.extra_concept_month_date and r.end_date >= self.extra_concept_month_end_date and r.state == 'draft'))
else:
for loan in loans:
loan_lines.append(loan.employee_loan_ids.filtered(lambda
r: r.start_date <= self.extra_concept_month_date and r.end_date >= self.extra_concept_month_end_date and r.state == 'draft'))
for line in loan_lines: