Skip to content

[IMP] base: allow configure models that can be deleted in partner mer…#643

Open
IrvingReyes wants to merge 1 commit intoVauxoo:18.0from
vauxoo-dev:18.0-configure-models-to-delete-or-error-vauxoo-irvingreyes
Open

[IMP] base: allow configure models that can be deleted in partner mer…#643
IrvingReyes wants to merge 1 commit intoVauxoo:18.0from
vauxoo-dev:18.0-configure-models-to-delete-or-error-vauxoo-irvingreyes

Conversation

@IrvingReyes
Copy link

Description of the issue/feature this PR addresses:

The method _update_reference_fields is handling PSQL errors in the case in the middle of updating something fails and it's deleting indiscriminately the records involved presuming that PSQL error is always a unique violation, but can occur any PSQL error, so this change is allowing configure what models can be deleted in a unique violation if the models are not defined, it's working as currently, otherwise, it's validating the model and raising an error in case model is not in allowed ones.

Current behavior before PR:

When a merge occurs, if there is a PostgreSQL error in updating reference fields, the records involved are deleted.

Desired behavior after PR is merged:

When a merge occurs, if there is a PostgreSQL unique violation error in updating reference fields and the parameter is base_partner_merge.models_allowed_to_unlink is configured, if records involved are in allowed models to delete, then delete them, otherwise raise an error to the user can review at detail.

OPW: Pending

…ging

Description of the issue/feature this PR addresses:

The method _update_reference_fields is handling PSQL errors in the case in the middle of updating something fails and it's deleting indiscriminately the records involved presuming that PSQL error is always a unique violation, but can occur any PSQL error, so this change is allowing configure what models can be deleted in a unique violation if the models are not defined, it's working as currently, otherwise, it's validating the model and raising an error in case model is not in allowed ones.

Current behavior before PR:

When a merge occurs, if there is a PostgreSQL error in updating reference fields, the records involved are deleted.

Desired behavior after PR is merged:

When a merge occurs, if there is a PostgreSQL unique violation error in updating reference fields and the parameter is base_partner_merge.models_allowed_to_unlink is configured, if records involved are in allowed models to delete, then delete them, otherwise raise an error to the user can review at detail.

OPW: Pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant