-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] util/records: add root user check #196
base: master
Are you sure you want to change the base?
Conversation
In most cases, this fix: odoo/upgrade@bc4a020 will not work. These cases occur for databases that already have a migration history `(i.e., 16 → 17 → 18)` or when a manual upgrade of a module has been performed by the client via the UI. In such scenarios, there is a high possibility that the `write_date` has been updated by the root user, exceeding the internal time limit (1 minute). Due to which the actual purpose of `if_unchanged` is not delivered. To handle such cases, a check of the `write_uid` is essential.
The linked fix can be achieved in a different way. If you provide details in its original PR then it can be done by editing the view directly. |
I agree with you. The purpose of this patch was to address the missing link here in |
I understand the idea in this patch. But I'm not sure I agree with it. It's usually better to understand what changed and why... |
This is not because OdooBot is the last writer that the records hasn't been modified. |
Exactly.. That’s what this patch is meant to address—to ensure that the record is modified. This is the primary and major reason for this patch. Otherwise, the |
No, you are ignoring edits by OdooBot. The fact that it was OdooBot that edited the view is enough reason for us to stop and consider whether the update can be applied. Even though in many cases it could be an update done by a previous upgrade... we simply cannot be sure. |
Description:
(i.e., 16 → 17 → 18)
or when a manual upgrade of a module has been performed by the client via the UI. In such scenarios, there is a high possibility that thewrite_date
has been updated by the root user, exceeding the internal time limit (1 minute). Due to which the actual purpose ofif_unchanged
is not delivered.Solution:
write_uid
is essential.Another scenario would be a record,
base.demo
, marked asnoupdate=True
in version A.Upon upgrading the database to version B, the record undergoes significant changes in the XML.
To update the record,
update_record_from_xml
is performed during the migration.This process updates the
write_date
of the record with the root user.Now, if a new version C upgrade occurs and the same record is updated using
util.if_unchanged(cr, "base.demo", util.update_record_from_xml)
, it will not be effective in this case.