change sum edit

This commit is contained in:
mohammed-alkhazrji 2025-05-22 00:14:19 +03:00
parent a54b3ceb4b
commit 6a50a820a9
3 changed files with 19 additions and 24 deletions

View File

@ -164,7 +164,7 @@ msgstr "ساعات "
#: model_terms:ir.ui.view,arch_db:attendances.employee_lateness_absense_overtime_form_view
#, python-format
msgid "Absent Hours By HR"
msgstr "إستثناء ساعات الغياب"
msgstr "إستثناء الساعات "
#. module: attendances
#: code:addons/attendances/wizard/attendances_report_wiz.py:0
@ -1747,7 +1747,7 @@ msgstr ""
#. module: attendances
#: model_terms:ir.ui.view,arch_db:attendances.employee_lateness_absense_overtime_form_view
msgid "Send Email"
msgstr "إرسال إيميل"
msgstr "إرسال بريد إلكتروني"
#. module: attendances
#: model:ir.model.fields,field_description:attendances.field_hr_attendance_report__send_email
@ -2036,7 +2036,7 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:attendances.employee_lateness_absense_overtime_form_view
#, python-format
msgid "Total Absence Hours"
msgstr "مجموع ساعات الغياب"
msgstr "مجموع الساعات "
#. module: attendances
#: code:addons/attendances/wizard/attendances_report_wiz.py:0
@ -2048,7 +2048,7 @@ msgstr "اجمالي الغياب"
#. module: attendances
#: model:ir.model.fields,field_description:attendances.field_hr_attendance_transaction__total_absent_hours
msgid "Total Absent Hours"
msgstr "مجموع ساعات الغياب"
msgstr "مجموع الساعات "
#. module: attendances
#: model:ir.model.fields,field_description:attendances.field_hr_attendance_report_line__total_deduction

View File

@ -40,19 +40,10 @@ class HrAttendanceReport(models.Model):
compute='_compute_available_employees',
store=False
)
selected_lines = fields.One2many(
'hr.attendance.report.line',
compute='_compute_selected_lines',
string="Selected Employees Lines"
)
send_email = fields.Boolean(string=" Is Send Email", default=False,store=True)
@api.depends('selected_employee_ids', 'line_ids','department_ids')
def _compute_selected_lines(self):
for report in self:
lines = report.line_ids.filtered(lambda line: line.employee_name.id in report.selected_employee_ids.ids)
report.selected_lines = lines
@api.onchange('department_ids')
def _compute_available_employees(self):
@ -60,7 +51,8 @@ class HrAttendanceReport(models.Model):
if report.department_ids:
employees = self.env['hr.employee'].search([
('department_id', 'in', report.department_ids.ids),
('finger_print', '=', True)
('finger_print', '=', True),
('state', '=', 'open')
])
report.available_employee_ids = employees
else:
@ -404,8 +396,13 @@ class HrAttendanceReport(models.Model):
template = self._get_email_template()
sent_count = 0
for line in self.line_ids:
if not line.employee_name or not line.employee_name.work_email:
if (
not line.employee_name or
not line.employee_name.work_email or
line.total_deduction <= 0
):
continue
template.with_context(
email_to=line.employee_name.work_email,
employee_name=line.employee_name.name,
@ -414,6 +411,8 @@ class HrAttendanceReport(models.Model):
).send_mail(line.id, force_send=True)
sent_count += 1
self.send_email = True
return sent_count

View File

@ -117,16 +117,12 @@
<field name="selected_employee_ids"
widget="many2many"
domain="[('id', 'in', available_employee_ids)]"
string="اختر الموظفين"
string="Select Employee"
context="{'search_default_available_employees': True}"
options="{'no_create': True}"
>
<tree editable="top">
<field name="name"/>
<field name="company_id" invisible="1"/>
<field name="department_id"/>
</tree>
</field>
/>