fixes related to currency and po price list
This commit is contained in:
parent
d4c7159f60
commit
44077d22cc
@ -66,6 +66,7 @@ erpnext.buying.BuyingController = erpnext.utils.Controller.extend({
|
|||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
if(this.frm.doc.price_list_name) {
|
if(this.frm.doc.price_list_name) {
|
||||||
|
if(!this.frm.doc.price_list_currency) {
|
||||||
// set price list currency
|
// set price list currency
|
||||||
this.frm.call({
|
this.frm.call({
|
||||||
method: "setup.utils.get_price_list_currency",
|
method: "setup.utils.get_price_list_currency",
|
||||||
@ -75,17 +76,13 @@ erpnext.buying.BuyingController = erpnext.utils.Controller.extend({
|
|||||||
}},
|
}},
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if(!r.exc) {
|
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();
|
me.price_list_currency();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
me.price_list_currency();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -145,9 +142,10 @@ erpnext.buying.BuyingController = erpnext.utils.Controller.extend({
|
|||||||
price_list_currency: function() {
|
price_list_currency: function() {
|
||||||
this.set_dynamic_labels();
|
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);
|
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) {
|
set_dynamic_labels: function(doc, dt, dn) {
|
||||||
|
@ -198,7 +198,7 @@ class DocType:
|
|||||||
# ---------------------------------------------------
|
# ---------------------------------------------------
|
||||||
def create_default_cost_center(self):
|
def create_default_cost_center(self):
|
||||||
glc = get_obj('GL Control')
|
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:
|
for c in cc_list:
|
||||||
glc.add_cc(str(c))
|
glc.add_cc(str(c))
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-01-19 11:14:50",
|
"creation": "2013-01-27 16:31:07",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-01-22 15:07:36",
|
"modified": "2013-01-27 13:32:26",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -56,24 +56,28 @@
|
|||||||
"label": "Enabled"
|
"label": "Enabled"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"description": "Sub-currency. For e.g. \"Cent\"",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "fraction",
|
"fieldname": "fraction",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Fraction"
|
"label": "Fraction"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"description": "1 Currency = [?] Fraction\nFor e.g. 1 USD = 100 Cent",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "fraction_units",
|
"fieldname": "fraction_units",
|
||||||
"fieldtype": "Int",
|
"fieldtype": "Int",
|
||||||
"label": "Fraction Units"
|
"label": "Fraction Units"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"description": "A symbol for this currency. For e.g. $",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "symbol",
|
"fieldname": "symbol",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Symbol"
|
"label": "Symbol"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"description": "How should the number be formatted?\n#,###.## or #.###,## etc.",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "number_format",
|
"fieldname": "number_format",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
|
@ -20,7 +20,6 @@ def make_modules():
|
|||||||
doc = webnotes.doc(fielddata = {
|
doc = webnotes.doc(fielddata = {
|
||||||
"doctype": "Module Def",
|
"doctype": "Module Def",
|
||||||
"module_name": m,
|
"module_name": m,
|
||||||
"disabled":"No"
|
|
||||||
})
|
})
|
||||||
doc.insert()
|
doc.insert()
|
||||||
|
|
||||||
@ -79,6 +78,7 @@ def feature_setup():
|
|||||||
def import_country_and_currency():
|
def import_country_and_currency():
|
||||||
from webnotes.country_info import get_all
|
from webnotes.country_info import get_all
|
||||||
data = get_all()
|
data = get_all()
|
||||||
|
|
||||||
for name in data:
|
for name in data:
|
||||||
country = webnotes._dict(data[name])
|
country = webnotes._dict(data[name])
|
||||||
webnotes.doc({
|
webnotes.doc({
|
||||||
@ -88,7 +88,7 @@ def import_country_and_currency():
|
|||||||
"time_zones": "\n".join(country.timezones or [])
|
"time_zones": "\n".join(country.timezones or [])
|
||||||
}).insert()
|
}).insert()
|
||||||
|
|
||||||
if country.currency:
|
if country.currency and not webnotes.conn.exists("Currency", country.currency):
|
||||||
webnotes.doc({
|
webnotes.doc({
|
||||||
"doctype": "Currency",
|
"doctype": "Currency",
|
||||||
"currency_name": country.currency,
|
"currency_name": country.currency,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user