diff --git a/odex25_hr/hr_base/models/res_company_ext.py b/odex25_hr/hr_base/models/res_company_ext.py index 6952998e7..0bdcdbd9b 100644 --- a/odex25_hr/hr_base/models/res_company_ext.py +++ b/odex25_hr/hr_base/models/res_company_ext.py @@ -21,8 +21,8 @@ class ResCompanyExt(models.Model): hr_manager_id = fields.Many2one('hr.employee', string='HR Manager') saudi_percentage = fields.Integer(string='Saudi Percentage %') - contract_end_reminder = fields.Integer(string='Contract End Reminder') - contract_trial_reminder = fields.Integer(string='Contract Trial Reminder') + contract_end_reminder = fields.Integer(string='Contract End Reminder',default=60) + contract_trial_reminder = fields.Integer(string='Contract Trial Reminder',default=15) saudi_gosi = fields.Float(string='Saudi Gosi', default=9.75) company_gosi = fields.Float(string='Company Gosi', default=11.75) diff --git a/odex25_hr/hr_base/views/res_company_ext_view.xml b/odex25_hr/hr_base/views/res_company_ext_view.xml index 93760b9e0..e9f05d908 100644 --- a/odex25_hr/hr_base/views/res_company_ext_view.xml +++ b/odex25_hr/hr_base/views/res_company_ext_view.xml @@ -183,7 +183,7 @@ -

Contract And Trial Period Remider

+

Gosi Percentage Deduction %

diff --git a/odex25_hr/hr_contract_custom/__manifest__.py b/odex25_hr/hr_contract_custom/__manifest__.py index 0256708c3..e94dc478b 100644 --- a/odex25_hr/hr_contract_custom/__manifest__.py +++ b/odex25_hr/hr_contract_custom/__manifest__.py @@ -19,5 +19,6 @@ "report/employee_dependents_report_template.xml", "report/payroll_template.xml", "report/probationary_evaluation.xml", + "data/mail_template.xml", ], } diff --git a/odex25_hr/hr_contract_custom/data/mail_template.xml b/odex25_hr/hr_contract_custom/data/mail_template.xml new file mode 100644 index 000000000..8d8c191a6 --- /dev/null +++ b/odex25_hr/hr_contract_custom/data/mail_template.xml @@ -0,0 +1,46 @@ + + + + + Contract Period Expiration Reminder + Contract- ${object.name} Expired End Period On ${object.date_end} + + ${user.company_id.hr_email|safe} + ${object.employee_id.parent_id.user_id.partner_id.email} + + + + Dear,

+
+

The Contract of ${object.employee_id.name} is going to expire on ${object.date_end}. + Please renew the contract or end it before expiry date According the notice period. +
+
+

Best regards,

+ ]]> +
+
+ + + Contract Trial Period Expiration Reminder + Contract- ${object.name} Expired Trial Period On ${object.trial_date_end} + + ${user.company_id.hr_email|safe} + ${object.employee_id.parent_id.user_id.partner_id.email} + + + + Dear ,

+
+

The Contract trial period of ${object.employee_id.name} is going to expire on${object.trial_date_end}. + Please renew the trial contract period or contracting is Done it before expiry date According the notice period.. +
+
+

Best regards,

+ ]]> +
+
+
+
diff --git a/odex25_hr/hr_contract_custom/i18n/ar_001.po b/odex25_hr/hr_contract_custom/i18n/ar_001.po index e9388aefb..a7b8c9858 100644 --- a/odex25_hr/hr_contract_custom/i18n/ar_001.po +++ b/odex25_hr/hr_contract_custom/i18n/ar_001.po @@ -3755,3 +3755,64 @@ msgstr "ترصيد4" #, python-format msgid "Other" msgstr "اخـــرى" + +#. module: hr_contract_custom +#: model:mail.template,subject:hr_contract_custom.email_template_contract_period_expiration_reminder +msgid "Contract- ${object.name} Expired End Period On ${object.date_end}" +msgstr "عقد الموظف رقم- ${object.name} سوف ينتهي بتاريخ ${object.date_end}" + +#. module: hr_contract_custom +#: model:mail.template,subject:hr_contract_custom.email_template_contract_trial_period_expiration_reminder +msgid "Contract- ${object.name} Expired Trial Period On ${object.trial_date_end}" +msgstr "عقد الموظف رقم- ${object.name} سوف تنتهي فترة التجربة بتاريخ ${object.trial_date_end}" + +#. module: hr_contract_custom +#: model:mail.template,body_html:hr_contract_custom.email_template_contract_period_expiration_reminder +msgid "" +"\n" +" \n" +"

Dear,

\n" +"
\n" +"

The Contract of ${object.employee_id.name} is going to expire on ${object.date_end}.\n" +" Please renew the contract or end it before expiry date According the notice period.\n" +"
\n" +"

Best regards,

\n" +" \n" +" " +msgstr "" +" \n" +"

عزيزي,

\n" +"
\n" +"

عقد الموظف ${object.employee_id.name} سوف ينتهي بتاريخ ${object.date_end}.\n" +" يجب تجديد العقد للموظف او إنهاء العقد قبل تاريخ النهاية حسب فترة الاشعار المتفق عليها.\n" +"
\n" +"
\n" +"

تحياتي,

\n" +" \n" +" " + + +#. module: hr_contract_custom +#: model:mail.template,body_html:hr_contract_custom.email_template_contract_trial_period_expiration_reminder +msgid "" +"\n" +" \n" +"

Dear ,

\n" +"
\n" +"

The Contract trial period of ${object.employee_id.name} is going to expire on${object.trial_date_end}.\n" +" Please renew the trial contract period or contracting is Done it before expiry date According the notice period.\n" +"
\n" +"

Best regards,

\n" +" \n" +" " +msgstr "" +" \n" +"

عزيزي,

\n" +"
\n" +"

فترة تجربة عقد الموظف ${object.employee_id.name} سوف تنتهي بتاريخ ${object.trial_date_end}.\n" +" يجب تجديد فترة التجربة او إنهاء العقد قبل تاريخ نهاية فترة التجربة حسب فترة الاشعار المتفق عليها.\n" +"
\n" +"
\n" +"

تحياتي,

\n" +" \n" +" " diff --git a/odex25_hr/hr_contract_custom/models/hr_contract.py b/odex25_hr/hr_contract_custom/models/hr_contract.py index d66bcb64c..2d37b13b6 100644 --- a/odex25_hr/hr_contract_custom/models/hr_contract.py +++ b/odex25_hr/hr_contract_custom/models/hr_contract.py @@ -440,7 +440,7 @@ class Contract(models.Model): def contract_mail_reminder(self): now = dt.now() + timedelta(days=1) date_now = now.date() - match = self.search([('state', '=', 'program_directory')]) + match = self.search([('state', '!=', 'end_contract')]) # trial_days_send_email=5 cont_end_reminder = self.env.user.company_id.contract_end_reminder cont_trial_reminder = self.env.user.company_id.contract_trial_reminder @@ -448,34 +448,14 @@ class Contract(models.Model): if i.date_end: exp_date = fields.Date.from_string(i.date_end) - timedelta(days=cont_end_reminder) if date_now >= exp_date: - mail_content = "Hello ,
The Contract ", i.employee_id.name, "is going to expire on ", \ - str(i.date_end), ". Please renew the Contract or end it before expiry date" - main_content = { - 'subject': _('Contract -%s Expired End Period On %s') % (i.name, i.date_end), - 'author_id': self.env.user.company_id.partner_id.id, - 'body': mail_content, - 'email_to': self.env.user.company_id.email, - 'email_cc': self.env.user.company_id.hr_email, - 'model': self._name, - } - self.env['mail.mail'].create(main_content).send() + self.env.ref('hr_contract_custom.email_template_contract_period_expiration_reminder', False).send_mail(i.id) if i.trial_date_end: exp_date = fields.Date.from_string(i.trial_date_end) exp_date1 = fields.Date.from_string(i.trial_date_end) - timedelta(days=cont_trial_reminder) # if date_now >= exp_date : if exp_date >= date_now and date_now >= exp_date1: - mail_content = "Hello ,
The Contract trial period", i.employee_id.name, "is going to expire on ", \ - str(i.trial_date_end), ".Please renew the trial Contract period or Contracting is Done it before expiry date" - main_content = { - 'subject': _('Contract-%s Expired Trial Period On %s') % (i.name, i.trial_date_end), - 'author_id': self.env.user.company_id.partner_id.id, - 'body': mail_content, - 'email_to': self.env.user.company_id.email, - 'email_cc': self.env.user.company_id.hr_email, - 'model': self._name, - } - self.env['mail.mail'].create(main_content).send() + self.env.ref('hr_contract_custom.email_template_contract_trial_period_expiration_reminder', False).send_mail(i.id) ########################################################################## @api.onchange('contract_duration', 'date_start')