mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 07:54:46 +00:00
refactor: use query builder to set company address
This commit is contained in:
@@ -2885,14 +2885,16 @@ def save_company_master_details(name, company, details):
|
|||||||
if company_address:
|
if company_address:
|
||||||
company_address_display = frappe.db.get_value("Sales Invoice", name, "company_address_display")
|
company_address_display = frappe.db.get_value("Sales Invoice", name, "company_address_display")
|
||||||
if not company_address_display or details.get("address_line1"):
|
if not company_address_display or details.get("address_line1"):
|
||||||
frappe.db.set_value(
|
from frappe.query_builder import DocType
|
||||||
"Sales Invoice",
|
|
||||||
name,
|
SalesInvoice = DocType("Sales Invoice")
|
||||||
{
|
|
||||||
"company_address": company_address,
|
(
|
||||||
"company_address_display": get_address_display(company_address),
|
frappe.qb.update(SalesInvoice)
|
||||||
},
|
.set(SalesInvoice.company_address, company_address)
|
||||||
)
|
.set(SalesInvoice.company_address_display, get_address_display(company_address))
|
||||||
|
.where(SalesInvoice.name == name)
|
||||||
|
).run()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user