diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index 5abf41ccd0..a149db56f5 100644 --- a/buying/doctype/purchase_common/purchase_common.js +++ b/buying/doctype/purchase_common/purchase_common.js @@ -66,27 +66,24 @@ erpnext.buying.BuyingController = erpnext.utils.Controller.extend({ var me = this; if(this.frm.doc.price_list_name) { - // set price list currency - this.frm.call({ - method: "setup.utils.get_price_list_currency", - args: {args: { - price_list_name: this.frm.doc.price_list_name, - use_for: "buying" - }}, - callback: function(r) { - if(!r.exc) { - // for now, setting it as 1.0 - if(me.frm.doc.price_list_currency === me.get_company_currency()) - me.frm.set_value("plc_conversion_rate", 1.0); - else if(me.frm.doc.price_list_currency === me.frm.doc.currency) - me.frm.set_value("plc_conversion_rate", me.frm.doc.conversion_rate); - - if(r.message.price_list_currency) + if(!this.frm.doc.price_list_currency) { + // set price list currency + this.frm.call({ + method: "setup.utils.get_price_list_currency", + args: {args: { + price_list_name: this.frm.doc.price_list_name, + use_for: "buying" + }}, + callback: function(r) { + if(!r.exc) { me.price_list_currency(); + } } - } - }); - } + }); + } else { + me.price_list_currency(); + } + } }, item_code: function(doc, cdt, cdn) { @@ -145,9 +142,10 @@ erpnext.buying.BuyingController = erpnext.utils.Controller.extend({ price_list_currency: function() { this.set_dynamic_labels(); - if(this.frm.doc.price_list_currency === this.get_company_currency()) { + if(this.frm.doc.price_list_currency === this.get_company_currency()) this.frm.set_value("plc_conversion_rate", 1.0); - } + else if(this.frm.doc.price_list_currency === this.frm.doc.currency) + this.frm.set_value("plc_conversion_rate", this.frm.doc.conversion_rate || 1.0); }, set_dynamic_labels: function(doc, dt, dn) { diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py index 2aeb96611a..5aa1762592 100644 --- a/setup/doctype/company/company.py +++ b/setup/doctype/company/company.py @@ -198,7 +198,7 @@ class DocType: # --------------------------------------------------- def create_default_cost_center(self): glc = get_obj('GL Control') - cc_list = [{'cost_center_name':'Root','company_name':self.doc.name,'company_abbr':self.doc.abbr,'group_or_ledger':'Group','parent_cost_center':''}, {'cost_center_name':'Default CC Ledger','company_name':self.doc.name,'company_abbr':self.doc.abbr,'group_or_ledger':'Ledger','parent_cost_center':'Root - ' + self.doc.abbr}] + cc_list = [{'cost_center_name':'Root','company_name':self.doc.name,'group_or_ledger':'Group','parent_cost_center':''}, {'cost_center_name':'Default CC Ledger','company_name':self.doc.name,'group_or_ledger':'Ledger','parent_cost_center':'Root - ' + self.doc.abbr}] for c in cc_list: glc.add_cc(str(c)) diff --git a/setup/doctype/currency/currency.txt b/setup/doctype/currency/currency.txt index ae7dbb1dff..fc00900515 100644 --- a/setup/doctype/currency/currency.txt +++ b/setup/doctype/currency/currency.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-01-19 11:14:50", + "creation": "2013-01-27 16:31:07", "docstatus": 0, - "modified": "2013-01-22 15:07:36", + "modified": "2013-01-27 13:32:26", "modified_by": "Administrator", "owner": "Administrator" }, @@ -56,24 +56,28 @@ "label": "Enabled" }, { + "description": "Sub-currency. For e.g. \"Cent\"", "doctype": "DocField", "fieldname": "fraction", "fieldtype": "Data", "label": "Fraction" }, { + "description": "1 Currency = [?] Fraction\nFor e.g. 1 USD = 100 Cent", "doctype": "DocField", "fieldname": "fraction_units", "fieldtype": "Int", "label": "Fraction Units" }, { + "description": "A symbol for this currency. For e.g. $", "doctype": "DocField", "fieldname": "symbol", "fieldtype": "Data", "label": "Symbol" }, { + "description": "How should the number be formatted?\n#,###.## or #.###,## etc.", "doctype": "DocField", "fieldname": "number_format", "fieldtype": "Data", diff --git a/startup/install.py b/startup/install.py index 00b7b84d9f..d94fd64b0e 100644 --- a/startup/install.py +++ b/startup/install.py @@ -20,7 +20,6 @@ def make_modules(): doc = webnotes.doc(fielddata = { "doctype": "Module Def", "module_name": m, - "disabled":"No" }) doc.insert() @@ -79,6 +78,7 @@ def feature_setup(): def import_country_and_currency(): from webnotes.country_info import get_all data = get_all() + for name in data: country = webnotes._dict(data[name]) webnotes.doc({ @@ -88,7 +88,7 @@ def import_country_and_currency(): "time_zones": "\n".join(country.timezones or []) }).insert() - if country.currency: + if country.currency and not webnotes.conn.exists("Currency", country.currency): webnotes.doc({ "doctype": "Currency", "currency_name": country.currency,