fixes related to currency and po price list

This commit is contained in:
Anand Doshi 2013-01-27 17:02:49 +05:30
parent d4c7159f60
commit 44077d22cc
4 changed files with 28 additions and 26 deletions

View File

@ -66,6 +66,7 @@ erpnext.buying.BuyingController = erpnext.utils.Controller.extend({
var me = this;
if(this.frm.doc.price_list_name) {
if(!this.frm.doc.price_list_currency) {
// set price list currency
this.frm.call({
method: "setup.utils.get_price_list_currency",
@ -75,17 +76,13 @@ erpnext.buying.BuyingController = erpnext.utils.Controller.extend({
}},
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)
me.price_list_currency();
}
}
});
} else {
me.price_list_currency();
}
}
},
@ -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) {

View File

@ -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))

View File

@ -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",

View File

@ -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,