Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing from upstream OCA/server-tools (17.0) #1376

Merged
merged 3 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
exclude: |
(?x)
# NOT INSTALLABLE ADDONS
^views_migration_17/|
# END NOT INSTALLABLE ADDONS
# Files and folders generated by bots, to avoid loops
^setup/|/static/description/index\.html$|
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ addon | version | maintainers | summary
--- | --- | --- | ---
[module_change_auto_install](module_change_auto_install/) | 17.0.1.0.0 | [![legalsylvain](https://github.com/legalsylvain.png?size=30px)](https://github.com/legalsylvain) | Customize auto installables modules by configuration


Unported addons
---------------
addon | version | maintainers | summary
--- | --- | --- | ---
[views_migration_17](views_migration_17/) | 17.0.1.0.0 (unported) | | Views Migration to v17

[//]: # (end addons)

<!-- prettier-ignore-end -->
Expand Down
56 changes: 56 additions & 0 deletions views_migration_17/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. image:: https://img.shields.io/badge/python-3.6-blue.svg
:alt: Python support: 3.6
.. image:: https://app.travis-ci.com/OCA/odoo-module-migrator.svg?branch=master
:target: https://app.travis-ci.com/OCA/odoo-module-migrator

====================
Views-migration-v17
====================

``views-migration-v17`` is a odoo server mode module that allows you to automatically migrate the views of a Odoo module versión <= v16 to v17 .

For example::

<field name="test_field_1" attrs="{'invisible': [('active', '=', True)]}"/>
<field name="test_field_2" attrs="{'invisible': [('zip', '!=', 123)]}"/>
<field name="test_field_3" attrs="{'readonly': [('zip', '!=', False)]}"/>

To::

<field name="test_field_1" invisible="active"/>
<field name="test_field_2" invisible="zip != 123"/>
<field name="test_field_3" readonly="zip"/>


Usage
=====

This module is not installable, to use this module, you need to:

1. Run odoo with this module as a server module:

.. code-block:: shell

odoo -d DATABASE_NAME -i MODULE_TO_MIGRATE --load=base,web,views_migration_17 --stop-after-init


2. If success the modifications will be in the source code of your module.


Credits
=======

Authors
-------
* ADHOC SA


Contributors
------------
* `ADHOC SA <https://www.adhoc.com.ar>`_:

* Juan José Scarafía <[email protected]>
* Bruno Zanotti <[email protected]>
18 changes: 18 additions & 0 deletions views_migration_17/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from . import patch_xml_import # patch xml_import so that view is fixed

# patch vies so that they don't break
from odoo.addons.base.models.ir_ui_view import View


_original_check_xml = View._check_xml


def _check_xml(self):
# TODO we should check exeception is due to the expected error
try:
_original_check_xml
except Exception:
pass


View._check_xml = _check_xml
23 changes: 23 additions & 0 deletions views_migration_17/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "Views Migration to v17",
"version": "17.0.1.0.0",
"author": "ODOO SA,ADHOC SA,Odoo Community Association (OCA)",
"description": """
Patch modules views related to this change https://github.com/odoo/odoo/pull/104741
The script is taken from this comment (https://github.com/odoo/odoo/pull/104741#issuecomment-1794616832) on same PR
To run it:
1. Add module as server wide module.
2. Run odoo server installing or upgrading target module.

For eg: odoo -i upgrade_analysis -d upgrade_analysis --load=base,web,views_migration_17
""",
"website": "https://github.com/OCA/server-tools",
"license": "AGPL-3",
"depends": [
"base",
],
"data": [],
"installable": False,
"auto_install": False,
"application": False,
}
Loading
Loading