From d8e1e08589f4c1155c72fbe96d28f4398265a2e4 Mon Sep 17 00:00:00 2001 From: blackbelts <74664702+eslamtalaat74@users.noreply.github.com> Date: Mon, 23 Jun 2025 16:00:04 +0300 Subject: [PATCH 01/20] appraial priority mclassif --- odex25_hr/exp_hr_appraisal/models/appraisal.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/odex25_hr/exp_hr_appraisal/models/appraisal.py b/odex25_hr/exp_hr_appraisal/models/appraisal.py index 61b2fca32..2bf8ccfdb 100644 --- a/odex25_hr/exp_hr_appraisal/models/appraisal.py +++ b/odex25_hr/exp_hr_appraisal/models/appraisal.py @@ -263,7 +263,7 @@ class StandardAppraisalLines(models.Model): question = fields.Char() great_level = fields.Float() priority = fields.Selection( - [ + [('0', '0'), ('1', '1'), ('2', '2'), ('3', '3'), @@ -301,12 +301,17 @@ class StandardAppraisalLines(models.Model): rec.priority = '0' # fallback else: rec.priority = '0' + print("lllll") + print(rec.priority) + @api.onchange('priority') def _inverse_priority(self): for rec in self: if rec.great_level and rec.priority: # 3*2 # 2*4 + print("kkkkkkkkk") + print(int(rec.priority) * (rec.great_level / 5)) rec.greed = int(rec.priority) * (rec.great_level / 5) @api.constrains('greed', 'great_level') From 916b1187dd985cf7bf1271c04e631fb25bae6211 Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot Date: Mon, 23 Jun 2025 18:18:01 +0300 Subject: [PATCH 02/20] Add or update prevent-invalid-branch-merges workflow --- .../prevent-invalid-branch-merges.yml | 292 ++++++++++++++++++ 1 file changed, 292 insertions(+) create mode 100644 .github/workflows/prevent-invalid-branch-merges.yml diff --git a/.github/workflows/prevent-invalid-branch-merges.yml b/.github/workflows/prevent-invalid-branch-merges.yml new file mode 100644 index 000000000..5b3a496da --- /dev/null +++ b/.github/workflows/prevent-invalid-branch-merges.yml @@ -0,0 +1,292 @@ +# Author: Ahmad Samir +name: Prevent Invalid Merges + +on: + pull_request: + branches: + - dev_odex-event + - dev_odex25_accounting + - dev_odex25_base + - dev_odex25_dms + - dev_odex25_fleet + - dev_odex25_hr + - dev_odex25_inventory + - dev_odex25_maintenance + - dev_odex25_mobile + - dev_odex25_pos + - dev_odex25_project + - dev_odex25_purchase + - dev_odex25_realstate + - dev_odex25_sales + - dev_odex25_survey + - dev_odex25_transactions + - dev_odex25_website + - dev_openeducat_erp-14.0.1.0 + - dev_odex25_ensan + - dev_odex25_helpdesk + + - preprod_odex-event + - preprod_odex25_accounting + - preprod_odex25_base + - preprod_odex25_dms + - preprod_odex25_fleet + - preprod_odex25_hr + - preprod_odex25_inventory + - preprod_odex25_maintenance + - preprod_odex25_mobile + - preprod_odex25_pos + - preprod_odex25_project + - preprod_odex25_purchase + - preprod_odex25_realstate + - preprod_odex25_sales + - preprod_odex25_survey + - preprod_odex25_transactions + - preprod_odex25_website + - preprod_openeducat_erp-14.0.1.0 + - preprod_odex25_ensan + - preprod_odex25_helpdesk + + - master_odex-event + - master_odex25_accounting + - master_odex25_base + - master_odex25_dms + - master_odex25_fleet + - master_odex25_hr + - master_odex25_inventory + - master_odex25_maintenance + - master_odex25_mobile + - master_odex25_pos + - master_odex25_project + - master_odex25_purchase + - master_odex25_realstate + - master_odex25_sales + - master_odex25_survey + - master_odex25_transactions + - master_odex25_website + - master_openeducat_erp-14.0.1.0 + - master_odex25_ensan + - master_odex25_helpdesk + + + + +jobs: + validate-merge-source: + runs-on: ubuntu-latest + steps: + - name: Check source branch for merge + run: | + echo "Base branch: ${{ github.base_ref }}" + echo "Head branch: ${{ github.head_ref }}" + + + # ✅ Preprod Branches + if [[ "${{ github.base_ref }}" == "preprod_odex-event" && "${{ github.head_ref }}" != "dev_odex-event" ]]; then + echo "::error ::You can only merge to 'preprod_odex-event' from 'dev_odex-event' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_accounting" && "${{ github.head_ref }}" != "dev_odex25_accounting" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_accounting' from 'dev_odex25_accounting' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_base" && "${{ github.head_ref }}" != "dev_odex25_base" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_base' from 'dev_odex25_base' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_dms" && "${{ github.head_ref }}" != "dev_odex25_dms" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_dms' from 'dev_odex25_dms' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_fleet" && "${{ github.head_ref }}" != "dev_odex25_fleet" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_fleet' from 'dev_odex25_fleet' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_hr" && "${{ github.head_ref }}" != "dev_odex25_hr" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_hr' from 'dev_odex25_hr' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_inventory" && "${{ github.head_ref }}" != "dev_odex25_inventory" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_inventory' from 'dev_odex25_inventory' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_maintenance" && "${{ github.head_ref }}" != "dev_odex25_maintenance" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_maintenance' from 'dev_odex25_maintenance' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_mobile" && "${{ github.head_ref }}" != "dev_odex25_mobile" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_mobile' from 'dev_odex25_mobile' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_pos" && "${{ github.head_ref }}" != "dev_odex25_pos" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_pos' from 'dev_odex25_pos' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_project" && "${{ github.head_ref }}" != "dev_odex25_project" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_project' from 'dev_odex25_project' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_purchase" && "${{ github.head_ref }}" != "dev_odex25_purchase" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_purchase' from 'dev_odex25_purchase' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_realstate" && "${{ github.head_ref }}" != "dev_odex25_realstate" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_realstate' from 'dev_odex25_realstate' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_sales" && "${{ github.head_ref }}" != "dev_odex25_sales" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_sales' from 'dev_odex25_sales' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_survey" && "${{ github.head_ref }}" != "dev_odex25_survey" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_survey' from 'dev_odex25_survey' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_transactions" && "${{ github.head_ref }}" != "dev_odex25_transactions" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_transactions' from 'dev_odex25_transactions' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_website" && "${{ github.head_ref }}" != "dev_odex25_website" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_website' from 'dev_odex25_website' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_openeducat_erp-14.0.1.0" && "${{ github.head_ref }}" != "dev_openeducat_erp-14.0.1.0" ]]; then + echo "::error ::You can only merge to 'preprod_openeducat_erp-14.0.1.0' from 'dev_openeducat_erp-14.0.1.0' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_ensan" && "${{ github.head_ref }}" != "dev_odex25_ensan" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_ensan' from 'dev_odex25_ensan' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "preprod_odex25_helpdesk" && "${{ github.head_ref }}" != "dev_odex25_helpdesk" ]]; then + echo "::error ::You can only merge to 'preprod_odex25_helpdesk' from 'dev_odex25_helpdesk' branch!" + exit 1 + fi + + # ✅ Master Branches + if [[ "${{ github.base_ref }}" == "master_odex-event" && "${{ github.head_ref }}" != "preprod_odex-event" ]]; then + echo "::error ::You can only merge to 'master_odex-event' from 'preprod_odex-event' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_accounting" && "${{ github.head_ref }}" != "preprod_odex25_accounting" ]]; then + echo "::error ::You can only merge to 'master_odex25_accounting' from 'preprod_odex25_accounting' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_base" && "${{ github.head_ref }}" != "preprod_odex25_base" ]]; then + echo "::error ::You can only merge to 'master_odex25_base' from 'preprod_odex25_base' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_dms" && "${{ github.head_ref }}" != "preprod_odex25_dms" ]]; then + echo "::error ::You can only merge to 'master_odex25_dms' from 'preprod_odex25_dms' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_fleet" && "${{ github.head_ref }}" != "preprod_odex25_fleet" ]]; then + echo "::error ::You can only merge to 'master_odex25_fleet' from 'preprod_odex25_fleet' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_hr" && "${{ github.head_ref }}" != "preprod_odex25_hr" ]]; then + echo "::error ::You can only merge to 'master_odex25_hr' from 'preprod_odex25_hr' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_inventory" && "${{ github.head_ref }}" != "preprod_odex25_inventory" ]]; then + echo "::error ::You can only merge to 'master_odex25_inventory' from 'preprod_odex25_inventory' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_maintenance" && "${{ github.head_ref }}" != "preprod_odex25_maintenance" ]]; then + echo "::error ::You can only merge to 'master_odex25_maintenance' from 'preprod_odex25_maintenance' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_mobile" && "${{ github.head_ref }}" != "preprod_odex25_mobile" ]]; then + echo "::error ::You can only merge to 'master_odex25_mobile' from 'preprod_odex25_mobile' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_pos" && "${{ github.head_ref }}" != "preprod_odex25_pos" ]]; then + echo "::error ::You can only merge to 'master_odex25_pos' from 'preprod_odex25_pos' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_project" && "${{ github.head_ref }}" != "preprod_odex25_project" ]]; then + echo "::error ::You can only merge to 'master_odex25_project' from 'preprod_odex25_project' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_purchase" && "${{ github.head_ref }}" != "preprod_odex25_purchase" ]]; then + echo "::error ::You can only merge to 'master_odex25_purchase' from 'preprod_odex25_purchase' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_realstate" && "${{ github.head_ref }}" != "preprod_odex25_realstate" ]]; then + echo "::error ::You can only merge to 'master_odex25_realstate' from 'preprod_odex25_realstate' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_sales" && "${{ github.head_ref }}" != "preprod_odex25_sales" ]]; then + echo "::error ::You can only merge to 'master_odex25_sales' from 'preprod_odex25_sales' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_survey" && "${{ github.head_ref }}" != "preprod_odex25_survey" ]]; then + echo "::error ::You can only merge to 'master_odex25_survey' from 'preprod_odex25_survey' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_transactions" && "${{ github.head_ref }}" != "preprod_odex25_transactions" ]]; then + echo "::error ::You can only merge to 'master_odex25_transactions' from 'preprod_odex25_transactions' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_website" && "${{ github.head_ref }}" != "preprod_odex25_website" ]]; then + echo "::error ::You can only merge to 'master_odex25_website' from 'preprod_odex25_website' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_openeducat_erp-14.0.1.0" && "${{ github.head_ref }}" != "preprod_openeducat_erp-14.0.1.0" ]]; then + echo "::error ::You can only merge to 'master_openeducat_erp-14.0.1.0' from 'preprod_openeducat_erp-14.0.1.0' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_ensan" && "${{ github.head_ref }}" != "preprod_odex25_ensan" ]]; then + echo "::error ::You can only merge to 'master_odex25_ensan' from 'preprod_odex25_ensan' branch!" + exit 1 + fi + + if [[ "${{ github.base_ref }}" == "master_odex25_helpdesk" && "${{ github.head_ref }}" != "preprod_odex25_helpdesk" ]]; then + echo "::error ::You can only merge to 'master_odex25_helpdesk' from 'preprod_odex25_helpdesk' branch!" + exit 1 + fi + + + # ❌ Block ALL merges to 'master' + if [[ "${{ github.base_ref }}" == "master" ]]; then + echo "::error ::Merging to 'master' branch is not allowed!" + exit 1 + fi + + echo "Merge validation passed." \ No newline at end of file From 385996f5b4c6c6743d12bfd6dfcf2b796a706639 Mon Sep 17 00:00:00 2001 From: blackbelts <74664702+eslamtalaat74@users.noreply.github.com> Date: Tue, 24 Jun 2025 10:08:26 +0300 Subject: [PATCH 03/20] appraial fin --- .../employee_requests/models/other_request.py | 25 +++++---------- .../exp_hr_appraisal/models/appraisal.py | 32 +++++++++---------- 2 files changed, 23 insertions(+), 34 deletions(-) diff --git a/odex25_hr/employee_requests/models/other_request.py b/odex25_hr/employee_requests/models/other_request.py index 71960bf1e..ae33457e4 100644 --- a/odex25_hr/employee_requests/models/other_request.py +++ b/odex25_hr/employee_requests/models/other_request.py @@ -93,17 +93,12 @@ class EmployeeOtherRequest(models.Model): if item.request_type == 'dependent': if not item.employee_dependant: raise exceptions.Warning(_('Please The dependents were not Included')) - #if item.employee_id.contract_id.contract_status == 'single': - #raise exceptions.Warning(_('You can not Add Fimaly record Because Employee is Single')) + # if item.employee_id.contract_id.contract_status == 'single': + # raise exceptions.Warning(_('You can not Add Fimaly record Because Employee is Single')) else: for rec in item.employee_dependant: - if not rec.attachment: - raise exceptions.Warning(_('Please Insert dependents Attachments Files Below!')) - - - item.state = "submit" - - + if not rec.attachment: + raise exceptions.Warning(_('Please Insert dependents Attachments Files Below!')) if item.request_type == 'qualification': if not item.qualification_employee: @@ -111,22 +106,18 @@ class EmployeeOtherRequest(models.Model): for rec in item.qualification_employee: if not rec.attachment: raise exceptions.Warning(_('Please Insert Attachments Files Below!')) - else: - item.state = "submit" + if item.request_type == 'certification': if not item.certification_employee: raise exceptions.Warning(_('Please The qualification or certification were not Insert Below!')) for rec in item.certification_employee: if not rec.attachment: raise exceptions.Warning(_('Please Insert Attachments Files Below!')) - else: - item.state = "submit" + if item.request_type in ['suggestion', 'complaint']: + item.state = "submit" else: - if item.request_type in ['suggestion', 'complaint']: - item.state = "submit" - else: - item.state = "confirm" + item.state = "confirm" def confirm(self): #self.state = 'confirm' diff --git a/odex25_hr/exp_hr_appraisal/models/appraisal.py b/odex25_hr/exp_hr_appraisal/models/appraisal.py index 2bf8ccfdb..24232a1ea 100644 --- a/odex25_hr/exp_hr_appraisal/models/appraisal.py +++ b/odex25_hr/exp_hr_appraisal/models/appraisal.py @@ -257,6 +257,7 @@ class StandardAppraisalLines(models.Model): _name = 'standard.appraisal.line' _rec_name = 'greed' _description = 'Standard Appraisal line' + standard_appraisal_employee_line = fields.Many2one('hr.employee.appraisal') greed = fields.Float() accrued_greed = fields.Float() @@ -269,38 +270,36 @@ class StandardAppraisalLines(models.Model): ('3', '3'), ('4', '4'), ('5', '5'), - ('6', '6'), + # ('6', '6'), ], string='Priority', - compute='_compute_priority', - inverse='_inverse_priority', + store=True ) - - standard_appraisal_employee_line = fields.Many2one('hr.employee.appraisal') - - @api.depends('greed', 'great_level') + # compute = '_compute_priority', + # inverse = '_inverse_priority', + # inverse='_inverse_priority', + # @api.depends('greed', 'great_level','priority') + @api.onchange('greed', 'great_level') def _compute_priority(self): for rec in self: if rec.great_level: value = rec.greed / (rec.great_level / 5) - # 3.5 - if 1 <= value <= 2: + if 1 <= value < 2: rec.priority = '1' - elif 2 < value <= 3: + elif 2 <= value < 3: rec.priority = '2' - # 3.5 - elif 3 < value <= 4: + elif 3 <= value < 4: rec.priority = '3' - # 4 - elif 4 < value <= 5: + elif 4 <= value < 5: rec.priority = '4' - elif value > 5: + elif value >= 5: rec.priority = '5' else: rec.priority = '0' # fallback else: rec.priority = '0' + print("lllll") print(rec.priority) @@ -308,11 +307,10 @@ class StandardAppraisalLines(models.Model): def _inverse_priority(self): for rec in self: if rec.great_level and rec.priority: - # 3*2 - # 2*4 print("kkkkkkkkk") print(int(rec.priority) * (rec.great_level / 5)) rec.greed = int(rec.priority) * (rec.great_level / 5) + print(rec.greed) @api.constrains('greed', 'great_level') def greed_constrains(self): From 5930697b8eaf79d852bc2651e04a3079ffef163d Mon Sep 17 00:00:00 2001 From: blackbelts <74664702+eslamtalaat74@users.noreply.github.com> Date: Tue, 24 Jun 2025 10:10:30 +0300 Subject: [PATCH 04/20] appraial fin --- odex25_hr/exp_hr_appraisal/models/appraisal.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/odex25_hr/exp_hr_appraisal/models/appraisal.py b/odex25_hr/exp_hr_appraisal/models/appraisal.py index 24232a1ea..dbcb1c768 100644 --- a/odex25_hr/exp_hr_appraisal/models/appraisal.py +++ b/odex25_hr/exp_hr_appraisal/models/appraisal.py @@ -299,8 +299,6 @@ class StandardAppraisalLines(models.Model): rec.priority = '0' # fallback else: rec.priority = '0' - - print("lllll") print(rec.priority) @api.onchange('priority') From b3ba705d979d1b290ec3270a51a30b4433d0f6c5 Mon Sep 17 00:00:00 2001 From: blackbelts <74664702+eslamtalaat74@users.noreply.github.com> Date: Tue, 24 Jun 2025 10:51:14 +0300 Subject: [PATCH 05/20] cla --- odex25_hr/employee_requests/models/other_request.py | 4 ++-- .../employee_requests/views/employee_overtime_request.xml | 2 +- odex25_hr/employee_requests/views/other_request.xml | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/odex25_hr/employee_requests/models/other_request.py b/odex25_hr/employee_requests/models/other_request.py index ae33457e4..7f7e25dbf 100644 --- a/odex25_hr/employee_requests/models/other_request.py +++ b/odex25_hr/employee_requests/models/other_request.py @@ -258,5 +258,5 @@ class HrCclassification(models.Model): _name = 'hr.classification' _rec_name = 'name' - name = fields.Char(string='Name') # Translatable - active = fields.Boolean(default=True, string='Active') + name = fields.Char(string='الاسم') # Translatable + active = fields.Boolean(default=True, string='نشط') diff --git a/odex25_hr/employee_requests/views/employee_overtime_request.xml b/odex25_hr/employee_requests/views/employee_overtime_request.xml index ef10ab07e..9b22d360c 100644 --- a/odex25_hr/employee_requests/views/employee_overtime_request.xml +++ b/odex25_hr/employee_requests/views/employee_overtime_request.xml @@ -25,7 +25,7 @@ employee.overtime.request
-
+
f