OCA / hr-attendance

HR Attendance OCA modules for Odoo
GNU Affero General Public License v3.0
48 stars 117 forks source link

[FIX][14.0] hr_attendance_rfid - Use a with savepoint instead of catching the error allowing a rollback #148

Closed FrancoMaxime closed 7 months ago

FrancoMaxime commented 1 year ago

If an Error arises during the processing of an attendance, as it is not raised and just logged there is no rollback after. This is why I use a with self.env.cr.savepoint statement, to force a rollback in case of error trigger.

FrancoMaxime commented 1 year ago

Hi @pedrobaeza , the problem here is inside the except who catch the error without any raise. If an error is triggered, the except will catch it, adds an error message in res. But all created data will be kept in database while there would have been a rollback if the error was raised correctly. This means that for odoo as the error is catch everything is ok, but in reality we created a unstable record

pedrobaeza commented 1 year ago

This method is not registering anything on the DB, so as said, you should the changes on the module where is doing such writing.

github-actions[bot] commented 8 months ago

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.