mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 07:29:22 +00:00
optimize(various)
This commit is contained in:
@@ -27,7 +27,7 @@ def get_site_info(site_info):
|
||||
company = company[0][0] if company else None
|
||||
|
||||
if company:
|
||||
domain = frappe.db.get_value('Company', cstr(company), 'domain')
|
||||
domain = frappe.get_cached_value('Company', cstr(company), 'domain')
|
||||
|
||||
return {
|
||||
'company': company,
|
||||
|
||||
@@ -54,7 +54,7 @@ def get_help_messages():
|
||||
if get_level() > 6:
|
||||
return []
|
||||
|
||||
domain = frappe.db.get_value('Company', erpnext.get_default_company(), 'domain')
|
||||
domain = frappe.get_cached_value('Company', erpnext.get_default_company(), 'domain')
|
||||
messages = []
|
||||
|
||||
message_settings = [
|
||||
|
||||
@@ -20,10 +20,10 @@ def get_qty_in_stock(item_code, item_warehouse_field, warehouse=None):
|
||||
|
||||
if warehouse:
|
||||
stock_qty = frappe.db.sql("""
|
||||
select GREATEST(S.actual_qty - S.reserved_qty - S.reserved_qty_for_production - S.reserved_qty_for_sub_contract, 0) / IFNULL(C.conversion_factor, 1)
|
||||
select GREATEST(S.actual_qty - S.reserved_qty - S.reserved_qty_for_production - S.reserved_qty_for_sub_contract, 0) / IFNULL(C.conversion_factor, 1)
|
||||
from tabBin S
|
||||
inner join `tabItem` I on S.item_code = I.Item_code
|
||||
left join `tabUOM Conversion Detail` C on I.sales_uom = C.uom and C.parent = I.Item_code
|
||||
left join `tabUOM Conversion Detail` C on I.sales_uom = C.uom and C.parent = I.Item_code
|
||||
where S.item_code=%s and S.warehouse=%s""", (item_code, warehouse))
|
||||
|
||||
if stock_qty:
|
||||
@@ -37,7 +37,7 @@ def adjust_qty_for_expired_items(item_code, stock_qty, warehouse):
|
||||
batches = frappe.get_all('Batch', filters=[{'item': item_code}], fields=['expiry_date', 'name'])
|
||||
expired_batches = get_expired_batches(batches)
|
||||
stock_qty = [list(item) for item in stock_qty]
|
||||
|
||||
|
||||
for batch in expired_batches:
|
||||
if warehouse:
|
||||
stock_qty[0][0] = max(0, stock_qty[0][0] - get_batch_qty(batch, warehouse))
|
||||
@@ -103,7 +103,7 @@ def get_price(item_code, price_list, customer_group, company, qty=1):
|
||||
price_obj["formatted_price"] = fmt_money(price_obj["price_list_rate"], currency=price_obj["currency"])
|
||||
|
||||
price_obj["currency_symbol"] = not cint(frappe.db.get_default("hide_currency_symbol")) \
|
||||
and (frappe.db.get_value("Currency", price_obj.currency, "symbol") or price_obj.currency) \
|
||||
and (frappe.db.get_value("Currency", price_obj.currency, "symbol", cache=True) or price_obj.currency) \
|
||||
or ""
|
||||
|
||||
uom_conversion_factor = frappe.db.sql("""select C.conversion_factor
|
||||
|
||||
@@ -7,7 +7,7 @@ from erpnext.setup.doctype.setup_progress.setup_progress import get_action_compl
|
||||
|
||||
def get_slide_settings():
|
||||
defaults = frappe.defaults.get_defaults()
|
||||
domain = frappe.db.get_value('Company', erpnext.get_default_company(), 'domain')
|
||||
domain = frappe.get_cached_value('Company', erpnext.get_default_company(), 'domain')
|
||||
company = defaults.get("company") or ''
|
||||
currency = defaults.get("currency") or ''
|
||||
|
||||
|
||||
@@ -234,6 +234,6 @@ def create_users(args_data):
|
||||
|
||||
@frappe.whitelist()
|
||||
def update_default_domain_actions_and_get_state():
|
||||
domain = frappe.db.get_value('Company', erpnext.get_default_company(), 'domain')
|
||||
domain = frappe.get_cached_value('Company', erpnext.get_default_company(), 'domain')
|
||||
update_domain_actions(domain)
|
||||
return get_domain_actions_state(domain)
|
||||
|
||||
Reference in New Issue
Block a user