Merge pull request #2883 from expsa/Esraa-Ensan-hr-tasks
payslips edits
This commit is contained in:
commit
b926cc8dd7
|
|
@ -396,6 +396,10 @@ class SalaryRuleInput(models.Model):
|
|||
payslip_date_from = str(payslip.date_from)
|
||||
payslip_date_to = str(payslip.date_to)
|
||||
|
||||
if payslip.payslip_run_id.holiday_start_date and payslip.payslip_run_id.holiday_end_date:
|
||||
payslip_date_from = str(payslip.payslip_run_id.holiday_start_date)
|
||||
payslip_date_to = str(payslip.payslip_run_id.holiday_end_date)
|
||||
|
||||
if holiday.holiday_status_id.payslip_type == 'unpaid':
|
||||
if payslip_date_to >= holiday_date_to and holiday_date_from >= payslip_date_from:
|
||||
payroll_start = datetime.strptime(payslip_date_from, "%Y-%m-%d").date()
|
||||
|
|
@ -544,10 +548,10 @@ class SalaryRuleInput(models.Model):
|
|||
'number_of_hours': holiday.holiday_status_id.percentage,
|
||||
'contract_id': payslip.contract_id.id})]
|
||||
elif holiday.holiday_status_id.payslip_type == 'addition':
|
||||
if payslip.date_from >= holiday.date_from and payslip.date_to >= holiday.date_to:
|
||||
start_date = datetime.strptime(str(payslip.date_from), "%Y-%m-%d").date()
|
||||
end_date = datetime.strptime(str(holiday.date_to), "%Y-%m-%d %H:%M:%S").date() + timedelta(
|
||||
days=1)
|
||||
if payslip_date_from >= holiday_date_from and payslip_date_to >= holiday_date_to:
|
||||
start_date = payslip_date_from
|
||||
end_date = payslip_date_to
|
||||
|
||||
number_of_days = relativedelta(end_date, start_date).days
|
||||
if number_of_days >= 0: # number_of_days <= 0
|
||||
payslip.worked_days_line_ids = [(0, 0, {
|
||||
|
|
@ -558,7 +562,7 @@ class SalaryRuleInput(models.Model):
|
|||
'number_of_days': number_of_days,
|
||||
'number_of_hours': 0.0,
|
||||
'contract_id': payslip.contract_id.id})]
|
||||
elif payslip.date_to >= holiday.date_to and holiday.date_from >= payslip.date_from:
|
||||
elif payslip_date_to >= holiday_date_to and holiday_date_from >= payslip_date_from:
|
||||
if holiday.number_of_days_temp >= 0: # holiday.number_of_days_temp <= 0
|
||||
payslip.worked_days_line_ids = [(0, 0, {
|
||||
'name': "Additional Paid Holidays",
|
||||
|
|
@ -568,9 +572,9 @@ class SalaryRuleInput(models.Model):
|
|||
'number_of_days': holiday.number_of_days_temp,
|
||||
'number_of_hours': 0.0,
|
||||
'contract_id': payslip.contract_id.id})]
|
||||
elif holiday.date_from >= payslip.date_from and payslip.date_to <= holiday.date_to:
|
||||
start_date = datetime.strptime(str(holiday.date_from), "%Y-%m-%d %H:%M:%S").date()
|
||||
end_date = datetime.strptime(str(payslip.date_to), "%Y-%m-%d").date()
|
||||
elif holiday_date_from >= payslip_date_from and payslip_date_to <= holiday_date_to:
|
||||
start_date = payslip_date_from
|
||||
end_date = payslip_date_to
|
||||
number_of_days = relativedelta(end_date, start_date).days + 1
|
||||
if number_of_days >= 0: # number_of_days <= 0
|
||||
payslip.worked_days_line_ids = [(0, 0, {
|
||||
|
|
@ -582,10 +586,9 @@ class SalaryRuleInput(models.Model):
|
|||
'number_of_hours': 0.0,
|
||||
'contract_id': payslip.contract_id.id})]
|
||||
else:
|
||||
if payslip.date_to <= holiday.date_to:
|
||||
start_date = datetime.strptime(str(payslip.date_from), "%Y-%m-%d").date()
|
||||
end_date = datetime.strptime(str(payslip.date_to), "%Y-%m-%d").date() + timedelta(
|
||||
days=1)
|
||||
if payslip_date_to <= holiday_date_to:
|
||||
start_date = payslip_date_from
|
||||
end_date = payslip_date_to
|
||||
number_of_days = relativedelta(end_date, start_date).days
|
||||
if number_of_days >= 0: # number_of_days <= 0
|
||||
payslip.worked_days_line_ids = [(0, 0, {
|
||||
|
|
@ -680,12 +683,12 @@ class SalaryRuleInput(models.Model):
|
|||
elif holiday.holiday_status_id.payslip_type == 'exclusion' or (
|
||||
holiday.holiday_status_id.payslip_type == 'reconcile' and holiday.reconcile_leave is True):
|
||||
|
||||
start_holiday = datetime.strptime(str(holiday.date_from), "%Y-%m-%d %H:%M:%S").date()
|
||||
end_holiday = datetime.strptime(str(holiday.date_to), "%Y-%m-%d %H:%M:%S").date()
|
||||
payroll_start = datetime.strptime(str(payslip.date_from), "%Y-%m-%d").date()
|
||||
pyroll_end = datetime.strptime(str(payslip.date_to), "%Y-%m-%d").date()
|
||||
start_holiday = datetime.strptime(str(holiday_date_from), "%Y-%m-%d %H:%M:%S").date()
|
||||
end_holiday = datetime.strptime(str(holiday_date_to), "%Y-%m-%d %H:%M:%S").date()
|
||||
payroll_start = datetime.strptime(str(payslip_date_from), "%Y-%m-%d").date()
|
||||
pyroll_end = datetime.strptime(str(payslip_date_to), "%Y-%m-%d").date()
|
||||
|
||||
if payslip.date_from >= start_holiday and payslip.date_to >= end_holiday and end_holiday >= payslip.date_from:
|
||||
if payslip.date_from >= start_holiday and payslip_date_to >= end_holiday and end_holiday >= payslip_date_from:
|
||||
pyroll_days = relativedelta(pyroll_end, payroll_start).days + 1
|
||||
number_of_days = relativedelta(end_holiday, payroll_start).days+ 1
|
||||
if pyroll_days == 28:
|
||||
|
|
@ -2171,6 +2174,8 @@ class HrPayslipLine(models.Model):
|
|||
line.slip_id.total_allowances = 0.0
|
||||
line.slip_id.total_deductions = 0.0
|
||||
total_days_after_holiday = total_days - work_days
|
||||
total_days = total_days_after_holiday
|
||||
|
||||
else:
|
||||
total_days_after_holiday = 30 - work_days
|
||||
total_days = total_days_after_holiday
|
||||
|
|
@ -2187,6 +2192,8 @@ class HrPayslipLine(models.Model):
|
|||
line.slip_id.total_allowances = 0.0
|
||||
line.slip_id.total_deductions = 0.0
|
||||
total_days_after_holiday = total_days - work_days
|
||||
total_days = total_days_after_holiday
|
||||
|
||||
else:
|
||||
total_days_after_holiday = 30 - work_days
|
||||
total_days = total_days_after_holiday
|
||||
|
|
@ -2205,6 +2212,8 @@ class HrPayslipLine(models.Model):
|
|||
line.slip_id.total_allowances = 0.0
|
||||
line.slip_id.total_deductions = 0.0
|
||||
total_days_after_holiday = total_days - work_days
|
||||
total_days = total_days_after_holiday
|
||||
|
||||
|
||||
else:
|
||||
total_days_after_holiday = 30 - work_days
|
||||
|
|
@ -2220,6 +2229,8 @@ class HrPayslipLine(models.Model):
|
|||
line.slip_id.total_allowances = 0.0
|
||||
line.slip_id.total_deductions = 0.0
|
||||
total_days_after_holiday = total_days - work_days
|
||||
total_days = total_days_after_holiday
|
||||
|
||||
else:
|
||||
total_days_after_holiday = 30 - work_days
|
||||
total_days = total_days_after_holiday
|
||||
|
|
@ -2263,6 +2274,9 @@ class HrPayslipRun(models.Model):
|
|||
move_id = fields.Many2one('account.move', string="Move Number")
|
||||
company_id = fields.Many2one('res.company', string='Company', default=lambda self: self.env.company)
|
||||
employee_value_ids = fields.Many2many(comodel_name="hr.employee", compute="_compute_allowed_value_ids")
|
||||
holiday_start_date = fields.Date(string="Holiday Start Date")
|
||||
holiday_end_date = fields.Date(string="Holiday End Date")
|
||||
|
||||
|
||||
@api.onchange('date_start')
|
||||
def check_date_start(self):
|
||||
|
|
|
|||
|
|
@ -160,9 +160,12 @@
|
|||
<xpath expr="//field[@name='credit_note']" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//field[@name='credit_note']" position="before">
|
||||
<field name="salary_scale" domain="[('type', '=', 'scale')]"
|
||||
attrs="{'readonly': [('state','!=','draft')]}" required="1"/>
|
||||
<field name="holiday_start_date"/>
|
||||
<field name="holiday_end_date"/>
|
||||
<field name="journal_id"
|
||||
attrs="{'readonly': [('state','!=','draft')], 'required': [('required_condition','=',True)]}"/>
|
||||
<field name="move_id" readonly="1" attrs="{'invisible': [('required_condition','=',False)]}"/>
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ class HrEmployee(models.Model):
|
|||
], 'Certificate Level', default='other', groups="base.group_user", tracking=True)
|
||||
children = fields.Integer(string='Number of Children', groups="base.group_user", tracking=True)
|
||||
branch_name = fields.Many2one(related='department_id.branch_name', store=True, string="Branch Name")
|
||||
attendance_zone_id = fields.Many2one('attendance.zone', string='Attendance Zone')
|
||||
attendance_zone_id = fields.Many2many('attendance.zone', string='Attendance Zone')
|
||||
|
||||
|
||||
'''employee_cars_count = fields.Integer(compute="_compute_employee_cars_count", string="Cars",
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@
|
|||
attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<!-- <field name="barcode" string="Attendance ID" attrs="{'readonly':[('state','!=','draft')]}"/> -->
|
||||
<field name="resource_calendar_id" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="attendance_zone_id"/>
|
||||
<field name="attendance_zone_id" widget="many2many_tags"/>
|
||||
<field name="active" string="Active" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
</group>
|
||||
</xpath>
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class HrHolidaysStatus(models.Model):
|
|||
('exclusion', _('Exclusion'))], string='Payslip Type',tracking=True)
|
||||
percentage = fields.Float(string='Percentage')
|
||||
salary_rules_ids = fields.Many2many('hr.salary.rule', string='Rules',
|
||||
domain="[('special','!=',True),('rules_type','in',('salary','house'))]")
|
||||
domain="[('special','!=',True))]")
|
||||
leave_annual_type = fields.Selection(
|
||||
selection=[('open_balance', _('Opening Balance')), ('save_annual_year', _('Save Annual'))],
|
||||
string='Annual Type', default='open_balance',tracking=True)
|
||||
|
|
|
|||
Loading…
Reference in New Issue