I am trying to show a custom (warning) message upon clicking confirm button in Invoices (account.move).
The basic idea is: when user confirms new invoice check condition (is this the first time showing message?) and raise UserError if condition is true otherwise continue and create invoice.
This works fine, but i have bool field serving as a flag (Was message already shown?) and i need to update this flag (with permanent change) before raising UserError. Unfortunately raising UserError causes database rollback so my update of flag field is always rollbacked.
I came across post on Stack Overflow explaining Odoo cursor and raw SQL queries and it seemed like it might be an answer to my problem but i have no idea how to do it.
I want to update only one field (flag field) and not commit whole record.