mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-23 12:06:43 +00:00
fix: update primary address handling in Supplier and Customer import providers
This commit is contained in:
@@ -176,7 +176,10 @@ class SupplierImportProvider(ImportProvider):
|
||||
if flagged or primary is None:
|
||||
primary = address
|
||||
if primary:
|
||||
frappe.db.set_value("Address", primary.name, "is_primary_address", 1)
|
||||
# Save (not db.set_value) so Address.validate_preferred_address() clears any
|
||||
# existing primary address on the party — a raw write would leave two flagged.
|
||||
primary.is_primary_address = 1
|
||||
primary.save()
|
||||
supplier.db_set("supplier_primary_address", primary.name)
|
||||
supplier.db_set("primary_address", get_address_display(primary.name))
|
||||
|
||||
|
||||
@@ -184,7 +184,10 @@ class CustomerImportProvider(ImportProvider):
|
||||
if flagged or primary is None:
|
||||
primary = address
|
||||
if primary:
|
||||
frappe.db.set_value("Address", primary.name, "is_primary_address", 1)
|
||||
# Save (not db.set_value) so Address.validate_preferred_address() clears any
|
||||
# existing primary address on the party — a raw write would leave two flagged.
|
||||
primary.is_primary_address = 1
|
||||
primary.save()
|
||||
customer.db_set("customer_primary_address", primary.name)
|
||||
customer.db_set("primary_address", get_address_display(primary.name))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user