brotherton-erpnext/erpnext/patches/v10_0/set_currency_in_pricing_rule.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
401 B
Python
Raw Normal View History

import frappe
def execute():
frappe.reload_doctype("Pricing Rule")
currency = frappe.db.get_default("currency")
for doc in frappe.get_all("Pricing Rule", fields=["company", "name"]):
if doc.company:
2018-08-08 16:37:31 +05:30
currency = frappe.get_cached_value("Company", doc.company, "default_currency")
frappe.db.sql(
"""update `tabPricing Rule` set currency = %s where name = %s""", (currency, doc.name)
2022-03-28 18:52:46 +05:30
)