Files
odoo_source/addons/l10n_generic_coa/__init__.py
T
Adrian Torres 661542a4a7 [FIX] account, l10n_generic_coa: remove unused master data
When installing the `account` module, some of its master data is
installed as `l10n_generic_coa` data.

During the uninstallation of `account`, `l10n_generic_coa` is
uninstalled first since its a dependency of `account`, but some of its
master data cannot be uninstalled yet as its still being referenced in
some `account` et al tables.

When `account` is being reinstalled, the datas will be updated instead
of created since they were left intact in the database, this proves
troublesome as the code YAML interpreter adds some context variables
when creating records but not when updating records, these context
variables are necessary in order to trigger some onchanges and defaults
for fields that are required, since this does not happen we get a `NOT
NULL CONSTRAINT` error when re-installing the `account` module.

This patch solves this issue by adding an uninstall_hook that will
delete all ir_model_data that belongs to the module `l10n_generic_coa`
upon its uninstallation.

Fixes #25005
2018-06-04 11:30:49 +02:00

9 lines
227 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
def uninstall_hook(cr, registry):
cr.execute(
"DELETE FROM ir_model_data WHERE module = 'l10n_generic_coa'"
)