diff --git a/odex25_hr/employee_requests/models/employee_effective_form.py b/odex25_hr/employee_requests/models/employee_effective_form.py
index 7e23972fb..8f02aef41 100644
--- a/odex25_hr/employee_requests/models/employee_effective_form.py
+++ b/odex25_hr/employee_requests/models/employee_effective_form.py
@@ -44,12 +44,12 @@ class EmployeeEffectiveForm(models.Model):
employee_id = self.env['employee.effective.form'].search([('id', '!=', i.id),('employee_id', '=', i.employee_id.id), ('state', '=', 'done')], limit=1)
if employee_id:
raise exceptions.Warning(_('Sorry, Not possible to request a effective Form more than once'))
- if i.contract_start:
+ if i.contract_start and i.effective_form_date:
if i.effective_form_date < i.contract_start:
raise exceptions.Warning(_('Sorry, The First Hiring Date must be after the Contract Start Date'))
- if i.employee_id.contract_id.state != 'program_directory':
- raise exceptions.Warning(_('Sorry, The Employee Contract Must Be Approved Before Hiring Date'))
+ #if i.employee_id.contract_id.state != 'program_directory':
+ #raise exceptions.Warning(_('Sorry, The Employee Contract Must Be Approved Before Hiring Date'))
if i.employee_id.state != 'open':
raise exceptions.Warning(_('Sorry, The Employee Record Must Be Approved Before Hiring Date'))
diff --git a/odex25_hr/hr_base/views/hr_base_view.xml b/odex25_hr/hr_base/views/hr_base_view.xml
index 371d62c48..7728631b5 100644
--- a/odex25_hr/hr_base/views/hr_base_view.xml
+++ b/odex25_hr/hr_base/views/hr_base_view.xml
@@ -352,8 +352,8 @@
- {'readonly':[('state','!=','draft')]}
-
+ {'readonly':[('state','!=','draft')]}
+ [('employee_ids', '=', False)]
diff --git a/odex25_hr/hr_contract_custom/i18n/ar_001.po b/odex25_hr/hr_contract_custom/i18n/ar_001.po
index cac994207..c904d22f3 100644
--- a/odex25_hr/hr_contract_custom/i18n/ar_001.po
+++ b/odex25_hr/hr_contract_custom/i18n/ar_001.po
@@ -3849,3 +3849,11 @@ msgstr "آخر راتب للتأمينات"
#, python-format
msgid "The Last Salary Gosi After The Age 50 Years."
msgstr "آخر راتب في التأمينات الاجتماعية بعد سن الخمسين"
+
+
+#. module: hr_contract_custom
+#: code:addons/hr_contract_custom/models/hr_contract.py:0
+#: model_terms:ir.ui.view,arch_db:hr_contract_custom.hr_contract_form_view
+#, python-format
+msgid "Effective Form"
+msgstr "مباشرة العمل"
diff --git a/odex25_hr/hr_contract_custom/models/hr_contract.py b/odex25_hr/hr_contract_custom/models/hr_contract.py
index ebc88c7b4..e7538013d 100644
--- a/odex25_hr/hr_contract_custom/models/hr_contract.py
+++ b/odex25_hr/hr_contract_custom/models/hr_contract.py
@@ -667,6 +667,17 @@ class Contract(models.Model):
def program_directory(self):
#self.chick_saudi_percentage()
+ self.employee_id.contract_id = self.id
+ hiring_date = self.employee_id.first_hiring_date
+ effective = self.env['employee.effective.form'].search([('contract_id', '=', self.id)])
+ if not effective and not hiring_date:
+ self.env['employee.effective.form'].create({
+ 'employee_id': self.employee_id.id,
+ 'contract_id': self.id,
+ 'department_id': self.department_id.id,
+ 'contract_start': self.date_start,
+ 'effective_form_date': self.date_start,
+ 'state': 'draft'})
self.state = "program_directory"
def unlink(self):
@@ -684,6 +695,20 @@ class Contract(models.Model):
{'calendar_id': self.working_hours.id})
+ # Smart Button to access effective form
+
+ def action_view_effective_frm(self):
+ effective_id = self.env['employee.effective.form'].search([('employee_id', '=', self.employee_id.id)])
+ return {
+ 'name': _('Employee Effective Form'),
+ 'domain': [('id', '=', effective_id.id)],
+ 'view_mode': 'tree,form',
+ 'res_model': 'employee.effective.form',
+ 'view_id': False,
+ 'type': 'ir.actions.act_window',
+ }
+
+
class VacationDest(models.Model):
_name = 'hr.vacation.dest'
diff --git a/odex25_hr/hr_contract_custom/views/contract_view.xml b/odex25_hr/hr_contract_custom/views/contract_view.xml
index 09ce31565..11401a9c1 100644
--- a/odex25_hr/hr_contract_custom/views/contract_view.xml
+++ b/odex25_hr/hr_contract_custom/views/contract_view.xml
@@ -8,6 +8,14 @@
+
+
+
+
+
+
+