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

Master add views migration 17 #83

Closed
Closed
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
53 changes: 53 additions & 0 deletions addons/views_migration_17/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.. 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:

.. code-block:: xml

<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:

.. code-block:: xml

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


Usage
=====

.. code-block:: shell

odoo -d [database_name] -i [module_name] --load=base,web,views_migration_17


Credits
=======

Authors
-------
* ADHOC SA


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

* Juan José Scarafía
* Bruno Zanotti
18 changes: 18 additions & 0 deletions addons/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
22 changes: 22 additions & 0 deletions addons/views_migration_17/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"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
""",
"license": "AGPL-3",
"depends": [
"base",
],
"data": [],
"installable": False,
"auto_install": False,
"application": False,
}
Loading
Loading