fix: don't bump Customer timestamp when caching primary address (backport #59285)

Caching a primary address no longer bumps the Customer timestamp.

(cherry picked from commit 8d6ee86ba3)
This commit is contained in:
Mihir Kandoi
2026-10-15 14:13:51 +05:30
parent 2ce02b3ce2
commit ecaf47149a
+7 -4
View File
@@ -41,10 +41,13 @@ class ERPNextAddress(Address):
After Address is updated, update the related 'Primary Address' on Customer.
"""
address_display = get_address_display(self.as_dict())
filters = {"customer_primary_address": self.name}
customers = frappe.db.get_all("Customer", filters=filters, as_list=True)
for customer_name in customers:
frappe.db.set_value("Customer", customer_name[0], "primary_address", address_display)
customers = frappe.db.get_all(
"Customer", filters={"customer_primary_address": self.name}, pluck="name"
)
for customer in customers:
frappe.db.set_value(
"Customer", customer, "primary_address", address_display, update_modified=False
)
@frappe.whitelist()