[18.0] [FIX] quality_control_oca: Handle multiple unlink#1745
[18.0] [FIX] quality_control_oca: Handle multiple unlink#1745
Conversation
diggy128
commented
Mar 2, 2026
- Fix singleton error when selecting multiple records to delete.
- Provide a clear reason for failing along with record names that produced the error
5974c5a to
fb7fa43
Compare
|
@OCA/manufacturing-maintainers |
remi-filament
left a comment
There was a problem hiding this comment.
Hi @diggy128 thanks for your PR,
a few comments inline
| for record in self: | ||
| if record.auto_generated and not record.env.is_superuser(): | ||
| auto_generated_records |= record | ||
| if record.state != "draft": | ||
| non_draft_records |= record |
There was a problem hiding this comment.
instead of a loop you could get both list with a .filtered() and do only once self.env.is_superuser() instead of doing it for each record
| "Inspections %s are not in draft state and can only be deleted " | ||
| "by superuser.", |
There was a problem hiding this comment.
Actually I do not think these could even be deleted by superuser since there is no check whether we are superuser or not so it will probably ends up with the same UserError even if superuser...
There was a problem hiding this comment.
True, indeed. Fixed
|
Maybe you could also join the 2 errors in one so that the user get the full list of failing inspection tests (otherwise he may remove the auto-generated ones from this list to still get an error with non draft ones) |
fb7fa43 to
6cd5576
Compare
- Fix singleton error when selecting multiple records to delete. - Provide a clear reason for failing along with record names that produced the error
6cd5576 to
38ce326
Compare
|
@remi-filament |