diff --git a/odex25_hr/attendances/security/ir.model.access.csv b/odex25_hr/attendances/security/ir.model.access.csv
index b4dbbef0e..edf887e34 100644
--- a/odex25_hr/attendances/security/ir.model.access.csv
+++ b/odex25_hr/attendances/security/ir.model.access.csv
@@ -20,4 +20,7 @@ access_hr_attendance_wizard_hr,hr_attendance_wizard_hr,model_hr_attendance_wizar
access_employee_attendance_report_hr,employee_attendance_report_hr,model_employee_attendance_report,hr.group_hr_user,1,1,1,0
access_attendance_attendance_admin,attendance_attendance_admin,model_attendance_attendance,base.group_system,1,1,1,1
access_hr_attendance_transaction_admin,hr.attendance.transaction.admin,model_hr_attendance_transaction,base.group_system,1,1,1,1
-access_attendance_special_days_accounting_manager,attendance.special.days.accounting.manager,model_attendance_special_days,hr_base.group_account_manager,1,1,1,1
+access_attendance_special_days_accounting_manager,attendance.special.days.accounting.manager,model_attendance_special_days,hr_base.group_account_manager,1,1,0,0
+access_hr_attendance_transaction_accounting_manager,hr.attendance.transaction.accounting.manager,model_hr_attendance_transaction,hr_base.group_account_manager,1,1,0,0
+access_attendance_attendance_accounting_manager,attendance_attendance_accounting.manager,model_attendance_attendance,hr_base.group_account_manager,1,1,0,0
+access_days_off_accounting_manager,days_off.accounting.manager,model_days_off,hr_base.group_account_manager,1,1,0,0
\ No newline at end of file
diff --git a/odex25_hr/employee_requests/security/ir.model.access.csv b/odex25_hr/employee_requests/security/ir.model.access.csv
index 31dab8c9d..332f94966 100644
--- a/odex25_hr/employee_requests/security/ir.model.access.csv
+++ b/odex25_hr/employee_requests/security/ir.model.access.csv
@@ -21,3 +21,4 @@ access_salary_destination_hr,salary_destination_hr,model_salary_destination,hr.g
access_salary_destination_emp,salary_destination_emp,model_salary_destination,base.group_user,1,0,0,0
access_hr_classification,hr_classification,model_hr_classification,base.group_user,1,1,1,1
+access_hr_personal_permission_accounting_manager,hr.personal.permission.accounting.manager,model_hr_personal_permission,hr_base.group_account_manager,1,1,0,0
diff --git a/odex25_hr/exp_official_mission/models/hr_official_mission.py b/odex25_hr/exp_official_mission/models/hr_official_mission.py
index bd9ffd281..0726da3ad 100644
--- a/odex25_hr/exp_official_mission/models/hr_official_mission.py
+++ b/odex25_hr/exp_official_mission/models/hr_official_mission.py
@@ -569,11 +569,8 @@ class HrOfficialMission(models.Model):
self.employee_ids.write({'status': 'approved'})
self.state = 'depart_manager'
if self.mission_type.approve_by == 'direct_manager':
- self.approve()
-
- def accounting_manager_refused(self):
- for rec in self:
- rec.refused()
+ return self.approve()
+ return self._reset_to_action()
# Refuse For The Direct Manager Only
def direct_manager_refused(self):
@@ -767,6 +764,12 @@ class HrOfficialMission(models.Model):
def refused(self):
self.state = 'refused'
self.reset_emp_work_state()
+
+ def _reset_to_action(self):
+ if self.env.context.get('default_process_type') == 'mission':
+ return self.env.ref('exp_official_mission.employee_official_mission_action').sudo().read()[0]
+ else:
+ return self.env.ref('exp_official_mission.employee_training_action').sudo().read()[0]
def reset_emp_work_state(self):
if self.mission_type.work_state and self.mission_type.duration_type == 'days':
diff --git a/odex25_hr/exp_official_mission/security/ir.model.access.csv b/odex25_hr/exp_official_mission/security/ir.model.access.csv
index 1d7d5ed16..3310bce9e 100644
--- a/odex25_hr/exp_official_mission/security/ir.model.access.csv
+++ b/odex25_hr/exp_official_mission/security/ir.model.access.csv
@@ -16,4 +16,5 @@ access_hr_mission_type_account_hr_user,access_hr_mission_type_account,model_hr_m
access_hr_mission_type_account_emp,access_hr_mission_type_account,model_hr_mission_type_account,base.group_user,1,0,0,0
access_mission_table,access_mission_table,model_mission_table,base.group_user,1,1,1,1
-access_hr_employee_accounting_manager,hr.employee.accounting.manager,hr.model_hr_employee,hr_base.group_account_manager,1,1,0,0
\ No newline at end of file
+access_hr_employee_accounting_manager,hr.employee.accounting.manager,hr.model_hr_employee,hr_base.group_account_manager,1,1,0,0
+access_hr_official_mission_accounting_manager,hr.official.mission.accounting.manager,model_hr_official_mission,hr_base.group_account_manager,1,1,0,0
\ No newline at end of file
diff --git a/odex25_hr/exp_official_mission/security/official_mission_security.xml b/odex25_hr/exp_official_mission/security/official_mission_security.xml
index 87e8fbe6c..fceabbcd6 100644
--- a/odex25_hr/exp_official_mission/security/official_mission_security.xml
+++ b/odex25_hr/exp_official_mission/security/official_mission_security.xml
@@ -24,11 +24,18 @@
eval="[(4, ref('hr_base.group_department_manager')),(4, ref('hr_base.group_division_manager')),]"/>
+
+ Accounting Manager: views missions that needs approval
+
+ ['|',('state','in',['accounting_manager','accounting_manager_final', 'approve', 'refused']),('employee_ids.employee_id.user_id','in',user.ids)]
+
+
+
Allow HR : views missions of all employees
[(1 ,'=', 1)]
-
-
+
+ Accounting Manager: views tickets that needs approval
+
+ ['|',('state','in',['accounting','accounting_final', 'done', 'refuse']),('employee_id.user_id','=',user.id)]
+
+
+
Manager: views tickets requests of its subordinates
diff --git a/odex25_hr/exp_ticket_request/views/hr_ticketing_view.xml b/odex25_hr/exp_ticket_request/views/hr_ticketing_view.xml
index c0214df69..5152d65dd 100644
--- a/odex25_hr/exp_ticket_request/views/hr_ticketing_view.xml
+++ b/odex25_hr/exp_ticket_request/views/hr_ticketing_view.xml
@@ -36,8 +36,20 @@
class="oe_highlight"
groups="hr_base.group_account_manager"/>
-
+
+
+
+
+
+
+
+
+
+ attrs="{'readonly':[('state','!=','accounting_final')],
+ 'required':['&',('cost_of_tickets','>', '0' ),('state','=','accounting_final')]}"/>
diff --git a/odex25_hr/hr_base/security/ir.model.access.csv b/odex25_hr/hr_base/security/ir.model.access.csv
index 460f2472b..5a4bea56d 100644
--- a/odex25_hr/hr_base/security/ir.model.access.csv
+++ b/odex25_hr/hr_base/security/ir.model.access.csv
@@ -78,3 +78,6 @@ access_ir_sequence_group_hr_user,ir_sequence group_hr_user,base.model_ir_sequenc
access_company_document_type_hr_group_user,Access.company_document_type_group_user,model_company_document_type,hr.group_hr_user,1,1,1,1
access_hr_overtim_accounts_hr_user,access_hr_overtim_accounts,model_hr_overtim_accounts,hr.group_hr_user,1,1,1,1
access_hr_overtim_accounts_emp,access_hr_overtim_accounts,model_hr_overtim_accounts,base.group_user,1,0,0,0
+
+access_hr_employee_accounting_manager,access.hr.employee.accounting.manager,hr.model_hr_employee,hr_base.group_account_manager,1,1,0,0
+access_hr_holidays_accounting_manager,access.hr.holidays.accounting.manager,model_hr_holidays,hr_base.group_account_manager,1,1,0,0
\ No newline at end of file
diff --git a/odex25_hr/hr_contract_custom/security/ir.model.access.csv b/odex25_hr/hr_contract_custom/security/ir.model.access.csv
index d0ca9266b..563f097e2 100644
--- a/odex25_hr/hr_contract_custom/security/ir.model.access.csv
+++ b/odex25_hr/hr_contract_custom/security/ir.model.access.csv
@@ -10,3 +10,4 @@ access_contract_extension_emp,access_contract_extension_emp,model_hr_contract_ex
access_hr_re_contract_user,hr.re.contract.user,model_hr_re_contract,hr.group_hr_user,1,1,1,0
access_hr_children_allowance_user,access_hr_children_allowance_user,model_hr_children_allowance,hr.group_hr_user,1,1,1,0
access_hr_vacation_dest_user,access_hr_vacation_dest_user,model_hr_vacation_dest,hr.group_hr_user,1,1,1,0
+access_hr_contract_accounting_manager,hr.contract.accounting.manager,model_hr_contract,hr_base.group_account_manager,1,1,0,0
diff --git a/odex25_hr/hr_government_relations/models/exit_and_return.py b/odex25_hr/hr_government_relations/models/exit_and_return.py
index ee8736a37..c46f68b13 100644
--- a/odex25_hr/hr_government_relations/models/exit_and_return.py
+++ b/odex25_hr/hr_government_relations/models/exit_and_return.py
@@ -110,6 +110,7 @@ class hr_exit_return(models.Model):
def accounting(self):
self.state = 'accounting'
+ return self._reset_to_action()
def financial_manager(self):
self.state = 'accounting_final'
@@ -142,10 +143,15 @@ class hr_exit_return(models.Model):
item.account_move_id = move_id.id
item.state = 'done'
-
+
def refuse(self):
self.state = 'refuse'
+ def _reset_to_action(self):
+ if not self.env.user.has_group('hr_base.group_account_manager'):
+ return
+ return self.env.ref('hr_government_relations.exit_and_return_action').sudo().read()[0]
+
# overrite unlink function
def unlink(self):
for i in self:
diff --git a/odex25_hr/hr_government_relations/models/request_visa.py b/odex25_hr/hr_government_relations/models/request_visa.py
index dda6c831d..bdbcf9a61 100644
--- a/odex25_hr/hr_government_relations/models/request_visa.py
+++ b/odex25_hr/hr_government_relations/models/request_visa.py
@@ -74,6 +74,7 @@ class hr_request_visa(models.Model):
def accounting(self):
self.state = 'accounting'
+ return self._reset_to_action()
def hr_manager(self):
self.state = 'confirm'
@@ -97,19 +98,24 @@ class hr_request_visa(models.Model):
'state': 'draft',
'journal_id': item.account_journal_id.id,
'date': date.today(),
- 'ref': 'Exit and Return',
+ 'ref': 'Ticket Request',
'line_ids': [(0, 0, debit_line_vals), (0, 0, credit_line_vals)]
})
item.account_move_id = move_id.id
self.state = 'done'
-
+
def financial_manager(self):
self.state = 'accounting_final'
def refuse(self):
self.state = 'refuse'
-
+
+ def _reset_to_action(self):
+ if not self.env.user.has_group('hr_base.group_account_manager'):
+ return
+ return self.env.ref('hr_government_relations.request_visa_action').sudo().read()[0]
+
def unlink(self):
for i in self:
if i.state != 'draft':
diff --git a/odex25_hr/hr_government_relations/security/hr_government_relations_security.xml b/odex25_hr/hr_government_relations/security/hr_government_relations_security.xml
index e8120b96b..fbd54182e 100644
--- a/odex25_hr/hr_government_relations/security/hr_government_relations_security.xml
+++ b/odex25_hr/hr_government_relations/security/hr_government_relations_security.xml
@@ -58,6 +58,20 @@
+
+ Accounting Manager: views Exit and Return that needs approval
+
+ ['|',('state','in',['refuse', 'send','accounting_final', 'done']),('employee_id.user_id','=',user.id)]
+
+
+
+
+ Accounting Manager: views Request Visa that needs approval
+
+ ['|',('state','in',['refuse', 'send','accounting_final', 'done']),('employee_id.user_id','=',user.id)]
+
+
+
Manager: views Request Visa of all employee
diff --git a/odex25_hr/hr_government_relations/views/exit_and_return.xml b/odex25_hr/hr_government_relations/views/exit_and_return.xml
index cc194b2cb..56b830c7c 100644
--- a/odex25_hr/hr_government_relations/views/exit_and_return.xml
+++ b/odex25_hr/hr_government_relations/views/exit_and_return.xml
@@ -95,11 +95,11 @@
+ attrs="{'readonly':[('state','!=','accounting_final')],'invisible':[('on_employee_fair','=',True)],
+ 'required':[('state','=','accounting_final'),('on_employee_fair','=',False)]}"/>
+ attrs="{'readonly':[('state','!=','accounting_final')],'invisible':[('on_employee_fair','=',True)],
+ 'required':[('state','=','accounting_final'),('on_employee_fair','=',False)]}"/>
diff --git a/odex25_hr/hr_government_relations/views/request_visa.xml b/odex25_hr/hr_government_relations/views/request_visa.xml
index ef93ddf69..94034c0cf 100644
--- a/odex25_hr/hr_government_relations/views/request_visa.xml
+++ b/odex25_hr/hr_government_relations/views/request_visa.xml
@@ -111,9 +111,9 @@
+ attrs="{'readonly':[('state','!=','accounting_final')],'required':['&',('cost','>', '0' ),('state','=','accounting_final')]}"/>
+ attrs="{'readonly':[('state','!=','accounting_final')],'required':['&',('cost','>', '0' ),('state','=','accounting_final')]}"/>
diff --git a/odex25_hr/hr_holidays_public/models/hr_government_exit_return_custom.py b/odex25_hr/hr_holidays_public/models/hr_government_exit_return_custom.py
index 519745189..3a866b6a1 100644
--- a/odex25_hr/hr_holidays_public/models/hr_government_exit_return_custom.py
+++ b/odex25_hr/hr_holidays_public/models/hr_government_exit_return_custom.py
@@ -16,12 +16,13 @@ class HRHolidays(models.Model):
@api.constrains('leave_request_id')
def ticket_holiday_request(self):
for rec in self:
- holiday_req = self.env['hr.exit.return'].search([('employee_id', '=', rec.employee_id.id),
- ('leave_request_id', '=', rec.leave_request_id.id)])
+ if rec.leave_request_id:
+ holiday_req = self.env['hr.exit.return'].search([('employee_id', '=', rec.employee_id.id),
+ ('leave_request_id', '=', rec.leave_request_id.id)])
- if len(holiday_req) > 1:
- raise exceptions.Warning(
- _('This Holiday Request Has Been take Exit Return %s') % rec.leave_request_id.display_name)
+ if len(holiday_req) > 1:
+ raise exceptions.Warning(
+ _('This Holiday Request Has Been take Exit Return %s') % rec.leave_request_id.display_name)
# dynamic domain on leave_request_id & constraint if the employee does not have family
@api.onchange('request_for', 'employee_id')
diff --git a/odex25_hr/hr_holidays_public/security/ir.model.access.csv b/odex25_hr/hr_holidays_public/security/ir.model.access.csv
index 4c3378479..3bcfa2f18 100644
--- a/odex25_hr/hr_holidays_public/security/ir.model.access.csv
+++ b/odex25_hr/hr_holidays_public/security/ir.model.access.csv
@@ -28,3 +28,5 @@ access_hr_holidays_status_duration,access_hr_holidays_duration,model_holiday_sta
access_public_leave_report_user,access_public_leave_report,model_public_leave_report,base.group_user,1,1,1,0
access_public_holidays_next_year_wizard_user,access_public_holidays_next_year_wizard,model_public_holidays_next_year_wizard,base.group_user,1,1,1,0
access_zfp_hr_custom_buy_vacation,zfp_hr_custom.buy_vacation,model_buy_vacation,base.group_user,1,1,1,1
+access_hr_holidays_officials_accounting_manager,access.hr.holidays.officials.accounting.manager,model_hr_holidays_officials,hr_base.group_account_manager,1,1,0,0
+access_resource_calendar_accounting_manager,resource.calendar.accounting.manager,model_resource_calendar,hr_base.group_account_manager,1,1,0,0
\ No newline at end of file