fix
This commit is contained in:
parent
2d8b0db792
commit
3de63c2a82
|
|
@ -1126,10 +1126,6 @@ msgstr "رقم الموظف"
|
|||
msgid "Identification Number"
|
||||
msgstr "رقم الهوية"
|
||||
|
||||
#. module: hr_base_reports
|
||||
#: model:ir.model.fields.selection,name:hr_base_reports.selection__employee_cost_report__report_type__iqama
|
||||
msgid "Identity"
|
||||
msgstr ""
|
||||
|
||||
#. module: hr_base_reports
|
||||
#: code:addons/hr_base_reports/report/iqama_report.py:0
|
||||
|
|
@ -1162,11 +1158,17 @@ msgstr "مبلغ القسط"
|
|||
|
||||
#. module: hr_base_reports
|
||||
#: code:addons/hr_base_reports/wizard/overtime_report.py:0
|
||||
#: model_terms:ir.ui.view,arch_db:hr_base_reports.overtime_report
|
||||
#, python-format
|
||||
msgid "Iqama"
|
||||
msgstr "الهوية"
|
||||
|
||||
#. module: hr_base_reports
|
||||
#: model:ir.model.fields.selection,name:hr_base_reports.selection__employee_cost_report__report_type__iqama
|
||||
#: model_terms:ir.ui.view,arch_db:hr_base_reports.overtime_report
|
||||
#, python-format
|
||||
msgid "Identity"
|
||||
msgstr "الهوية"
|
||||
|
||||
#. module: hr_base_reports
|
||||
#: code:addons/hr_base_reports/wizard/overtime_report.py:0
|
||||
#: model:ir.model.fields,field_description:hr_base_reports.field_hr_leave_reports_wizard__job_id
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<th rowspan="2">Sequence</th>
|
||||
<th rowspan="2">Iqama</th>
|
||||
<th rowspan="2">Identity</th>
|
||||
<th rowspan="2">Name</th>
|
||||
<th rowspan="2">Job</th>
|
||||
<th rowspan="2">Salary</th>
|
||||
|
|
@ -83,21 +83,37 @@
|
|||
</td>
|
||||
<td style="width: 1.5in;"><t t-esc="doc['employee_id'].name"/></td>
|
||||
<td><t t-esc="doc['employee_id'].job_id.name"/></td>
|
||||
<td><t t-esc="doc['employee_id'].contract_id.total_allowance"/></td>
|
||||
<td><t t-esc="doc['employee_id'].contract_id.total_allowance" t-esc-options="{'widget': 'float', 'precision': 2}"/></td>
|
||||
<td><t t-esc="doc['daily_hourly_rate']" t-esc-options="{'widget': 'float', 'precision': 2}"/></td>
|
||||
<td><t t-esc="doc['holiday_hourly_rate']" t-esc-options="{'widget': 'float', 'precision': 2}"/></td>
|
||||
<td><t t-esc="doc['over_time_workdays_hours']"/></td>
|
||||
<td><t t-esc="doc['over_time_vacation_hours']"/></td>
|
||||
<td><t t-esc="doc['over_time_workdays_hours'] * doc['daily_hourly_rate']" t-esc-options="{'widget': 'float', 'precision': 2}"/></td>
|
||||
|
||||
<!--td><t t-esc="doc['over_time_workdays_hours'] * doc['daily_hourly_rate']" t-esc-options="{'widget': 'float', 'precision': 2}"/></td>
|
||||
<td><t t-esc="doc['holiday_hourly_rate'] * doc['over_time_vacation_hours']" t-esc-options="{'widget': 'float', 'precision': 2}"/></td>
|
||||
<td><t t-esc="doc['over_time_workdays_hours'] * doc['daily_hourly_rate'] + doc['holiday_hourly_rate'] * doc['over_time_vacation_hours']" t-esc-options="{'widget': 'float', 'precision': 2}"/></td>
|
||||
<td><t t-esc="doc['over_time_workdays_hours'] * doc['daily_hourly_rate'] + doc['holiday_hourly_rate'] * doc['over_time_vacation_hours']" t-esc-options="{'widget': 'float', 'precision': 2}"/></td-->
|
||||
<td><t t-esc="doc['daily_amount']" t-esc-options="{'widget': 'float', 'precision': 2}"/></td>
|
||||
<td><t t-esc="doc['vacation_amount']" t-esc-options="{'widget': 'float', 'precision': 2}"/></td>
|
||||
<td><t t-esc="doc['price_hour']" t-esc-options="{'widget': 'float', 'precision': 2}"/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<t t-set="count" t-value="count+1"/>
|
||||
<t t-set="total_workdays_hours" t-value="total_workdays_hours+doc['over_time_workdays_hours']"/>
|
||||
<t t-set="total_vacation_hours" t-value="total_vacation_hours+doc['over_time_vacation_hours']"/>
|
||||
<t t-set="total_daily_hours" t-value="total_daily_hours + doc['over_time_workdays_hours'] * doc['daily_hourly_rate']" t-esc-options="{'widget': 'float', 'precision': 2}"/>
|
||||
<t t-set="total_holiday_hours" t-value="total_holiday_hours+doc['holiday_hourly_rate'] * doc['over_time_vacation_hours']" t-esc-options="{'widget': 'float', 'precision': 2}"/>
|
||||
|
||||
<!--t t-set="total_workdays_hours" t-value="total_workdays_hours+doc['over_time_workdays_hours']"/>
|
||||
<t t-set="total_vacation_hours" t-value="total_vacation_hours+doc['over_time_vacation_hours']"/-->
|
||||
<t t-set="total_workdays_hours" t-value="total_workdays_hours+doc['daily_amount']"/>
|
||||
<t t-set="total_vacation_hours" t-value="total_vacation_hours+doc['vacation_amount']"/>
|
||||
|
||||
|
||||
<!--t t-set="total_daily_hours" t-value="total_daily_hours + doc['over_time_workdays_hours'] * doc['daily_hourly_rate']" t-esc-options="{'widget': 'float', 'precision': 2}"/>
|
||||
|
||||
<t t-set="total_holiday_hours" t-value="total_holiday_hours+doc['holiday_hourly_rate'] * doc['over_time_vacation_hours']" t-esc-options="{'widget': 'float', 'precision': 2}"/-->
|
||||
<t t-set="total_daily_hours" t-value="total_daily_hours + doc['daily_amount']" t-esc-options="{'widget': 'float', 'precision': 2}"/>
|
||||
|
||||
|
||||
|
||||
<t t-set="total_holiday_hours" t-value="total_holiday_hours + doc['vacation_amount']" t-esc-options="{'widget': 'float', 'precision': 2}"/>
|
||||
|
||||
<t t-set="total" t-value="total + total_daily_hours + total_holiday_hours" t-esc-options="{'widget': 'float', 'precision': 2}"/>
|
||||
</t>
|
||||
<tr style="background-color : #a7c4f2;">
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
from datetime import datetime, date
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
|
||||
class OvertimeReport(models.TransientModel):
|
||||
|
|
@ -17,6 +18,11 @@ class OvertimeReport(models.TransientModel):
|
|||
date_from = fields.Date()
|
||||
date_to = fields.Date()
|
||||
|
||||
@api.onchange('date_from')
|
||||
def check_date_from(self):
|
||||
if self.date_from :
|
||||
self.date_to = fields.Date.from_string(self.date_from)+relativedelta(months=+1, day=1, days=-1)
|
||||
|
||||
@api.onchange('department_ids')
|
||||
def _onchange_department_ids(self):
|
||||
if self.department_ids:
|
||||
|
|
@ -79,12 +85,15 @@ class OvertimeReportView(models.AbstractModel):
|
|||
overtime_place = data['overtime_place']
|
||||
overtime_domain = [('date_from', '>=', date_from), ('date_from', '<=', date_to),
|
||||
('date_to', '<=', date_to), ('date_to', '>=', date_from),
|
||||
('state', 'not in', ['draft', 'cancel']),
|
||||
('state', 'not in', ['draft', 'refused']),
|
||||
('overtime_plase', '=', overtime_place)]
|
||||
for employee in employee_ids:
|
||||
employee_lines = []
|
||||
over_time_workdays_hours = 0
|
||||
over_time_vacation_hours = 0
|
||||
price_hour = 0
|
||||
daily_amount = 0
|
||||
vacation_amount = 0
|
||||
|
||||
for record in self.env['employee.overtime.request'].search(overtime_domain):
|
||||
for line in record.line_ids_over_time.filtered(lambda l: l.employee_id.id == employee):
|
||||
|
|
@ -95,14 +104,21 @@ class OvertimeReportView(models.AbstractModel):
|
|||
holiday_hourly_rate = l[0].holiday_hourly_rate
|
||||
over_time_workdays_hours += l.over_time_workdays_hours
|
||||
over_time_vacation_hours += l.over_time_vacation_hours
|
||||
|
||||
daily_amount += l.over_time_workdays_hours*l.daily_hourly_rate
|
||||
vacation_amount += l.over_time_vacation_hours*l.holiday_hourly_rate
|
||||
price_hour += l.price_hour
|
||||
report_values.append({
|
||||
'employee_id': self.env['hr.employee'].browse(employee),
|
||||
'daily_hourly_rate': daily_hourly_rate,
|
||||
'holiday_hourly_rate': holiday_hourly_rate,
|
||||
'over_time_workdays_hours': over_time_workdays_hours,
|
||||
'over_time_vacation_hours': over_time_vacation_hours,
|
||||
})
|
||||
|
||||
'daily_amount': daily_amount,
|
||||
'vacation_amount': vacation_amount,
|
||||
'price_hour': price_hour,
|
||||
})
|
||||
if len(report_values) == 0:
|
||||
raise ValidationError(_("There is no Data"))
|
||||
|
||||
|
|
@ -177,19 +193,27 @@ class OvertimeReportXls(models.AbstractModel):
|
|||
sheet.write(row, 1, line['employee_id'].iqama_number.iqama_id, format2)
|
||||
sheet.write(row, 2, line['employee_id'].name, format2)
|
||||
sheet.write(row, 3, line['employee_id'].job_id.name, format2)
|
||||
sheet.write(row, 4, line['employee_id'].contract_id.total_allowance, format2)
|
||||
sheet.write(row, 4, "{0:.2f}".format(line['employee_id'].contract_id.total_allowance), format2)
|
||||
sheet.write(row, 5, "{0:.2f}".format(line['daily_hourly_rate']), format2)
|
||||
sheet.write(row, 6, "{0:.2f}".format(line['holiday_hourly_rate']), format2)
|
||||
sheet.write(row, 7, line['over_time_workdays_hours'], format2)
|
||||
sheet.write(row, 8, line['over_time_vacation_hours'], format2)
|
||||
sheet.write(row, 9, line['over_time_workdays_hours'] * line['daily_hourly_rate'], format2)
|
||||
sheet.write(row, 10, line['over_time_vacation_hours'] * line['holiday_hourly_rate'], format2)
|
||||
sheet.write(row, 11, line['over_time_workdays_hours'] * line['daily_hourly_rate'] +
|
||||
line['over_time_vacation_hours'] * line['holiday_hourly_rate'], format2)
|
||||
#sheet.write(row, 9, line['over_time_workdays_hours'] * line['daily_hourly_rate'], format2)
|
||||
#sheet.write(row, 10, line['over_time_vacation_hours'] * line['holiday_hourly_rate'], format2)
|
||||
#sheet.write(row, 11, line['over_time_workdays_hours'] * line['daily_hourly_rate'] +
|
||||
# line['over_time_vacation_hours'] * line['holiday_hourly_rate'], format2)
|
||||
#total_daily_hours += line['over_time_workdays_hours'] * line['daily_hourly_rate']
|
||||
#total_holiday_hours += line['over_time_vacation_hours'] * line['holiday_hourly_rate']
|
||||
#total += line['over_time_workdays_hours'] * line['daily_hourly_rate'] + line['over_time_vacation_hours'] * line['holiday_hourly_rate']
|
||||
|
||||
sheet.write(row, 9, line['daily_amount'], format2)
|
||||
sheet.write(row, 10, line['vacation_amount'], format2)
|
||||
sheet.write(row, 11, line['price_hour'], format2)
|
||||
sequence += 1
|
||||
total_daily_hours += line['over_time_workdays_hours'] * line['daily_hourly_rate']
|
||||
total_holiday_hours += line['over_time_vacation_hours'] * line['holiday_hourly_rate']
|
||||
total += line['over_time_workdays_hours'] * line['daily_hourly_rate'] + line['over_time_vacation_hours'] * line['holiday_hourly_rate']
|
||||
|
||||
total_daily_hours += line['daily_amount']
|
||||
total_holiday_hours += line['vacation_amount']
|
||||
total += line['price_hour']
|
||||
|
||||
row += 1
|
||||
sheet.merge_range(row, 0, row, 8, _("Total"), format2)
|
||||
|
|
|
|||
|
|
@ -1839,7 +1839,6 @@ class HRHolidays(models.Model):
|
|||
|
||||
def delegate_access(self):
|
||||
for rec in self:
|
||||
print("entered hereeeeeee")
|
||||
if not rec.employee_id.user_id: raise exceptions.Warning(
|
||||
_('Kindly set a user for employee %s') % (rec.employee_id.name))
|
||||
if not rec.replace_by.user_id: raise exceptions.Warning(
|
||||
|
|
@ -1890,7 +1889,7 @@ class HRHolidays(models.Model):
|
|||
end_day_holiday = holiday.search([('delegate_acc', '=', True),
|
||||
('date_to', '=', fields.Date.today()),
|
||||
('state', '=', 'validate1')])
|
||||
print("start_day_holiday",start_day_holiday)
|
||||
|
||||
if start_day_holiday:
|
||||
start_day_holiday.delegate_access()
|
||||
if end_day_holiday:
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@
|
|||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids" widget="mail_followers"/>
|
||||
<field name="message_ids" widget="mail_thread"/>
|
||||
</div>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
|||
Loading…
Reference in New Issue