diff options
| author | Adrian Torres <adt@odoo.com> | 2020-03-30 08:39:00 +0000 |
|---|---|---|
| committer | Adrian Torres <adt@odoo.com> | 2020-04-02 21:47:21 +0000 |
| commit | 0cb6f111b8eb420044eb2636710570b56d753e67 (patch) | |
| tree | 95876c0b7c5ec83eb2c1b7996fa7f77c09454948 /addons/payment_payumoney | |
| parent | bf9d864fb0a91e68dba36a901ebbe4d1bc1df4ee (diff) | |
[FIX] payment_*: reset payment acquirers to default on uninstall
The `payment` module introduces a certain amount of payment acquirers,
each one corresponding to a `payment_` module.
When a `payment_` module is installed, this data is updated so that
payments done with the corresponding acquirer change in behaviour using
the provider installed by the `payment_` module.
When a `payment_` module is uninstalled, this data should be reset to
default, more especifically the `view_template_id` and the `provider`
fields of `payment.acquirer`.
This was not possible before this commit, and more importantly it would
make the uninstallation of such `payment_` module impossible as the
`view_template_id` is a required m2o ondelete='set null', which will
make the registry crash. Even if the former wasn't a problem, the
provider field would remain set to a non-existing selection option,
which would make the registry crash (eventually, when checking a record
with such a selection option).
With this commit, we reset these fields to their default value upon
module uninstall.
In 13, the issue with `view_template_id` should be fixed, as required
m2o that are ondelete='set null' are no longer possible. As for the
provider Selection field, a fix should arrive in master soon.
opw-2225333
closes odoo/odoo#48916
X-original-commit: 4f0c1c1bfd71dd1ff6793d0a91b49984c54d1351
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
Diffstat (limited to 'addons/payment_payumoney')
| -rw-r--r-- | addons/payment_payumoney/__init__.py | 3 | ||||
| -rw-r--r-- | addons/payment_payumoney/__manifest__.py | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/addons/payment_payumoney/__init__.py b/addons/payment_payumoney/__init__.py index 3d944a17e8b..6cf313c4b39 100644 --- a/addons/payment_payumoney/__init__.py +++ b/addons/payment_payumoney/__init__.py @@ -4,4 +4,7 @@ from . import models from . import controllers from odoo.addons.payment.models.payment_acquirer import create_missing_journal_for_acquirers +from odoo.addons.payment import reset_payment_provider +def uninstall_hook(cr, registry): + reset_payment_provider(cr, registry, 'payumoney') diff --git a/addons/payment_payumoney/__manifest__.py b/addons/payment_payumoney/__manifest__.py index 6ccb8312ab0..420457e4545 100644 --- a/addons/payment_payumoney/__manifest__.py +++ b/addons/payment_payumoney/__manifest__.py @@ -18,4 +18,5 @@ ], 'application': True, 'post_init_hook': 'create_missing_journal_for_acquirers', + 'uninstall_hook': 'uninstall_hook', } |
