fix!: Don't update document from keyword args (#32898)

Right now if you do this:

`get_doc(doctype, name, field=value)` then it loads document from DB and
then updates field to value.

This is absurd API and I don't think it was ever done intentionally.
This commit is contained in:
Ankush Menat 2025-06-11 15:45:35 +05:30 committed by GitHub
parent 44681433c9
commit b162c0d6ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -194,8 +194,6 @@ class Document(BaseDocument):
# since it is used in virtual doctypes and inherited in child classes
self.flags.for_update = kwargs.pop("for_update", None)
self.load_from_db()
if kwargs: # ad-hoc overrides
self._init_from_kwargs(kwargs)
def _init_dispatch(self, arg, *args, **kwargs):
if isinstance(arg, str):