From f9f179d65216f91d6ff8c36f1f9fa3378a91be71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D8=B4=D8=B1=D9=83=D8=A9=20=D8=AE=D8=A8=D9=8A=D8=B1=20?= =?UTF-8?q?=D8=A7=D9=84=D9=85=D8=AD=D8=AF=D9=88=D8=AF=D8=A9?= Date: Mon, 16 Dec 2024 07:09:49 +0300 Subject: [PATCH 01/11] Update github action file --- .github/workflows/production_pull_code.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/production_pull_code.yml b/.github/workflows/production_pull_code.yml index e140affea..6997f25cc 100644 --- a/.github/workflows/production_pull_code.yml +++ b/.github/workflows/production_pull_code.yml @@ -67,6 +67,7 @@ jobs: sudo chmod +x ${{ secrets.KAZ_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh sudo ${{ secrets.KAZ_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh ${{ secrets.KAZ_PROJECT_USER }} ${{ secrets.KAZ_STANDARD_FOLDER_PATH }} ${{ secrets.KAZ_MASTER_SERVICE }} master ${GITHUB_REF#refs/heads/master_} ${GITHUB_REF#refs/heads/} + sudo systemctl restart odoo-server-stage.service # Twahod project twahod_master_server: From 7c5a7b71cbc63e6671c90ba837f6e75c73a19c55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D8=B4=D8=B1=D9=83=D8=A9=20=D8=AE=D8=A8=D9=8A=D8=B1=20?= =?UTF-8?q?=D8=A7=D9=84=D9=85=D8=AD=D8=AF=D9=88=D8=AF=D8=A9?= Date: Sun, 22 Dec 2024 13:00:01 +0300 Subject: [PATCH 02/11] Update github action file --- .github/workflows/production_pull_code.yml | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.github/workflows/production_pull_code.yml b/.github/workflows/production_pull_code.yml index 6997f25cc..51575aca8 100644 --- a/.github/workflows/production_pull_code.yml +++ b/.github/workflows/production_pull_code.yml @@ -13,6 +13,8 @@ on: - Helpdesk-Khabir-Project - King-AbdelAziz-Library-Project - Twahod-Project + - Trahum-Production-Project + - Trahum-Stage-Project jobs: # Cyber Project @@ -82,6 +84,31 @@ jobs: sudo chmod +x ${{ secrets.TWAHOD_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh sudo ${{ secrets.TWAHOD_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh ${{ secrets.TWAHOD_PROJECT_USER }} ${{ secrets.TWAHOD_STANDARD_FOLDER_PATH }} ${{ secrets.TWAHOD_MASTER_SERVICE }} master ${GITHUB_REF#refs/heads/master_} ${GITHUB_REF#refs/heads/} +# Trahum prod project + trahum_master_prod_server: + name: Deploy to Trahum Master + runs-on: trahum-prod-client-project-runner + if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'Trahum-Production-Project' && (github.ref == 'refs/heads/master_odex-event' || github.ref == 'refs/heads/master_odex25_accounting' || github.ref == 'refs/heads/master_odex25_base' || github.ref == 'refs/heads/master_odex25_dms' || github.ref == 'refs/heads/master_odex25_fleet' || github.ref == 'refs/heads/master_odex25_ENSAN' || github.ref == 'refs/heads/master_odex25_hr' || github.ref == 'refs/heads/master_odex25_inventory' || github.ref == 'refs/heads/master_odex25_maintenance' || github.ref == 'refs/heads/master_odex25_mobile' || github.ref == 'refs/heads/master_odex25_pos' || github.ref == 'refs/heads/master_odex25_project' || github.ref == 'refs/heads/master_odex25_purchase' || github.ref == 'refs/heads/master_odex25_realstate' || github.ref == 'refs/heads/master_odex25_sales' || github.ref == 'refs/heads/master_odex25_survey' || github.ref == 'refs/heads/master_odex25_transactions' || github.ref == 'refs/heads/master_odex25_website' || github.ref == 'refs/heads/master_openeducat_erp-14.0.1.0' || github.ref == 'refs/heads/master_odex25_ensan') + steps: + - name: Checkout And Restart Project + run: | + echo "** [INFO] Running on branch --> ${GITHUB_REF#refs/heads/}" + + sudo chmod +x ${{ secrets.TRAHUM_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh + sudo ${{ secrets.TRAHUM_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh ${{ secrets.TRAHUM_PROJECT_USER }} ${{ secrets.TRAHUM_STANDARD_FOLDER_PATH }} ${{ secrets.TRAHUM_MASTER_SERVICE }} master ${GITHUB_REF#refs/heads/master_} ${GITHUB_REF#refs/heads/} + +# Trahum stg project + trahum_master_stg_server: + name: Deploy to Trahum Master + runs-on: trahum-stg-client-project-runner + if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'Trahum-Stage-Project' && (github.ref == 'refs/heads/master_odex-event' || github.ref == 'refs/heads/master_odex25_accounting' || github.ref == 'refs/heads/master_odex25_base' || github.ref == 'refs/heads/master_odex25_dms' || github.ref == 'refs/heads/master_odex25_fleet' || github.ref == 'refs/heads/master_odex25_ENSAN' || github.ref == 'refs/heads/master_odex25_hr' || github.ref == 'refs/heads/master_odex25_inventory' || github.ref == 'refs/heads/master_odex25_maintenance' || github.ref == 'refs/heads/master_odex25_mobile' || github.ref == 'refs/heads/master_odex25_pos' || github.ref == 'refs/heads/master_odex25_project' || github.ref == 'refs/heads/master_odex25_purchase' || github.ref == 'refs/heads/master_odex25_realstate' || github.ref == 'refs/heads/master_odex25_sales' || github.ref == 'refs/heads/master_odex25_survey' || github.ref == 'refs/heads/master_odex25_transactions' || github.ref == 'refs/heads/master_odex25_website' || github.ref == 'refs/heads/master_openeducat_erp-14.0.1.0' || github.ref == 'refs/heads/master_odex25_ensan') + steps: + - name: Checkout And Restart Project + run: | + echo "** [INFO] Running on branch --> ${GITHUB_REF#refs/heads/}" + + sudo chmod +x ${{ secrets.TRAHUM_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh + sudo ${{ secrets.TRAHUM_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh ${{ secrets.TRAHUM_PROJECT_USER }} ${{ secrets.TRAHUM_STANDARD_FOLDER_PATH }} ${{ secrets.TRAHUM_MASTER_SERVICE }} master ${GITHUB_REF#refs/heads/master_} ${GITHUB_REF#refs/heads/} # if: github.event_name == 'workflow_dispatch' && (github.ref == 'refs/heads/master_odex-event' || github.ref == 'refs/heads/master_odex25_accounting' || github.ref == 'refs/heads/master_odex25_base' || github.ref == 'refs/heads/master_odex25_dms' || github.ref == 'refs/heads/master_odex25_fleet' || github.ref == 'refs/heads/master_odex25_ENSAN' || github.ref == 'refs/heads/master_odex25_hr' || github.ref == 'refs/heads/master_odex25_inventory' || github.ref == 'refs/heads/master_odex25_maintenance' || github.ref == 'refs/heads/master_odex25_mobile' || github.ref == 'refs/heads/master_odex25_pos' || github.ref == 'refs/heads/master_odex25_project' || github.ref == 'refs/heads/master_odex25_purchase' || github.ref == 'refs/heads/master_odex25_realstate' || github.ref == 'refs/heads/master_odex25_sales' || github.ref == 'refs/heads/master_odex25_survey' || github.ref == 'refs/heads/master_odex25_transactions' || github.ref == 'refs/heads/master_odex25_website' || github.ref == 'refs/heads/master_openeducat_erp-14.0.1.0' || github.ref == 'refs/heads/master_odex25_ensan') From 39239a4d48af4b968748cdf2e2c76ce21977ae55 Mon Sep 17 00:00:00 2001 From: ronozoro Date: Sun, 22 Dec 2024 17:40:43 -0800 Subject: [PATCH 03/11] fix hide deps --- .../odex25_website/views/odex25_website_templates.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/odex25_base/odex25_website/views/odex25_website_templates.xml b/odex25_base/odex25_website/views/odex25_website_templates.xml index c9fc5e930..c29d23c53 100644 --- a/odex25_base/odex25_website/views/odex25_website_templates.xml +++ b/odex25_base/odex25_website/views/odex25_website_templates.xml @@ -33,4 +33,9 @@ + + From ff4e773ca9f5bde4fedba5756e86a80484bb0211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D8=B4=D8=B1=D9=83=D8=A9=20=D8=AE=D8=A8=D9=8A=D8=B1=20?= =?UTF-8?q?=D8=A7=D9=84=D9=85=D8=AD=D8=AF=D9=88=D8=AF=D8=A9?= Date: Wed, 25 Dec 2024 21:29:18 +0300 Subject: [PATCH 04/11] Update github action file --- .github/workflows/production_pull_code.yml | 27 ---------------------- 1 file changed, 27 deletions(-) diff --git a/.github/workflows/production_pull_code.yml b/.github/workflows/production_pull_code.yml index 51575aca8..6997f25cc 100644 --- a/.github/workflows/production_pull_code.yml +++ b/.github/workflows/production_pull_code.yml @@ -13,8 +13,6 @@ on: - Helpdesk-Khabir-Project - King-AbdelAziz-Library-Project - Twahod-Project - - Trahum-Production-Project - - Trahum-Stage-Project jobs: # Cyber Project @@ -84,31 +82,6 @@ jobs: sudo chmod +x ${{ secrets.TWAHOD_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh sudo ${{ secrets.TWAHOD_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh ${{ secrets.TWAHOD_PROJECT_USER }} ${{ secrets.TWAHOD_STANDARD_FOLDER_PATH }} ${{ secrets.TWAHOD_MASTER_SERVICE }} master ${GITHUB_REF#refs/heads/master_} ${GITHUB_REF#refs/heads/} -# Trahum prod project - trahum_master_prod_server: - name: Deploy to Trahum Master - runs-on: trahum-prod-client-project-runner - if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'Trahum-Production-Project' && (github.ref == 'refs/heads/master_odex-event' || github.ref == 'refs/heads/master_odex25_accounting' || github.ref == 'refs/heads/master_odex25_base' || github.ref == 'refs/heads/master_odex25_dms' || github.ref == 'refs/heads/master_odex25_fleet' || github.ref == 'refs/heads/master_odex25_ENSAN' || github.ref == 'refs/heads/master_odex25_hr' || github.ref == 'refs/heads/master_odex25_inventory' || github.ref == 'refs/heads/master_odex25_maintenance' || github.ref == 'refs/heads/master_odex25_mobile' || github.ref == 'refs/heads/master_odex25_pos' || github.ref == 'refs/heads/master_odex25_project' || github.ref == 'refs/heads/master_odex25_purchase' || github.ref == 'refs/heads/master_odex25_realstate' || github.ref == 'refs/heads/master_odex25_sales' || github.ref == 'refs/heads/master_odex25_survey' || github.ref == 'refs/heads/master_odex25_transactions' || github.ref == 'refs/heads/master_odex25_website' || github.ref == 'refs/heads/master_openeducat_erp-14.0.1.0' || github.ref == 'refs/heads/master_odex25_ensan') - steps: - - name: Checkout And Restart Project - run: | - echo "** [INFO] Running on branch --> ${GITHUB_REF#refs/heads/}" - - sudo chmod +x ${{ secrets.TRAHUM_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh - sudo ${{ secrets.TRAHUM_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh ${{ secrets.TRAHUM_PROJECT_USER }} ${{ secrets.TRAHUM_STANDARD_FOLDER_PATH }} ${{ secrets.TRAHUM_MASTER_SERVICE }} master ${GITHUB_REF#refs/heads/master_} ${GITHUB_REF#refs/heads/} - -# Trahum stg project - trahum_master_stg_server: - name: Deploy to Trahum Master - runs-on: trahum-stg-client-project-runner - if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'Trahum-Stage-Project' && (github.ref == 'refs/heads/master_odex-event' || github.ref == 'refs/heads/master_odex25_accounting' || github.ref == 'refs/heads/master_odex25_base' || github.ref == 'refs/heads/master_odex25_dms' || github.ref == 'refs/heads/master_odex25_fleet' || github.ref == 'refs/heads/master_odex25_ENSAN' || github.ref == 'refs/heads/master_odex25_hr' || github.ref == 'refs/heads/master_odex25_inventory' || github.ref == 'refs/heads/master_odex25_maintenance' || github.ref == 'refs/heads/master_odex25_mobile' || github.ref == 'refs/heads/master_odex25_pos' || github.ref == 'refs/heads/master_odex25_project' || github.ref == 'refs/heads/master_odex25_purchase' || github.ref == 'refs/heads/master_odex25_realstate' || github.ref == 'refs/heads/master_odex25_sales' || github.ref == 'refs/heads/master_odex25_survey' || github.ref == 'refs/heads/master_odex25_transactions' || github.ref == 'refs/heads/master_odex25_website' || github.ref == 'refs/heads/master_openeducat_erp-14.0.1.0' || github.ref == 'refs/heads/master_odex25_ensan') - steps: - - name: Checkout And Restart Project - run: | - echo "** [INFO] Running on branch --> ${GITHUB_REF#refs/heads/}" - - sudo chmod +x ${{ secrets.TRAHUM_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh - sudo ${{ secrets.TRAHUM_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh ${{ secrets.TRAHUM_PROJECT_USER }} ${{ secrets.TRAHUM_STANDARD_FOLDER_PATH }} ${{ secrets.TRAHUM_MASTER_SERVICE }} master ${GITHUB_REF#refs/heads/master_} ${GITHUB_REF#refs/heads/} # if: github.event_name == 'workflow_dispatch' && (github.ref == 'refs/heads/master_odex-event' || github.ref == 'refs/heads/master_odex25_accounting' || github.ref == 'refs/heads/master_odex25_base' || github.ref == 'refs/heads/master_odex25_dms' || github.ref == 'refs/heads/master_odex25_fleet' || github.ref == 'refs/heads/master_odex25_ENSAN' || github.ref == 'refs/heads/master_odex25_hr' || github.ref == 'refs/heads/master_odex25_inventory' || github.ref == 'refs/heads/master_odex25_maintenance' || github.ref == 'refs/heads/master_odex25_mobile' || github.ref == 'refs/heads/master_odex25_pos' || github.ref == 'refs/heads/master_odex25_project' || github.ref == 'refs/heads/master_odex25_purchase' || github.ref == 'refs/heads/master_odex25_realstate' || github.ref == 'refs/heads/master_odex25_sales' || github.ref == 'refs/heads/master_odex25_survey' || github.ref == 'refs/heads/master_odex25_transactions' || github.ref == 'refs/heads/master_odex25_website' || github.ref == 'refs/heads/master_openeducat_erp-14.0.1.0' || github.ref == 'refs/heads/master_odex25_ensan') From 235c0e0a0cc091b0efc705c0cf3b2237a14da5ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D8=B4=D8=B1=D9=83=D8=A9=20=D8=AE=D8=A8=D9=8A=D8=B1=20?= =?UTF-8?q?=D8=A7=D9=84=D9=85=D8=AD=D8=AF=D9=88=D8=AF=D8=A9?= Date: Wed, 25 Dec 2024 21:31:26 +0300 Subject: [PATCH 05/11] Update github action file --- .github/workflows/dev-preprod-servers.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-preprod-servers.yml b/.github/workflows/dev-preprod-servers.yml index 2f5b76802..d86cbb29d 100644 --- a/.github/workflows/dev-preprod-servers.yml +++ b/.github/workflows/dev-preprod-servers.yml @@ -66,7 +66,7 @@ jobs: run: | sudo chmod +x /home/${{ secrets.CLIENT_USER }}/scripts/pull/preprod_pull_standard_code.sh sudo /home/${{ secrets.CLIENT_USER }}/scripts/pull/preprod_pull_standard_code.sh - sudo systemctl restart ${{ secrets.ENSAN_APP_PREPROD_SERVICE }} ${{ secrets.ODEX25_GENERAL_PREPROD_SERVICE }} ${{ secrets.ODEX25_STANDARD_PREPROD_SERVICE }} ${{ secrets.TWAHOD_APP_PREPROD_SERVICE }} ${{ secrets.ODEX25_DEMO_PREPROD_SERVICE }} ${{ secrets.HELPDESK_PREPROD_SERVICE }} ${{ secrets.TRAHUM_PREPROD_SERVICE }} ${{ secrets.CYBER_APP_PREPROD_SERVICE }} + sudo systemctl restart ${{ secrets.ENSAN_APP_PREPROD_SERVICE }} ${{ secrets.ODEX25_GENERAL_PREPROD_SERVICE }} ${{ secrets.ODEX25_STANDARD_PREPROD_SERVICE }} ${{ secrets.TWAHOD_APP_PREPROD_SERVICE }} ${{ secrets.ODEX25_DEMO_PREPROD_SERVICE }} ${{ secrets.HELPDESK_PREPROD_SERVICE }} ${{ secrets.CYBER_APP_PREPROD_SERVICE }} if [ $? -eq 0 ]; then echo "** [INFO] "PREPROD" services have been restarted." else @@ -82,7 +82,7 @@ jobs: run: | sudo chmod +x /home/${{ secrets.CLIENT_USER }}/scripts/pull/dev_pull_standard_code.sh sudo /home/${{ secrets.CLIENT_USER }}/scripts/pull/dev_pull_standard_code.sh - sudo systemctl restart ${{ secrets.ENSAN_APP_TEST_SERVICE }} ${{ secrets.ODEX25_GENERAL_TEST_SERVICE }} ${{ secrets.ODEX25_STANDARD_TEST_SERVICE }} ${{ secrets.TWAHOD_APP_TEST_SERVICE }} ${{ secrets.HELPDESK_TEST_SERVICE }} ${{ secrets.KAZ_LIBRARY_TEST_SERVICE }} ${{ secrets.TRAHUM_TEST_SERVICE }} ${{ secrets.CYBER_APP_TEST_SERVICE }} + sudo systemctl restart ${{ secrets.ENSAN_APP_TEST_SERVICE }} ${{ secrets.ODEX25_GENERAL_TEST_SERVICE }} ${{ secrets.ODEX25_STANDARD_TEST_SERVICE }} ${{ secrets.TWAHOD_APP_TEST_SERVICE }} ${{ secrets.HELPDESK_TEST_SERVICE }} ${{ secrets.KAZ_LIBRARY_TEST_SERVICE }} ${{ secrets.CYBER_APP_TEST_SERVICE }} if [ $? -eq 0 ]; then echo "** [INFO] "DEV" services have been restarted." else From d39f88ebb90a3c402970ff44608f5329306d678e Mon Sep 17 00:00:00 2001 From: Samir Ladoui Date: Sun, 5 Jan 2025 10:34:13 +0100 Subject: [PATCH 06/11] [ADD] data_patch_hook: a module to patch data if needed --- odex25_base/data_patch_hook/__init__.py | 29 +++++++++++++++++++++ odex25_base/data_patch_hook/__manifest__.py | 15 +++++++++++ odex25_base/data_patch_hook/hooks.py | 1 + 3 files changed, 45 insertions(+) create mode 100644 odex25_base/data_patch_hook/__init__.py create mode 100644 odex25_base/data_patch_hook/__manifest__.py create mode 100644 odex25_base/data_patch_hook/hooks.py diff --git a/odex25_base/data_patch_hook/__init__.py b/odex25_base/data_patch_hook/__init__.py new file mode 100644 index 000000000..3a85f93e7 --- /dev/null +++ b/odex25_base/data_patch_hook/__init__.py @@ -0,0 +1,29 @@ +from odoo import api, SUPERUSER_ID +from odoo.exceptions import ValidationError + + +def post_init_hook(cr, registry): + """ + This function serves as the hook to apply data patches and commit changes + before raising an intentional error. + """ + # Example functions to call (define these functions elsewhere in this file) + update_due_date_in_transaction_model(cr, registry) + + # Commit the changes + cr.commit() + + # Raise an intentional error to prevent module installation + raise ValidationError("Intentional error: This module is not designed to be installed.\nData Applied Successfully!") + +def update_due_date_in_transaction_model(cr, registry): + """ + Recalculate the is_late field for all records after module upgrade. + """ + env = api.Environment(cr, SUPERUSER_ID, {}) + + transaction_models = ['outgoing.transaction', 'internal.transaction', 'incoming.transaction'] + for transaction_model in transaction_models: + model = env[transaction_model] + records = model.search([]) # Fetch all records + records.compute_due_date() # Trigger computation \ No newline at end of file diff --git a/odex25_base/data_patch_hook/__manifest__.py b/odex25_base/data_patch_hook/__manifest__.py new file mode 100644 index 000000000..796d6999e --- /dev/null +++ b/odex25_base/data_patch_hook/__manifest__.py @@ -0,0 +1,15 @@ +{ + 'name': 'Data Patches with Hook', + 'version': '1.0', + 'summary': 'A module to apply data patches using a hook.', + 'category': 'Tools', + 'author': 'Expert Co.', + 'description': """ + This module apply data patches via hooks. + """, + 'depends': ['base'], + 'data': [], + 'installable': True, + 'application': False, + 'post_init_hook': 'post_init_hook', +} \ No newline at end of file diff --git a/odex25_base/data_patch_hook/hooks.py b/odex25_base/data_patch_hook/hooks.py new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/odex25_base/data_patch_hook/hooks.py @@ -0,0 +1 @@ + From 0967a37da154977bbdaad71cedff520365e149b2 Mon Sep 17 00:00:00 2001 From: Samir Ladoui Date: Tue, 7 Jan 2025 09:43:01 +0100 Subject: [PATCH 07/11] [FIX] odex25_sign: user could update some fields --- odex25_base/odex25_sign/models/res_users.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/odex25_base/odex25_sign/models/res_users.py b/odex25_base/odex25_sign/models/res_users.py index 9aafd233d..51fe60217 100644 --- a/odex25_base/odex25_sign/models/res_users.py +++ b/odex25_base/odex25_sign/models/res_users.py @@ -8,3 +8,12 @@ class ResUsers(models.Model): sign_signature = fields.Binary(string="Digital Signature", ) sign_initials = fields.Binary(string="Digitial Initials",) + + + def __init__(self, pool, cr): + """Custom initialization of the model""" + super(ResUsers, self).__init__(pool, cr) + + # Dynamically add fields to SELF_WRITEABLE_FIELDS and SELF_READABLE_FIELDS + type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS) + ['sign_signature', 'sign_initials'] + type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS) + ['sign_signature', 'sign_initials'] From 77c318691df230c76ee8f7b5e9a7f47c81edf9dc Mon Sep 17 00:00:00 2001 From: Samir Ladoui Date: Mon, 13 Jan 2025 08:25:57 +0100 Subject: [PATCH 08/11] [FIX] partner_custom: add email regex --- odex25_base/partner_custom/models/models.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/odex25_base/partner_custom/models/models.py b/odex25_base/partner_custom/models/models.py index 37b097099..e51a4e906 100644 --- a/odex25_base/partner_custom/models/models.py +++ b/odex25_base/partner_custom/models/models.py @@ -4,6 +4,7 @@ from odoo import models, fields, api, exceptions, tools, _ from datetime import datetime, date, timedelta from odoo.exceptions import Warning, ValidationError from odoo.modules.module import get_module_resource +import re class ResPartner(models.Model): _inherit = 'res.partner' @@ -55,7 +56,7 @@ class ResPartner(models.Model): @api.constrains('email') def _check_email_format(self): + email_regex = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$' for record in self: - if record.email: - if '@' not in record.email or not record.email.endswith('.com'): - raise ValidationError(_("The email address must contain '@' and end with '.com'.")) \ No newline at end of file + if record.email and not re.match(email_regex, record.email): + raise ValidationError(_("Invalid email address.")) \ No newline at end of file From a5dc5758ff74702967fa86e9372947a3ba847693 Mon Sep 17 00:00:00 2001 From: AHIDev Date: Tue, 14 Jan 2025 15:27:51 +0400 Subject: [PATCH 09/11] fix (odex25_debrand): bug on style has been solved --- odex25_base/odex25_debrand/static/src/css/web_login_style.css | 4 ++-- odex25_base/odex25_debrand/templates/left_login_template.xml | 2 +- .../odex25_debrand/templates/middle_login_template.xml | 2 +- odex25_base/odex25_debrand/templates/right_login_template.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/odex25_base/odex25_debrand/static/src/css/web_login_style.css b/odex25_base/odex25_debrand/static/src/css/web_login_style.css index ed7f2beb2..959204268 100644 --- a/odex25_base/odex25_debrand/static/src/css/web_login_style.css +++ b/odex25_base/odex25_debrand/static/src/css/web_login_style.css @@ -1,6 +1,6 @@ -.container{ +/* .container{ max-width: 100%; -} +} */ #background{ height:100%; display: block; diff --git a/odex25_base/odex25_debrand/templates/left_login_template.xml b/odex25_base/odex25_debrand/templates/left_login_template.xml index 9b99ebb9f..ea337f5e6 100644 --- a/odex25_base/odex25_debrand/templates/left_login_template.xml +++ b/odex25_base/odex25_debrand/templates/left_login_template.xml @@ -6,7 +6,7 @@
-