diff --git a/.copier-answers.yml b/.copier-answers.yml index 653dedb997d2..d3e0b35e5f2e 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,9 +1,15 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v1.6.1 +_commit: v1.14.2 _src_path: gh:oca/oca-addons-repo-template ci: GitHub dependency_installation_mode: PIP generate_requirements_txt: true +github_check_license: true +github_ci_extra_env: {} +github_enable_codecov: true +github_enable_makepot: true +github_enable_stale_action: true +github_enforce_dev_status_compatibility: true include_wkhtmltopdf: false odoo_version: 14.0 org_name: Odoo Community Association (OCA) @@ -11,10 +17,11 @@ org_slug: OCA rebel_module_groups: - web_widget_model_viewer repo_description: "This project aims to deal with modules related to the webclient\ - \ of Odoo. You'll find modules that:\n\n - Add facilities to the UI\n - Add widgets\n\ - \ - Ease the import/export features\n - Generally add clientside functionality" + \ of Odoo. You'll find modules that:\n\n - Add facilities to the UI\n - Add widgets\n\ + \ - Ease the import/export features\n - Generally add clientside functionality" repo_name: Web addons for Odoo repo_slug: web repo_website: https://github.com/OCA/web travis_apt_packages: [] travis_apt_sources: [] + diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index a7a1390461d1..5cdd68ed375b 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -11,10 +11,12 @@ on: jobs: pre-commit: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 + with: + python-version: "3.10" - name: Get python version run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - uses: actions/cache@v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2500f55a786f..d301a5668e83 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,7 +28,7 @@ jobs: fi done test: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 container: ${{ matrix.container }} name: ${{ matrix.name }} strategy: diff --git a/.gitignore b/.gitignore index 818770fb1bdc..3dfd7c887604 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,9 @@ build/ develop-eggs/ dist/ eggs/ -lib/ +# Below two lines needed to later allow static/lib. +!lib/ +lib/* lib64/ parts/ sdist/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5bedc50c4297..988051bfe92c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,6 +27,11 @@ repos: entry: found forbidden files; remove them language: fail files: "\\.rej$" + - id: en-po-files + name: en.po files cannot exist + entry: found a en.po file + language: fail + files: '[a-zA-Z0-9_]*/i18n/en\.po$' - repo: https://github.com/oca/maintainer-tools rev: ab1d7f6 hooks: @@ -96,7 +101,7 @@ repos: - id: pyupgrade args: ["--keep-percent-format"] - repo: https://github.com/PyCQA/isort - rev: 5.5.1 + rev: 5.12.0 hooks: - id: isort name: isort except __init__.py @@ -104,7 +109,7 @@ repos: - --settings=. exclude: /__init__\.py$ - repo: https://github.com/acsone/setuptools-odoo - rev: 2.6.0 + rev: 3.1.8 hooks: - id: setuptools-odoo-make-default - id: setuptools-odoo-get-requirements @@ -113,25 +118,21 @@ repos: - requirements.txt - --header - "# generated from manifests external_dependencies" - - repo: https://gitlab.com/PyCQA/flake8 + - repo: https://github.com/PyCQA/flake8 rev: 3.8.3 hooks: - id: flake8 name: flake8 additional_dependencies: ["flake8-bugbear==20.1.4"] - - repo: https://github.com/PyCQA/pylint - rev: v2.11.1 + - repo: https://github.com/OCA/pylint-odoo + rev: 7.0.2 hooks: - - id: pylint + - id: pylint_odoo name: pylint with optional checks args: - --rcfile=.pylintrc - --exit-zero verbose: true - additional_dependencies: &pylint_deps - - pylint-odoo==5.0.5 - - id: pylint - name: pylint with mandatory checks + - id: pylint_odoo args: - --rcfile=.pylintrc-mandatory - additional_dependencies: *pylint_deps diff --git a/.pylintrc b/.pylintrc index e33958833edc..d1f72970bc35 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,3 +1,5 @@ + + [MASTER] load-plugins=pylint_odoo score=n diff --git a/.pylintrc-mandatory b/.pylintrc-mandatory index 08bca3cefef2..3bf8ceefbc6a 100644 --- a/.pylintrc-mandatory +++ b/.pylintrc-mandatory @@ -1,3 +1,4 @@ + [MASTER] load-plugins=pylint_odoo score=n diff --git a/README.md b/README.md index 7134a673866a..57cbd949e267 100644 --- a/README.md +++ b/README.md @@ -26,37 +26,41 @@ Available addons ---------------- addon | version | maintainers | summary --- | --- | --- | --- -[support_branding](support_branding/) | 14.0.1.0.0 | | Adds your branding to an Odoo instance -[web_access_rule_buttons](web_access_rule_buttons/) | 14.0.1.0.0 | | Disable Edit button if access rules prevent this action +[support_branding](support_branding/) | 14.0.1.0.1 | | Adds your branding to an Odoo instance +[web_access_rule_buttons](web_access_rule_buttons/) | 14.0.1.0.1 | | Disable Edit button if access rules prevent this action [web_action_conditionable](web_action_conditionable/) | 14.0.1.0.1 | | web_action_conditionable [web_advanced_search](web_advanced_search/) | 14.0.1.0.1 | | Easier and more powerful searching tools [web_calendar_color_field](web_calendar_color_field/) | 14.0.1.0.0 | | Calendar Color Field [web_calendar_slot_duration](web_calendar_slot_duration/) | 14.0.1.0.0 | [![Yajo](https://github.com/Yajo.png?size=30px)](https://github.com/Yajo) | Customizable calendar slot durations -[web_company_color](web_company_color/) | 14.0.1.1.0 | | Web Company Color +[web_company_color](web_company_color/) | 14.0.2.0.0 | | Web Company Color [web_copy_confirm](web_copy_confirm/) | 14.0.1.0.0 | | Show confirmation dialogue before copying records +[web_create_write_confirm](web_create_write_confirm/) | 14.0.1.0.0 | | Confirm/Alert pop-up before saving [web_decimal_numpad_dot](web_decimal_numpad_dot/) | 14.0.1.0.0 | | Allows using numpad dot to enter period decimal separator [web_dialog_size](web_dialog_size/) | 14.0.1.0.0 | | A module that lets the user expand a dialog box to the full screen width. -[web_disable_export_group](web_disable_export_group/) | 14.0.1.0.0 | | Web Disable Export Group -[web_domain_field](web_domain_field/) | 14.0.1.0.0 | | Use computed field as domain -[web_drop_target](web_drop_target/) | 14.0.1.1.0 | | Allows to drag files into Odoo +[web_disable_export_group](web_disable_export_group/) | 14.0.2.0.0 | | Web Disable Export Group +[web_domain_field](web_domain_field/) | 14.0.1.0.2 | | Use computed field as domain +[web_drop_target](web_drop_target/) | 14.0.1.1.1 | | Allows to drag files into Odoo [web_environment_ribbon](web_environment_ribbon/) | 14.0.1.0.0 | | Web Environment Ribbon +[web_field_required_invisible_manager](web_field_required_invisible_manager/) | 14.0.2.1.0 | [![ilyasProgrammer](https://github.com/ilyasProgrammer.png?size=30px)](https://github.com/ilyasProgrammer) | Web Field Required Invisible Readonly Managerr [web_group_expand](web_group_expand/) | 14.0.1.0.0 | | Group Expand Buttons -[web_ir_actions_act_multi](web_ir_actions_act_multi/) | 14.0.1.0.0 | | Enables triggering of more than one action on ActionManager -[web_ir_actions_act_view_reload](web_ir_actions_act_view_reload/) | 14.0.1.0.0 | | Enables reload of the current view via ActionManager -[web_ir_actions_act_window_message](web_ir_actions_act_window_message/) | 14.0.1.0.0 | | Show a message box to users +[web_ir_actions_act_multi](web_ir_actions_act_multi/) | 14.0.1.0.1 | | Enables triggering of more than one action on ActionManager +[web_ir_actions_act_view_reload](web_ir_actions_act_view_reload/) | 14.0.1.0.2 | | Enables reload of the current view via ActionManager +[web_ir_actions_act_window_message](web_ir_actions_act_window_message/) | 14.0.1.0.1 | | Show a message box to users [web_listview_range_select](web_listview_range_select/) | 14.0.1.0.0 | | Enables selecting a range of records using the shift key -[web_m2x_options](web_m2x_options/) | 14.0.1.1.0 | | web_m2x_options +[web_m2x_options](web_m2x_options/) | 14.0.1.1.1 | | web_m2x_options [web_m2x_options_manager](web_m2x_options_manager/) | 14.0.1.1.0 | | Adds an interface to manage the "Create" and "Create and Edit" options for specific models and fields. [web_no_bubble](web_no_bubble/) | 14.0.1.0.0 | | Remove the bubbles from the web interface [web_notify](web_notify/) | 14.0.1.0.1 | | Send notification messages to user +[web_notify_channel_message](web_notify_channel_message/) | 14.0.1.0.0 | | Send an instant notification to channel users when a new message is posted [web_pwa_oca](web_pwa_oca/) | 14.0.1.0.0 | [![eLBati](https://github.com/eLBati.png?size=30px)](https://github.com/eLBati) | Make Odoo a PWA -[web_refresher](web_refresher/) | 14.0.1.0.0 | | Web Refresher -[web_responsive](web_responsive/) | 14.0.1.2.0 | [![Yajo](https://github.com/Yajo.png?size=30px)](https://github.com/Yajo) [![Tardo](https://github.com/Tardo.png?size=30px)](https://github.com/Tardo) | Responsive web client, community-supported -[web_search_with_and](web_search_with_and/) | 14.0.1.0.0 | | Use AND conditions on omnibar search +[web_refresher](web_refresher/) | 14.0.2.0.0 | | Web Refresher +[web_remember_tree_column_width](web_remember_tree_column_width/) | 14.0.1.0.0 | [![frahikLV](https://github.com/frahikLV.png?size=30px)](https://github.com/frahikLV) [![luisg123v](https://github.com/luisg123v.png?size=30px)](https://github.com/luisg123v) | Remember the tree columns' widths across sessions. +[web_responsive](web_responsive/) | 14.0.1.2.2 | [![Yajo](https://github.com/Yajo.png?size=30px)](https://github.com/Yajo) [![Tardo](https://github.com/Tardo.png?size=30px)](https://github.com/Tardo) | Responsive web client, community-supported +[web_search_with_and](web_search_with_and/) | 14.0.1.0.1 | | Use AND conditions on omnibar search [web_send_message_popup](web_send_message_popup/) | 14.0.1.0.0 | | Web Send Message as Popup [web_sheet_full_width](web_sheet_full_width/) | 14.0.1.0.1 | | Use the whole available screen width when displaying sheets [web_switch_context_warning](web_switch_context_warning/) | 14.0.1.0.0 | | Show a warning if current user, company or database have been switched in another tab or window. -[web_timeline](web_timeline/) | 14.0.2.0.0 | [![tarteo](https://github.com/tarteo.png?size=30px)](https://github.com/tarteo) | Interactive visualization chart to show events in time +[web_timeline](web_timeline/) | 14.0.2.0.2 | [![tarteo](https://github.com/tarteo.png?size=30px)](https://github.com/tarteo) | Interactive visualization chart to show events in time [web_tree_dynamic_colored_field](web_tree_dynamic_colored_field/) | 14.0.1.0.0 | | Allows you to dynamically color fields on tree views [web_tree_image_tooltip](web_tree_image_tooltip/) | 14.0.1.0.0 | | Show images in tree views via tooltip [web_tree_many2one_clickable](web_tree_many2one_clickable/) | 14.0.1.0.2 | | Open the linked resource when clicking on their name @@ -65,10 +69,13 @@ addon | version | maintainers | summary [web_widget_char_size](web_widget_char_size/) | 14.0.1.0.1 | | Add size option to Char widget [web_widget_child_selector](web_widget_child_selector/) | 14.0.1.0.1 | | Widget used for navigation on hierarchy fields [web_widget_ckeditor](web_widget_ckeditor/) | 14.0.1.0.2 | [![ivantodorovich](https://github.com/ivantodorovich.png?size=30px)](https://github.com/ivantodorovich) | Provides a widget for editing HTML fields using CKEditor +[web_widget_datepicker_fulloptions](web_widget_datepicker_fulloptions/) | 14.0.1.0.0 | | Web Widget DatePicker Full Options [web_widget_domain_editor_dialog](web_widget_domain_editor_dialog/) | 14.0.1.0.1 | | Recovers the Domain Editor Dialog functionality [web_widget_dropdown_dynamic](web_widget_dropdown_dynamic/) | 14.0.1.0.0 | | This module adds support for dynamic dropdown widget [web_widget_image_download](web_widget_image_download/) | 14.0.1.0.0 | | Allows to download any image from its widget +[web_widget_image_webcam](web_widget_image_webcam/) | 14.0.1.0.1 | | Allows to take image with WebCam [web_widget_many2one_simple](web_widget_many2one_simple/) | 14.0.1.0.0 | [![Tardo](https://github.com/Tardo.png?size=30px)](https://github.com/Tardo) | Simple many2one widget +[web_widget_mermaid](web_widget_mermaid/) | 14.0.1.0.0 | | Render mermaid markdown flowcharts [web_widget_model_viewer](web_widget_model_viewer/) | 14.0.1.0.0 | [![eLBati](https://github.com/eLBati.png?size=30px)](https://github.com/eLBati) | Easily display interactive 3D models on the web & in AR [web_widget_mpld3_chart](web_widget_mpld3_chart/) | 14.0.1.0.0 | | This widget allows to display charts using MPLD3 library. [web_widget_numeric_step](web_widget_numeric_step/) | 14.0.1.0.0 | | Web Widget Numeric Step @@ -76,7 +83,7 @@ addon | version | maintainers | summary [web_widget_plotly_chart](web_widget_plotly_chart/) | 14.0.1.0.0 | [![robyf70](https://github.com/robyf70.png?size=30px)](https://github.com/robyf70) | Allow to draw plotly charts. [web_widget_text_markdown](web_widget_text_markdown/) | 14.0.1.0.0 | | Widget to text fields that adds markdown support [web_widget_url_advanced](web_widget_url_advanced/) | 14.0.1.0.1 | | This module extends URL widget for displaying anchors with custom labels. -[web_widget_x2many_2d_matrix](web_widget_x2many_2d_matrix/) | 14.0.1.0.1 | | Show list fields as a matrix +[web_widget_x2many_2d_matrix](web_widget_x2many_2d_matrix/) | 14.0.1.1.1 | | Show list fields as a matrix [//]: # (end addons) diff --git a/setup/_metapackage/VERSION.txt b/setup/_metapackage/VERSION.txt index 4b83d7986133..30016d10de88 100644 --- a/setup/_metapackage/VERSION.txt +++ b/setup/_metapackage/VERSION.txt @@ -1 +1 @@ -14.0.20220830.0 \ No newline at end of file +14.0.20230724.0 \ No newline at end of file diff --git a/setup/_metapackage/setup.py b/setup/_metapackage/setup.py index 286824fd2ebb..a37f77bd72fd 100644 --- a/setup/_metapackage/setup.py +++ b/setup/_metapackage/setup.py @@ -16,12 +16,14 @@ 'odoo14-addon-web_calendar_slot_duration', 'odoo14-addon-web_company_color', 'odoo14-addon-web_copy_confirm', + 'odoo14-addon-web_create_write_confirm', 'odoo14-addon-web_decimal_numpad_dot', 'odoo14-addon-web_dialog_size', 'odoo14-addon-web_disable_export_group', 'odoo14-addon-web_domain_field', 'odoo14-addon-web_drop_target', 'odoo14-addon-web_environment_ribbon', + 'odoo14-addon-web_field_required_invisible_manager', 'odoo14-addon-web_group_expand', 'odoo14-addon-web_ir_actions_act_multi', 'odoo14-addon-web_ir_actions_act_view_reload', @@ -31,8 +33,10 @@ 'odoo14-addon-web_m2x_options_manager', 'odoo14-addon-web_no_bubble', 'odoo14-addon-web_notify', + 'odoo14-addon-web_notify_channel_message', 'odoo14-addon-web_pwa_oca', 'odoo14-addon-web_refresher', + 'odoo14-addon-web_remember_tree_column_width', 'odoo14-addon-web_responsive', 'odoo14-addon-web_search_with_and', 'odoo14-addon-web_send_message_popup', @@ -47,10 +51,13 @@ 'odoo14-addon-web_widget_char_size', 'odoo14-addon-web_widget_child_selector', 'odoo14-addon-web_widget_ckeditor', + 'odoo14-addon-web_widget_datepicker_fulloptions', 'odoo14-addon-web_widget_domain_editor_dialog', 'odoo14-addon-web_widget_dropdown_dynamic', 'odoo14-addon-web_widget_image_download', + 'odoo14-addon-web_widget_image_webcam', 'odoo14-addon-web_widget_many2one_simple', + 'odoo14-addon-web_widget_mermaid', 'odoo14-addon-web_widget_model_viewer', 'odoo14-addon-web_widget_mpld3_chart', 'odoo14-addon-web_widget_numeric_step', diff --git a/setup/web_create_write_confirm/odoo/addons/web_create_write_confirm b/setup/web_create_write_confirm/odoo/addons/web_create_write_confirm new file mode 120000 index 000000000000..46be3cc1723e --- /dev/null +++ b/setup/web_create_write_confirm/odoo/addons/web_create_write_confirm @@ -0,0 +1 @@ +../../../../web_create_write_confirm \ No newline at end of file diff --git a/setup/web_create_write_confirm/setup.py b/setup/web_create_write_confirm/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_create_write_confirm/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_field_required_invisible_manager/odoo/addons/web_field_required_invisible_manager b/setup/web_field_required_invisible_manager/odoo/addons/web_field_required_invisible_manager new file mode 120000 index 000000000000..f9629c884f49 --- /dev/null +++ b/setup/web_field_required_invisible_manager/odoo/addons/web_field_required_invisible_manager @@ -0,0 +1 @@ +../../../../web_field_required_invisible_manager \ No newline at end of file diff --git a/setup/web_field_required_invisible_manager/setup.py b/setup/web_field_required_invisible_manager/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_field_required_invisible_manager/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_notify_channel_message/odoo/addons/web_notify_channel_message b/setup/web_notify_channel_message/odoo/addons/web_notify_channel_message new file mode 120000 index 000000000000..2f4f9a844f90 --- /dev/null +++ b/setup/web_notify_channel_message/odoo/addons/web_notify_channel_message @@ -0,0 +1 @@ +../../../../web_notify_channel_message \ No newline at end of file diff --git a/setup/web_notify_channel_message/setup.py b/setup/web_notify_channel_message/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_notify_channel_message/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_remember_tree_column_width/odoo/addons/web_remember_tree_column_width b/setup/web_remember_tree_column_width/odoo/addons/web_remember_tree_column_width new file mode 120000 index 000000000000..b0895ab19879 --- /dev/null +++ b/setup/web_remember_tree_column_width/odoo/addons/web_remember_tree_column_width @@ -0,0 +1 @@ +../../../../web_remember_tree_column_width \ No newline at end of file diff --git a/setup/web_remember_tree_column_width/setup.py b/setup/web_remember_tree_column_width/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_remember_tree_column_width/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_widget_datepicker_fulloptions/odoo/addons/web_widget_datepicker_fulloptions b/setup/web_widget_datepicker_fulloptions/odoo/addons/web_widget_datepicker_fulloptions new file mode 120000 index 000000000000..83d8cdadd5de --- /dev/null +++ b/setup/web_widget_datepicker_fulloptions/odoo/addons/web_widget_datepicker_fulloptions @@ -0,0 +1 @@ +../../../../web_widget_datepicker_fulloptions \ No newline at end of file diff --git a/setup/web_widget_datepicker_fulloptions/setup.py b/setup/web_widget_datepicker_fulloptions/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_widget_datepicker_fulloptions/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_widget_html_markdown/odoo/addons/web_widget_html_markdown b/setup/web_widget_html_markdown/odoo/addons/web_widget_html_markdown new file mode 120000 index 000000000000..771299155630 --- /dev/null +++ b/setup/web_widget_html_markdown/odoo/addons/web_widget_html_markdown @@ -0,0 +1 @@ +../../../../web_widget_html_markdown \ No newline at end of file diff --git a/setup/web_widget_html_markdown/setup.py b/setup/web_widget_html_markdown/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_widget_html_markdown/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_widget_image_webcam/odoo/addons/web_widget_image_webcam b/setup/web_widget_image_webcam/odoo/addons/web_widget_image_webcam new file mode 120000 index 000000000000..21d7b390bf4e --- /dev/null +++ b/setup/web_widget_image_webcam/odoo/addons/web_widget_image_webcam @@ -0,0 +1 @@ +../../../../web_widget_image_webcam \ No newline at end of file diff --git a/setup/web_widget_image_webcam/setup.py b/setup/web_widget_image_webcam/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_widget_image_webcam/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_widget_mermaid/odoo/addons/web_widget_mermaid b/setup/web_widget_mermaid/odoo/addons/web_widget_mermaid new file mode 120000 index 000000000000..b8e019e4d739 --- /dev/null +++ b/setup/web_widget_mermaid/odoo/addons/web_widget_mermaid @@ -0,0 +1 @@ +../../../../web_widget_mermaid \ No newline at end of file diff --git a/setup/web_widget_mermaid/setup.py b/setup/web_widget_mermaid/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_widget_mermaid/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/support_branding/README.rst b/support_branding/README.rst index 18faf9ab050f..858a6e852e4c 100644 --- a/support_branding/README.rst +++ b/support_branding/README.rst @@ -2,10 +2,13 @@ Support Branding ================ -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:d1dcdd3f58c7e86333a318988a39d7f43236e188d4246adc81561c66c774a110 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status @@ -19,11 +22,11 @@ Support Branding .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png :target: https://translation.odoo-community.org/projects/web-14-0/web-14-0-support_branding :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/162/14.0 - :alt: Try me on Runbot +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=14.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| If you run an Odoo support company and you support customers without an OPW, you can brand the Odoo instance accordingly using this module. This module will @@ -40,7 +43,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us smashing it by providing a detailed and welcomed +If you spotted it first, help us to smash it by providing a detailed and welcomed `feedback `_. Do not contact contributors directly about support or help with technical issues. diff --git a/support_branding/__manifest__.py b/support_branding/__manifest__.py index 94c4d76b490f..852b39b32271 100644 --- a/support_branding/__manifest__.py +++ b/support_branding/__manifest__.py @@ -8,7 +8,7 @@ "name": "Support Branding", "summary": "Adds your branding to an Odoo instance", "category": "Hidden/Tools", - "version": "14.0.1.0.0", + "version": "14.0.1.0.1", "license": "AGPL-3", "author": "Therp BV,Sunflower IT,Odoo Community Association (OCA)", "website": "https://github.com/OCA/web", diff --git a/support_branding/i18n/it.po b/support_branding/i18n/it.po new file mode 100644 index 000000000000..4f85920128b2 --- /dev/null +++ b/support_branding/i18n/it.po @@ -0,0 +1,199 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * support_branding +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "" +"Add a branding color\n" +" e.g #b163a3" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "" +"Add the support company URL\n" +" e.g https://odoo-community.org" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "" +"Add the support company name\n" +" e.g Odoo Community Association " +"(OCA)" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "" +"Add the support email to send issues\n" +" e.g info@helpdesksupport.com" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "Add the support release" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__support_branding_color +msgid "Branding color" +msgstr "" + +#. module: support_branding +#: model:ir.model,name:support_branding.model_res_company +msgid "Companies" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__support_company +msgid "Company Name" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__support_company_url +msgid "Company URL" +msgstr "" + +#. module: support_branding +#: model:ir.model,name:support_branding.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "Creates an error (i.e ZeroDivisionError) to test support branding" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_company__display_name +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__display_name +msgid "Display Name" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/js/support_branding.js:0 +#, python-format +msgid "Email to %s" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "" +"Email to support\n" +" company" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "For Support visit our" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_company__id +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__id +msgid "ID" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_company____last_update +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings____last_update +msgid "Last Modified on" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "Please fill in how you produced this error..." +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "Support Company Settings" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "Support Settings" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__support_email +msgid "Support email" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__support_release +msgid "Support release" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "Technical Support By" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "Test Support Branding" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "" +"The below button generates a\n" +" division by zero python error " +"which\n" +" allows a user to test the " +"modules\n" +" functionality." +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "Use HTML Editor" +msgstr "" + +#. module: support_branding +#: code:addons/support_branding/models/res_company.py:0 +#, python-format +msgid "" +"You are not allowed to access this functionality, please contact Admin for " +"more support" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "or mail us at" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "website" +msgstr "" diff --git a/support_branding/i18n/nl.po b/support_branding/i18n/nl.po index 6c9c84f4c02e..e31f3c49e188 100644 --- a/support_branding/i18n/nl.po +++ b/support_branding/i18n/nl.po @@ -17,33 +17,196 @@ msgstr "" "Plural-Forms: \n" #. module: support_branding -#: model:ir.ui.view,arch_db:support_branding.menu_secondary -msgid ", supported by" -msgstr ", ondersteund door" +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "" +"Add a branding color\n" +" e.g #b163a3" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "" +"Add the support company URL\n" +" e.g https://odoo-community.org" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "" +"Add the support company name\n" +" e.g Odoo Community Association " +"(OCA)" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "" +"Add the support email to send issues\n" +" e.g info@helpdesksupport.com" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "Add the support release" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__support_branding_color +msgid "Branding color" +msgstr "" + +#. module: support_branding +#: model:ir.model,name:support_branding.model_res_company +msgid "Companies" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__support_company +msgid "Company Name" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__support_company_url +msgid "Company URL" +msgstr "" + +#. module: support_branding +#: model:ir.model,name:support_branding.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "Creates an error (i.e ZeroDivisionError) to test support branding" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_company__display_name +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__display_name +msgid "Display Name" +msgstr "" #. module: support_branding #. openerp-web -#: code:addons/support_branding/static/src/js/support_branding.js:88 +#: code:addons/support_branding/static/src/js/support_branding.js:0 #, python-format msgid "Email to %s" msgstr "E-mail naar %s" #. module: support_branding #. openerp-web -#: code:addons/support_branding/static/src/xml/base.xml:12 +#: code:addons/support_branding/static/src/xml/base.xml:0 #, python-format -msgid "Email to support company" -msgstr "E-mail naar ondersteunend bedrijf" +msgid "" +"Email to support\n" +" company" +msgstr "" #. module: support_branding #. openerp-web -#: code:addons/support_branding/static/src/xml/base.xml:10 +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "For Support visit our" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_company__id +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__id +msgid "ID" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_company____last_update +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings____last_update +msgid "Last Modified on" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:0 #, python-format msgid "Please fill in how you produced this error..." msgstr "Beschrijft u alstublieft de stappen om deze fout te reproduceren..." #. module: support_branding -#: model:ir.ui.view,arch_db:support_branding.menu_secondary +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "Support Company Settings" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "Support Settings" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__support_email +msgid "Support email" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__support_release +msgid "Support release" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "Technical Support By" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "Test Support Branding" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "" +"The below button generates a\n" +" division by zero python error " +"which\n" +" allows a user to test the " +"modules\n" +" functionality." +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "Use HTML Editor" +msgstr "" + +#. module: support_branding +#: code:addons/support_branding/models/res_company.py:0 +#, python-format +msgid "" +"You are not allowed to access this functionality, please contact Admin for " +"more support" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "or mail us at" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "website" +msgstr "" + +#~ msgid ", supported by" +#~ msgstr ", ondersteund door" + +#, python-format +#~ msgid "Email to support company" +#~ msgstr "E-mail naar ondersteunend bedrijf" + #, fuzzy -msgid "Version" -msgstr "Versie " +#~ msgid "Version" +#~ msgstr "Versie " diff --git a/support_branding/i18n/sl.po b/support_branding/i18n/sl.po index 461e0034663b..004266ab9015 100644 --- a/support_branding/i18n/sl.po +++ b/support_branding/i18n/sl.po @@ -19,33 +19,196 @@ msgstr "" "X-Generator: Poedit 1.8.2\n" #. module: support_branding -#: model:ir.ui.view,arch_db:support_branding.menu_secondary -msgid ", supported by" -msgstr ", podpora" +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "" +"Add a branding color\n" +" e.g #b163a3" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "" +"Add the support company URL\n" +" e.g https://odoo-community.org" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "" +"Add the support company name\n" +" e.g Odoo Community Association " +"(OCA)" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "" +"Add the support email to send issues\n" +" e.g info@helpdesksupport.com" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "Add the support release" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__support_branding_color +msgid "Branding color" +msgstr "" + +#. module: support_branding +#: model:ir.model,name:support_branding.model_res_company +msgid "Companies" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__support_company +msgid "Company Name" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__support_company_url +msgid "Company URL" +msgstr "" + +#. module: support_branding +#: model:ir.model,name:support_branding.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "Creates an error (i.e ZeroDivisionError) to test support branding" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_company__display_name +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__display_name +msgid "Display Name" +msgstr "" #. module: support_branding #. openerp-web -#: code:addons/support_branding/static/src/js/support_branding.js:88 +#: code:addons/support_branding/static/src/js/support_branding.js:0 #, python-format msgid "Email to %s" msgstr "E-pošta za %s" #. module: support_branding #. openerp-web -#: code:addons/support_branding/static/src/xml/base.xml:12 -#, fuzzy, python-format -msgid "Email to support company" -msgstr "E-pošta za družbo" +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "" +"Email to support\n" +" company" +msgstr "" #. module: support_branding #. openerp-web -#: code:addons/support_branding/static/src/xml/base.xml:10 +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "For Support visit our" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_company__id +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__id +msgid "ID" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_company____last_update +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings____last_update +msgid "Last Modified on" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:0 #, python-format msgid "Please fill in how you produced this error..." msgstr "Opišite, kako ste prišli do te napake..." #. module: support_branding -#: model:ir.ui.view,arch_db:support_branding.menu_secondary +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "Support Company Settings" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "Support Settings" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__support_email +msgid "Support email" +msgstr "" + +#. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_config_settings__support_release +msgid "Support release" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "Technical Support By" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "Test Support Branding" +msgstr "" + +#. module: support_branding +#: model_terms:ir.ui.view,arch_db:support_branding.support_res_config_settings_view_form +msgid "" +"The below button generates a\n" +" division by zero python error " +"which\n" +" allows a user to test the " +"modules\n" +" functionality." +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "Use HTML Editor" +msgstr "" + +#. module: support_branding +#: code:addons/support_branding/models/res_company.py:0 +#, python-format +msgid "" +"You are not allowed to access this functionality, please contact Admin for " +"more support" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "or mail us at" +msgstr "" + +#. module: support_branding +#. openerp-web +#: code:addons/support_branding/static/src/xml/base.xml:0 +#, python-format +msgid "website" +msgstr "" + +#~ msgid ", supported by" +#~ msgstr ", podpora" + +#, fuzzy, python-format +#~ msgid "Email to support company" +#~ msgstr "E-pošta za družbo" + #, fuzzy -msgid "Version" -msgstr "Verzija" +#~ msgid "Version" +#~ msgstr "Verzija" diff --git a/support_branding/i18n/support_branding.pot b/support_branding/i18n/support_branding.pot index 72fd297d899a..c421660489af 100644 --- a/support_branding/i18n/support_branding.pot +++ b/support_branding/i18n/support_branding.pot @@ -51,6 +51,11 @@ msgstr "" msgid "Branding color" msgstr "" +#. module: support_branding +#: model:ir.model,name:support_branding.model_res_company +msgid "Companies" +msgstr "" + #. module: support_branding #: model:ir.model.fields,field_description:support_branding.field_res_config_settings__support_company msgid "Company Name" @@ -72,6 +77,7 @@ msgid "Creates an error (i.e ZeroDivisionError) to test support branding" msgstr "" #. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_company__display_name #: model:ir.model.fields,field_description:support_branding.field_res_config_settings__display_name msgid "Display Name" msgstr "" @@ -100,11 +106,13 @@ msgid "For Support visit our" msgstr "" #. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_company__id #: model:ir.model.fields,field_description:support_branding.field_res_config_settings__id msgid "ID" msgstr "" #. module: support_branding +#: model:ir.model.fields,field_description:support_branding.field_res_company____last_update #: model:ir.model.fields,field_description:support_branding.field_res_config_settings____last_update msgid "Last Modified on" msgstr "" @@ -164,6 +172,14 @@ msgstr "" msgid "Use HTML Editor" msgstr "" +#. module: support_branding +#: code:addons/support_branding/models/res_company.py:0 +#, python-format +msgid "" +"You are not allowed to access this functionality, please contact Admin for " +"more support" +msgstr "" + #. module: support_branding #. openerp-web #: code:addons/support_branding/static/src/xml/base.xml:0 diff --git a/support_branding/models/__init__.py b/support_branding/models/__init__.py index 4124bd743b0e..c873322e070e 100644 --- a/support_branding/models/__init__.py +++ b/support_branding/models/__init__.py @@ -2,3 +2,4 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from . import res_config_settings +from . import res_company diff --git a/support_branding/models/res_company.py b/support_branding/models/res_company.py new file mode 100644 index 000000000000..875fc5b1e88b --- /dev/null +++ b/support_branding/models/res_company.py @@ -0,0 +1,27 @@ +# Copyright 2023 Sunflower IT +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import _, api, models +from odoo.exceptions import AccessError + + +class ResCompany(models.Model): + _inherit = "res.company" + + @api.model + def get_support_branding_config_param_data(self): + if not self.env.user.has_group("base.group_user"): + raise AccessError( + _( + "You are not allowed to access this " + "functionality, please contact Admin for " + "more support" + ) + ) + self.env.cr.execute( + "select key, value from ir_config_parameter where key ilike " "'support_%';" + ) + res = self.env.cr.dictfetchall() + if any(res): + support_vals = {x["key"]: x["value"] for x in res} + return support_vals diff --git a/support_branding/static/description/index.html b/support_branding/static/description/index.html index 8ce513490e69..04bc548af9ba 100644 --- a/support_branding/static/description/index.html +++ b/support_branding/static/description/index.html @@ -1,20 +1,20 @@ - + - + Support Branding + + +
+

Confirm/Alert pop-up before saving

+ + +

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runboat

+

This module provides feature to create custom confirmation or alert dialog when user creates or writes record. +Module includes only methods that you can use in your code. That means programming is always required. +See usage section for more information.

+

Table of contents

+ +
+

Usage

+

Create popup.message record. Specify model_id, field_ids (which fields will trigger alert) and other fields. +Put you code into get_message_informations or execute_processing method of you model. +Return dict (perform read() to get it). +Here is some examples how you can use this module features in your code.

+

Confirm res.partner change:

+
+msg = self.env['popup.message'].create(
+    {
+        'model_id': self.env['ir.model'].search([('model', '=', 'res.partner')]).id,
+        'field_ids': [(6, 0, self.env['ir.model.fields'].search([('model', '=', 'res.partner')]).ids)],
+        'popup_type': 'confirm',
+        'title': 'Warning',
+        'message': 'Are you sure want to update record?',
+    }
+)
+return msg.read()
+
+

Sale order alert:

+
+msg = self.env['popup.message'].create(
+    {
+        'model_id': self.env['ir.model'].search([('model', '=', 'sale.order')]).id,
+        'field_ids': [(6, 0, self.env['ir.model.fields'].search([('model', '=', 'sale.order')]).ids)],
+        'popup_type': 'alert',
+        'title': 'Attention',
+        'message': 'Sale order was updated.',
+    }
+)
+return msg.read()
+
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Smile
  • +
+
+ +
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/web project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/web_create_write_confirm/static/src/js/pop_up_confirmation.js b/web_create_write_confirm/static/src/js/pop_up_confirmation.js new file mode 100644 index 000000000000..815c0e3dbcc8 --- /dev/null +++ b/web_create_write_confirm/static/src/js/pop_up_confirmation.js @@ -0,0 +1,107 @@ +odoo.define("web_create_write_confirm.pop_up_confirmation", function (require) { + "use strict"; + + var FormController = require("web.FormController"); + var Dialog = require("web.Dialog"); + + FormController.include({ + getMessageInformation: function (model, nameFunction, record_id, values) { + return this._rpc({ + model: model, + method: nameFunction, + args: [record_id, values], + }); + }, + + _onSave: function (ev) { + var self = this; + var modelName = self.modelName ? self.modelName : false; + var record = self.model.get(self.handle, {raw: true}); + var record_id = + record && record.data && record.data.id ? record.data.id : false; + var changes = self.model.localData[self.handle]._changes; + self.getMessageInformation( + modelName, + "get_message_informations", + record_id, + changes === null ? {} : changes + ).then(function (results) { + this.display_popup(results, record, record_id, ev, changes, modelName); + }); + }, + + display_popup: function ( + popup_values, + record, + record_id, + ev, + changes, + modelName + ) { + var self = this; + var index = 0; + var datas = []; + new Promise(function (resolve) { + if ( + typeof popup_values !== "undefined" && + typeof popup_values !== "boolean" && + popup_values.length + ) { + if (popup_values[index].popup_type === "confirm") { + Dialog.confirm(self, popup_values[index].message, { + title: popup_values[index].title, + confirm_callback: async () => { + var field_names = popup_values[index].field_name.split( + "," + ); + for (var j = 0; j < field_names.length; j++) { + datas.push({ + name: field_names[j], + value: + changes && changes[field_names[j]] + ? changes[field_names[j]] + : record.data[field_names[j]] === "" + ? record.data[field_names[j]] + : false, + }); + } + index++; + if (popup_values.length > index) { + this.display_popup( + popup_values, + record, + record_id, + ev + ); + } else if (popup_values.length === index) { + self.getMessageInformation( + modelName, + "execute_processing", + record_id, + datas + ); + this.save(ev); + } + }, + }).on("closed", null, resolve); + } else if (popup_values[index].popup_type === "alert") { + Dialog.alert(self, popup_values[index].message, { + title: popup_values[index].title, + }); + } + } else { + this.save(ev); + } + }); + }, + + save: function ev() { + var self = this; + ev.stopPropagation(); + self._disableButtons(); + self.saveRecord() + .then(self._enableButtons.bind(self)) + .guardedCatch(self._enableButtons.bind(self)); + }, + }); +}); diff --git a/web_create_write_confirm/tests/__init__.py b/web_create_write_confirm/tests/__init__.py new file mode 100644 index 000000000000..9e7f8acd23f5 --- /dev/null +++ b/web_create_write_confirm/tests/__init__.py @@ -0,0 +1 @@ +from . import test_base_model diff --git a/web_create_write_confirm/tests/test_base_model.py b/web_create_write_confirm/tests/test_base_model.py new file mode 100644 index 000000000000..7f10553fa44d --- /dev/null +++ b/web_create_write_confirm/tests/test_base_model.py @@ -0,0 +1,55 @@ +from odoo.tests.common import SavepointCase + + +class TestBaseModel(SavepointCase): + @classmethod + def setUpClass(cls): + super(TestBaseModel, cls).setUpClass() + cls.base_model = cls.env["base"] + + def test_compute_field_name(self): + """Test correct flow of changing field_name""" + model_field_name = self.env["ir.model.fields"]._get( + "popup.message", "field_name" + ) + vals = { + "model_id": model_field_name.model_id.id, + "field_ids": model_field_name, + "message": "test", + } + test_popup_message = self.env["popup.message"].sudo().create(vals) + self.assertEqual( + test_popup_message.field_name, + model_field_name.name, + msg="Must be equal to name of 'ir.model.fields' field", + ) + + model_field_title = self.env["ir.model.fields"]._get("popup.message", "title") + vals.update({"field_ids": (model_field_name.id, model_field_title.id)}) + test_popup_message_cycle = self.env["popup.message"].sudo().create(vals) + field_name = model_field_name.name + "," + model_field_title.name + self.assertEqual( + test_popup_message_cycle.field_name, + field_name, + msg="Must be equal to 2 join name of 'ir.model.fields' fields", + ) + + def test_get_message_informations(self): + """Test correct flow of get_message_informations method""" + ret_value_of_method = self.base_model.get_message_informations() + check_ret_value = False + if (ret_value_of_method is False) or isinstance( + ret_value_of_method, type(self.env["popup.message"]) + ): + check_ret_value = True + self.assertTrue( + check_ret_value, + msg="Return value must be False or dictionary of popup.message objects", + ) + self.env["popup.message"]._compute_field_name() + + def test_execute_processing(self): + """Test correct flow of execute_processing method""" + self.assertFalse( + self.base_model.execute_processing(), msg="Return value must be False" + ) diff --git a/web_create_write_confirm/views/assets.xml b/web_create_write_confirm/views/assets.xml new file mode 100644 index 000000000000..6aec517ebf18 --- /dev/null +++ b/web_create_write_confirm/views/assets.xml @@ -0,0 +1,15 @@ + + + + +