Merge pull request #19831 from rohitwaghchaure/fixed_cache_issue_for_exchange_rate

fix: travis failing
This commit is contained in:
rohitwaghchaure 2019-12-06 18:45:26 +05:30 committed by GitHub
commit bce5d189aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View File

@ -1,4 +1,5 @@
{ {
"actions": [],
"autoname": "hash", "autoname": "hash",
"creation": "2013-05-24 19:29:06", "creation": "2013-05-24 19:29:06",
"doctype": "DocType", "doctype": "DocType",
@ -43,6 +44,7 @@
"base_amount", "base_amount",
"pricing_rules", "pricing_rules",
"is_free_item", "is_free_item",
"is_fixed_asset",
"section_break_29", "section_break_29",
"net_rate", "net_rate",
"net_amount", "net_amount",
@ -708,11 +710,20 @@
"fieldname": "against_blanket_order", "fieldname": "against_blanket_order",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Against Blanket Order" "label": "Against Blanket Order"
},
{
"default": "0",
"fetch_from": "item_code.is_fixed_asset",
"fieldname": "is_fixed_asset",
"fieldtype": "Check",
"label": "Is Fixed Asset",
"read_only": 1
} }
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2019-11-19 14:10:52.865006", "links": [],
"modified": "2019-12-06 13:17:12.142799",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Purchase Order Item", "name": "Purchase Order Item",

View File

@ -283,7 +283,7 @@ class EmailDigest(Document):
card.value = card.value *-1 card.value = card.value *-1
card.value = self.fmt_money(card.value,False if key in ("bank_balance", "credit_balance") else True) card.value = self.fmt_money(card.value,False if key in ("bank_balance", "credit_balance") else True)
cache.setex(cache_key, card, 24 * 60 * 60) cache.set_value(cache_key, card, expires_in_sec=24 * 60 * 60)
context.cards.append(card) context.cards.append(card)

View File

@ -106,7 +106,8 @@ def get_exchange_rate(from_currency, to_currency, transaction_date=None, args=No
# expire in 6 hours # expire in 6 hours
response.raise_for_status() response.raise_for_status()
value = response.json()["rates"][to_currency] value = response.json()["rates"][to_currency]
cache.setex(key, value, 6 * 60 * 60)
cache.set_value(key, value, expires_in_sec=6 * 60 * 60)
return flt(value) return flt(value)
except: except:
frappe.log_error(title="Get Exchange Rate") frappe.log_error(title="Get Exchange Rate")