This is more intuitive and consistent with other things like `frappe.db`.
PS: This is quite likely to break some weird usage which I can't guess right now. Normal usage inside request/job cycles will continue to work as it used to.
- System user with no role is useless
- By default adding a new system user doesn't give them ANY role so
they can't really access desk even if they have system user role.
* fix: currency formatter got incorrect format when use precision 0
* Revert "fix: currency formatter got incorrect format when use precision 0"
This reverts commit 1919cf4763b16e0cca2c2596223443d901e00e27.
* fix: allow 0 as default precision
---------
Co-authored-by: Ankush Menat <ankush@frappe.io>
Each call to evaluate if route is web view makes N queries where N = #
of web view doctypes. This entire computation can be definitely cached
for short duration.
- Added cache bursting in WebsiteGenerator doctype updates.
- Added 60 minutes TTL in case cache invalidation wasn't done reliably.
Fixture test:
This is broken cause it's trying to find doctype after it has been
deleted (wut?)
It was working so far because cache wasn't cleared correctly so you'd
still find it from cache.
db.set_value test:
converted to use last query instead of patching SQL
- Hashes are supposed to be used for representing complex object, not
multiple documents of same DocType.
- Redis's auto cache clearing wont clear individual key from hashes even if they
are rarely used.
- Keys can have expiry.
Passing lambda function from inside document object would keep reference
to document alive. This means increasing memeory usage in bulk
processing.
Refer https://github.com/frappe/frappe/pull/17061 for example
This also extends it to db.set_value
This is a common pattern which is implemented in inconsistent and undocumented ways using these:
- `frappe.local.rollback_observers`
- `frappe.flags.enqueue_after_commit`
- `frappe.local.realtime_log`
- `frappe.local.before_commit`
- `flush_local_link_count`
Instead new simple api:
- Simple function call `frappe.db.after_commit.run(function)`
- If you need args just pass partial function `frappe.db.after_commit.run(lambda: frappe.clear_cache(doctype, name)`