Skip to content

Commit

Permalink
Merge pull request #4497 from Tecnativa/17.0-add-purchase_discount
Browse files Browse the repository at this point in the history
[17.0][ADD] apriori: merge purchase_discount into purchase
  • Loading branch information
pedrobaeza authored Jul 8, 2024
2 parents 9279df1 + e08fcf3 commit 04d499e
Show file tree
Hide file tree
Showing 15 changed files with 215 additions and 207 deletions.
141 changes: 71 additions & 70 deletions openupgrade_framework/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,35 @@ Openupgrade Framework

|badge1| |badge2| |badge3| |badge4| |badge5|

This module is a technical module that contains a number of monkeypatches
to improve the behaviour of Odoo when migrating your database using the
OpenUpgrade migration scripts:

* Prevent dropping columns or tables in the database when fields or models
are obsoleted in the Odoo data model of the target release. After the
migration, you can review and delete unused database tables and columns
using `database_cleanup`. See
https://odoo-community.org/shop/product/database-cleanup-918
* When data records are deleted during the migration (such as views or other
system records), this is done in a secure mode. If the deletion fails because
of some unforeseen dependency, the deletion will be cancelled and a message
is logged, after which the migration continues.
* Prevent a number of log messages that do not apply when using OpenUpgrade.
* Suppress log messages about failed view validation, which are to be expected
during a migration.
* Run migration scripts for modules that are installed as new dependencies
of upgraded modules (when there are such scripts for those particular
modules)
* Production databases generated with demo data, will be transformed to
non-demo ones. If you want to avoid that, you have to pass through the
environment variable OPENUPGRADE_USE_DEMO, the value "yes".
This module is a technical module that contains a number of
monkeypatches to improve the behaviour of Odoo when migrating your
database using the OpenUpgrade migration scripts:

- Prevent dropping columns or tables in the database when fields or
models are obsoleted in the Odoo data model of the target release.
After the migration, you can review and delete unused database tables
and columns using database_cleanup. See
https://odoo-community.org/shop/product/database-cleanup-918
- When data records are deleted during the migration (such as views or
other system records), this is done in a secure mode. If the deletion
fails because of some unforeseen dependency, the deletion will be
cancelled and a message is logged, after which the migration
continues.
- Prevent a number of log messages that do not apply when using
OpenUpgrade.
- Suppress log messages about failed view validation, which are to be
expected during a migration.
- Run migration scripts for modules that are installed as new
dependencies of upgraded modules (when there are such scripts for
those particular modules)
- Production databases generated with demo data, will be transformed to
non-demo ones. If you want to avoid that, you have to pass through
the environment variable OPENUPGRADE_USE_DEMO, the value "yes".

For detailed documentation see:

* https://github.com/OCA/OpenUpgrade/
* https://oca.github.io/OpenUpgrade
- https://github.com/OCA/OpenUpgrade/
- https://oca.github.io/OpenUpgrade

**Table of contents**

Expand All @@ -64,83 +66,82 @@ For detailed documentation see:
Installation
============

This module does not need to be installed on a database.
It simply needs to be available via your ``addons-path``.
This module does not need to be installed on a database. It simply needs
to be available via your ``addons-path``.

Configuration
=============

* call your odoo instance with the option ``--load=base,web,openupgrade_framework``
- call your odoo instance with the option
``--load=base,web,openupgrade_framework``

or

* add the key to your configuration file:
- add the key to your configuration file:

.. code-block:: shell
.. code:: shell
[options]
server_wide_modules = web,openupgrade_framework
[options]
server_wide_modules = web,openupgrade_framework
When you load the module in either way of these ways, and you have the
`openupgrade_scripts` module in your addons path available, the
`--upgrade-path` option of Odoo will be set automatically to the location
openupgrade_scripts module in your addons path available, the
--upgrade-path option of Odoo will be set automatically to the location
of the OpenUpgrade migration scripts.

Development
===========

The `odoo_patch` folder contains python files in a tree that mimicks the
The odoo_patch folder contains python files in a tree that mimicks the
folder tree of the Odoo project. It contains a number of monkey patches
to improve the migration of an Odoo database between two major versions.

So far, we are able to make everything work without overwriting large blocks
of code, but if larger patches need to be added, please use the method
described below:
So far, we are able to make everything work without overwriting large
blocks of code, but if larger patches need to be added, please use the
method described below:

To see the patches added, you can use ``meld`` tools:

``meld PATH_TO_ODOO_FOLDER/odoo/ PATH_TO_OPENUPGRADE_FRAMEWORK_MODULE/odoo_patch``


To make more easy the diff analysis :

* Make sure the python files has the same path as the original one.

* Keep the same indentation as the original file. (using ``if True:`` if required)

* Add the following two lines at the beginning of your file, to avoid flake8 / pylint
errors
- Make sure the python files has the same path as the original one.
- Keep the same indentation as the original file. (using ``if True:``
if required)
- Add the following two lines at the beginning of your file, to avoid
flake8 / pylint errors

.. code-block:: python
.. code:: python
# flake8: noqa
# pylint: skip-file
# flake8: noqa
# pylint: skip-file
* When you want to change the code. add the following tags:
- When you want to change the code. add the following tags:

For an addition:

.. code-block:: python
.. code:: python
# <OpenUpgrade:ADD>
some code...
# </OpenUpgrade>
# <OpenUpgrade:ADD>
some code...
# </OpenUpgrade>
For a change:

.. code-block:: python
.. code:: python
# <OpenUpgrade:CHANGE>
some code...
# </OpenUpgrade>
# <OpenUpgrade:CHANGE>
some code...
# </OpenUpgrade>
For a removal:

.. code-block:: python
.. code:: python
# <OpenUpgrade:REMOVE>
# Comment the code, instead of removing it.
# </OpenUpgrade>
# <OpenUpgrade:REMOVE>
# Comment the code, instead of removing it.
# </OpenUpgrade>
Bug Tracker
===========
Expand All @@ -156,29 +157,29 @@ Credits
=======

Authors
~~~~~~~
-------

* Therp BV
* Opener B.V.
* GRAP
* Hunki Enterprises BV

Contributors
~~~~~~~~~~~~
------------

* Stefan Rijnhart <[email protected]>
* Sylvain LE GAL <https://twitter.com/legalsylvain>
- Stefan Rijnhart <[email protected]>
- Sylvain LE GAL <https://twitter.com/legalsylvain>

Other credits
~~~~~~~~~~~~~
-------------

Many developers have contributed to the OpenUpgrade framework in its previous
incarnation. Their original contributions may no longer needed, or they are
no longer recognizable in their current form but OpenUpgrade would not have
existed at this point without them.
Many developers have contributed to the OpenUpgrade framework in its
previous incarnation. Their original contributions may no longer needed,
or they are no longer recognizable in their current form but OpenUpgrade
would not have existed at this point without them.

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand Down
16 changes: 16 additions & 0 deletions openupgrade_framework/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- call your odoo instance with the option
`--load=base,web,openupgrade_framework`

or

- add the key to your configuration file:

``` shell
[options]
server_wide_modules = web,openupgrade_framework
```

When you load the module in either way of these ways, and you have the
openupgrade_scripts module in your addons path available, the
--upgrade-path option of Odoo will be set automatically to the location
of the OpenUpgrade migration scripts.
15 changes: 0 additions & 15 deletions openupgrade_framework/readme/CONFIGURE.rst

This file was deleted.

2 changes: 2 additions & 0 deletions openupgrade_framework/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Stefan Rijnhart \<<[email protected]>\>
- Sylvain LE GAL \<<https://twitter.com/legalsylvain>\>
2 changes: 0 additions & 2 deletions openupgrade_framework/readme/CONTRIBUTORS.rst

This file was deleted.

4 changes: 4 additions & 0 deletions openupgrade_framework/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Many developers have contributed to the OpenUpgrade framework in its
previous incarnation. Their original contributions may no longer needed,
or they are no longer recognizable in their current form but OpenUpgrade
would not have existed at this point without them.
4 changes: 0 additions & 4 deletions openupgrade_framework/readme/CREDITS.rst

This file was deleted.

29 changes: 29 additions & 0 deletions openupgrade_framework/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
This module is a technical module that contains a number of
monkeypatches to improve the behaviour of Odoo when migrating your
database using the OpenUpgrade migration scripts:

- Prevent dropping columns or tables in the database when fields or
models are obsoleted in the Odoo data model of the target release.
After the migration, you can review and delete unused database tables
and columns using database_cleanup. See
<https://odoo-community.org/shop/product/database-cleanup-918>
- When data records are deleted during the migration (such as views or
other system records), this is done in a secure mode. If the deletion
fails because of some unforeseen dependency, the deletion will be
cancelled and a message is logged, after which the migration
continues.
- Prevent a number of log messages that do not apply when using
OpenUpgrade.
- Suppress log messages about failed view validation, which are to be
expected during a migration.
- Run migration scripts for modules that are installed as new
dependencies of upgraded modules (when there are such scripts for
those particular modules)
- Production databases generated with demo data, will be transformed to
non-demo ones. If you want to avoid that, you have to pass through the
environment variable OPENUPGRADE_USE_DEMO, the value "yes".

For detailed documentation see:

- <https://github.com/OCA/OpenUpgrade/>
- <https://oca.github.io/OpenUpgrade>
27 changes: 0 additions & 27 deletions openupgrade_framework/readme/DESCRIPTION.rst

This file was deleted.

50 changes: 50 additions & 0 deletions openupgrade_framework/readme/DEVELOP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
The odoo_patch folder contains python files in a tree that mimicks the
folder tree of the Odoo project. It contains a number of monkey patches
to improve the migration of an Odoo database between two major versions.

So far, we are able to make everything work without overwriting large
blocks of code, but if larger patches need to be added, please use the
method described below:

To see the patches added, you can use `meld` tools:

`meld PATH_TO_ODOO_FOLDER/odoo/ PATH_TO_OPENUPGRADE_FRAMEWORK_MODULE/odoo_patch`

To make more easy the diff analysis :

- Make sure the python files has the same path as the original one.
- Keep the same indentation as the original file. (using `if True:` if
required)
- Add the following two lines at the beginning of your file, to avoid
flake8 / pylint errors

``` python
# flake8: noqa
# pylint: skip-file
```

- When you want to change the code. add the following tags:

For an addition:

``` python
# <OpenUpgrade:ADD>
some code...
# </OpenUpgrade>
```

For a change:

``` python
# <OpenUpgrade:CHANGE>
some code...
# </OpenUpgrade>
```

For a removal:

``` python
# <OpenUpgrade:REMOVE>
# Comment the code, instead of removing it.
# </OpenUpgrade>
```
Loading

0 comments on commit 04d499e

Please sign in to comment.