Skip to content

[FIX] repair: Virtual Locations have no Warehouse - #5985

Open
SirPyTech wants to merge 1 commit into
OCA:17.0from
PyTech-SRL:17.0-fix-repair-virtual_location
Open

SirPyTech wants to merge 1 commit into
OCA:17.0from
PyTech-SRL:17.0-fix-repair-virtual_location

Conversation

@SirPyTech

Copy link
Copy Markdown

Fix #5474.

When the Location of a Repair Order is a Virtual Location (no Warehouse), the temporary Location/Type could not be deleted resulting in the error:

psycopg2.errors.NotNullViolation: null value in column "location_dest_id" of relation "repair_order" violates not-null
constraint CONTEXT: SQL statement "UPDATE ONLY "public"."repair_order" SET "location_dest_id" = NULL WHERE $1 OPERATOR(pg_catalog.=) "location_dest_id""

Archive and keep the temporary Location/Type if that happens.

When the Location of a Repair Order is a Virtual Location (no Warehouse), the temporary Location/Type could not be deleted resulting in the error:
> psycopg2.errors.NotNullViolation: null value in column "location_dest_id" of relation "repair_order" violates not-null
> constraint CONTEXT:  SQL statement "UPDATE ONLY "public"."repair_order" SET "location_dest_id" = NULL WHERE $1 OPERATOR(pg_catalog.=) "location_dest_id""

Archive and keep the temporary Location/Type if that happens.
@OCA-git-bot OCA-git-bot added mod:openupgrade_scripts Module openupgrade_scripts series:17.0 labels Sep 15, 2026
@SirPyTech

Copy link
Copy Markdown
Author

@FranciscoBigWings @pleirb you faced the linked issue, would you like to have a look? Thanks!

@HekkiMelody HekkiMelody left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review, LGTM.

Also, tested on a migration that had this problem.

@MiquelRForgeFlow MiquelRForgeFlow added this to the 17.0 milestone Sep 21, 2026

@BhaveshHeliconia BhaveshHeliconia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

Instead of keeping and archiving the temporary records, could we add a fallback matching by company_id for repair orders where location_id.warehouse_id is empty? That ensures all orders get valid picking types and allows deleting the temp records completely.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:openupgrade_scripts Module openupgrade_scripts series:17.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants