From c7fa9cc4f5a6f96851a2dacd02c292f4893756e8 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 5 Sep 2013 17:50:40 +0530 Subject: [PATCH 1/2] [fix] [minor] show live chat link if commercial_support = 1 in conf.py --- public/js/toolbar.js | 5 +++-- startup/boot.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/public/js/toolbar.js b/public/js/toolbar.js index 2566fcb6a3a..3f910ff25d8 100644 --- a/public/js/toolbar.js +++ b/public/js/toolbar.js @@ -15,8 +15,9 @@ erpnext.toolbar.setup = function() { $user.append('
  • \ '+wn._('Forum')+'
  • '); - if(wn.boot.expires_on) { - $user.append('
  • \ + if(wn.boot.expires_on || wn.boot.commercial_support) { + $user.append('
  • \ + \ '+wn._('Live Chat')+'
  • '); } diff --git a/startup/boot.py b/startup/boot.py index ce446e9ecfa..48bdeec09cf 100644 --- a/startup/boot.py +++ b/startup/boot.py @@ -33,8 +33,9 @@ def boot_session(bootinfo): # load subscription info import conf - for key in ['max_users', 'expires_on', 'max_space', 'status', 'developer_mode']: - if hasattr(conf, key): bootinfo[key] = getattr(conf, key) + for key in ['max_users', 'expires_on', 'max_space', 'status', 'developer_mode', + 'commercial_support']: + if hasattr(conf, key): bootinfo[key] = getattr(conf, key) bootinfo['docs'] += webnotes.conn.sql("""select name, default_currency, cost_center from `tabCompany`""", as_dict=1, update={"doctype":":Company"}) From c6d17a6989a66268464433f514e95b14da4ac384 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 5 Sep 2013 18:18:40 +0530 Subject: [PATCH 2/2] [fix] [minor] set price list currency and conversion rate --- controllers/accounts_controller.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index 4ee7e53e151..eb71f21ce73 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -56,23 +56,23 @@ class AccountsController(TransactionBase): def set_price_list_currency(self, buying_or_selling): company_currency = get_company_currency(self.doc.company) fieldname = buying_or_selling.lower() + "_price_list" + # TODO - change this, since price list now has only one currency allowed - if self.meta.get_field(fieldname) and self.doc.fields.get(fieldname) and \ - not self.doc.price_list_currency: + if self.meta.get_field(fieldname) and self.doc.fields.get(fieldname): + if not self.doc.price_list_currency: self.doc.fields.update(get_price_list_currency(self.doc.fields.get(fieldname))) - if self.doc.price_list_currency: - if not self.doc.plc_conversion_rate: - if self.doc.price_list_currency == company_currency: - self.doc.plc_conversion_rate = 1.0 - else: - exchange = self.doc.price_list_currency + "-" + company_currency - self.doc.plc_conversion_rate = flt(webnotes.conn.get_value("Currency Exchange", - exchange, "exchange_rate")) - - if not self.doc.currency: - self.doc.currency = self.doc.price_list_currency - self.doc.conversion_rate = self.doc.plc_conversion_rate + if self.doc.price_list_currency: + if self.doc.price_list_currency == company_currency: + self.doc.plc_conversion_rate = 1.0 + elif not self.doc.plc_conversion_rate: + exchange = self.doc.price_list_currency + "-" + company_currency + self.doc.plc_conversion_rate = flt(webnotes.conn.get_value("Currency Exchange", + exchange, "exchange_rate")) + + if not self.doc.currency: + self.doc.currency = self.doc.price_list_currency + self.doc.conversion_rate = self.doc.plc_conversion_rate if self.meta.get_field("currency"): if self.doc.currency and self.doc.currency != company_currency: @@ -82,7 +82,7 @@ class AccountsController(TransactionBase): exchange, "exchange_rate")) else: self.doc.conversion_rate = 1 - + def set_missing_item_details(self, get_item_details): """set missing item values""" for item in self.doclist.get({"parentfield": self.fname}):