Merge pull request #34738 from resilient-tech/regional++
This commit is contained in:
commit
83a4c6dda8
@ -1,3 +1,4 @@
|
||||
import functools
|
||||
import inspect
|
||||
|
||||
import frappe
|
||||
@ -120,12 +121,14 @@ def get_region(company=None):
|
||||
|
||||
You can also set global company flag in `frappe.flags.company`
|
||||
"""
|
||||
if company or frappe.flags.company:
|
||||
return frappe.get_cached_value("Company", company or frappe.flags.company, "country")
|
||||
elif frappe.flags.country:
|
||||
return frappe.flags.country
|
||||
else:
|
||||
return frappe.get_system_settings("country")
|
||||
|
||||
if not company:
|
||||
company = frappe.local.flags.company
|
||||
|
||||
if company:
|
||||
return frappe.get_cached_value("Company", company, "country")
|
||||
|
||||
return frappe.flags.country or frappe.get_system_settings("country")
|
||||
|
||||
|
||||
def allow_regional(fn):
|
||||
@ -136,6 +139,7 @@ def allow_regional(fn):
|
||||
def myfunction():
|
||||
pass"""
|
||||
|
||||
@functools.wraps(fn)
|
||||
def caller(*args, **kwargs):
|
||||
overrides = frappe.get_hooks("regional_overrides", {}).get(get_region())
|
||||
function_path = f"{inspect.getmodule(fn).__name__}.{fn.__name__}"
|
||||
|
@ -259,6 +259,8 @@ def set_address_details(
|
||||
)
|
||||
|
||||
if doctype in TRANSACTION_TYPES:
|
||||
# required to set correct region
|
||||
frappe.flags.company = company
|
||||
get_regional_address_details(party_details, doctype, company)
|
||||
|
||||
return party_address, shipping_address
|
||||
|
@ -976,6 +976,8 @@ def get_itemised_tax_breakup_html(doc):
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_round_off_applicable_accounts(company, account_list):
|
||||
# required to set correct region
|
||||
frappe.flags.company = company
|
||||
account_list = get_regional_round_off_accounts(company, account_list)
|
||||
|
||||
return account_list
|
||||
|
Loading…
x
Reference in New Issue
Block a user