refactor: Remove usage of deprecated methods (backport #32914) (#32915)

* refactor: Remove usage of deprecated methods (#32914)

Warn: Just used regex to replace all usage.
```regex
s/frappe.db.set(\(.*\),\(.*\),\(.*\))/\1.db_set(\2, \3)/g
```

Required after: https://github.com/frappe/frappe/pull/18815

(cherry picked from commit 7e1742956c)

# Conflicts:
#	erpnext/accounts/doctype/sales_invoice/sales_invoice.py

* chore: conflicts

* style: black


Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
mergify[bot]
2022-11-10 11:09:13 +05:30
committed by GitHub
parent 17ccc0e56c
commit f8b7cfa6dd
19 changed files with 37 additions and 39 deletions

View File

@@ -207,15 +207,14 @@ class Company(NestedSet):
frappe.local.flags.ignore_root_company_validation = True
create_charts(self.name, self.chart_of_accounts, self.existing_company)
frappe.db.set(
self,
self.db_set(
"default_receivable_account",
frappe.db.get_value(
"Account", {"company": self.name, "account_type": "Receivable", "is_group": 0}
),
)
frappe.db.set(
self,
self.db_set(
"default_payable_account",
frappe.db.get_value(
"Account", {"company": self.name, "account_type": "Payable", "is_group": 0}
@@ -491,12 +490,12 @@ class Company(NestedSet):
cc_doc.flags.ignore_mandatory = True
cc_doc.insert()
frappe.db.set(self, "cost_center", _("Main") + " - " + self.abbr)
frappe.db.set(self, "round_off_cost_center", _("Main") + " - " + self.abbr)
frappe.db.set(self, "depreciation_cost_center", _("Main") + " - " + self.abbr)
self.db_set("cost_center", _("Main") + " - " + self.abbr)
self.db_set("round_off_cost_center", _("Main") + " - " + self.abbr)
self.db_set("depreciation_cost_center", _("Main") + " - " + self.abbr)
def after_rename(self, olddn, newdn, merge=False):
frappe.db.set(self, "company_name", newdn)
self.db_set("company_name", newdn)
frappe.db.sql(
"""update `tabDefaultValue` set defvalue=%s