[fix] removed validation of conversion rate equals 1 from all transaction
diff --git a/accounts/doctype/sales_invoice/sales_invoice.txt b/accounts/doctype/sales_invoice/sales_invoice.txt
index 516d192..b168ba6 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.txt
+++ b/accounts/doctype/sales_invoice/sales_invoice.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:05",
"docstatus": 0,
- "modified": "2013-10-03 18:54:31",
+ "modified": "2013-10-11 13:12:38",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -225,7 +225,6 @@
"reqd": 1
},
{
- "default": "1.00",
"description": "Rate at which Customer Currency is converted to customer's base currency",
"doctype": "DocField",
"fieldname": "conversion_rate",
diff --git a/public/js/transaction.js b/public/js/transaction.js
index e12d108..a7be5bd 100644
--- a/public/js/transaction.js
+++ b/public/js/transaction.js
@@ -21,8 +21,6 @@
company: wn.defaults.get_default("company"),
fiscal_year: wn.defaults.get_default("fiscal_year"),
is_subcontracted: "No",
- conversion_rate: 1.0,
- plc_conversion_rate: 1.0
}, function(fieldname, value) {
if(me.frm.fields_dict[fieldname] && !me.frm.doc[fieldname])
me.frm.set_value(fieldname, value);
@@ -131,10 +129,16 @@
company: function() {
if(this.frm.doc.company && this.frm.fields_dict.currency) {
+ var company_currency = this.get_company_currency();
if(!this.frm.doc.currency) {
- this.frm.set_value("currency", this.get_company_currency());
+ this.frm.set_value("currency", company_currency);
}
+ if(this.frm.doc.currency == company_currency)
+ this.frm.set_value("conversion_rate", 1.0);
+ if(this.frm.doc.price_list_currency == company_currency)
+ this.frm.set_value('plc_conversion_rate', 1.0);
+
this.frm.script_manager.trigger("currency");
}
},
@@ -233,29 +237,6 @@
this.calculate_taxes_and_totals();
},
- // serial_no: function(doc, cdt, cdn) {
- // var me = this;
- // var item = wn.model.get_doc(cdt, cdn);
- // if (!item.item_code) {
- // wn.call({
- // method: 'accounts.doctype.sales_invoice.pos.get_item_from_serial_no',
- // args: {serial_no: this.serial_no.$input.val()},
- // callback: function(r) {
- // if (r.message) {
- // var item_code = r.message[0].item_code;
- // var child = wn.model.add_child(me.frm.doc, this.frm.doctype + " Item",
- // this.frm.cscript.fname);
- // child.item_code = item_code;
- // me.frm.cscript.item_code(me.frm.doc, child.doctype, child.name);
- // }
- // else
- // msgprint(wn._("Invalid Serial No."));
- // me.refresh();
- // }
- // });
- // }
- // },
-
row_id: function(doc, cdt, cdn) {
var tax = wn.model.get_doc(cdt, cdn);
try {
@@ -486,12 +467,8 @@
}
var company_currency = this.get_company_currency();
- var valid_conversion_rate = this.frm.doc.conversion_rate ?
- ((this.frm.doc.currency == company_currency && this.frm.doc.conversion_rate == 1.0) ||
- (this.frm.doc.currency != company_currency && this.frm.doc.conversion_rate != 1.0)) :
- false;
- if(!valid_conversion_rate) {
+ if(!this.frm.doc.conversion_rate) {
wn.throw(wn._("Please enter valid") + " " + wn._(conversion_rate_label) +
" 1 " + this.frm.doc.currency + " = [?] " + company_currency);
}
diff --git a/selling/doctype/quotation/quotation.txt b/selling/doctype/quotation/quotation.txt
index 3f97c98..62c36b4 100644
--- a/selling/doctype/quotation/quotation.txt
+++ b/selling/doctype/quotation/quotation.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:08",
"docstatus": 0,
- "modified": "2013-09-10 10:46:33",
+ "modified": "2013-10-11 13:21:07",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -257,7 +257,6 @@
"width": "100px"
},
{
- "default": "1.00",
"description": "Rate at which customer's currency is converted to company's base currency",
"doctype": "DocField",
"fieldname": "conversion_rate",
diff --git a/selling/doctype/sales_order/sales_order.txt b/selling/doctype/sales_order/sales_order.txt
index 94e6388..46a06b5 100644
--- a/selling/doctype/sales_order/sales_order.txt
+++ b/selling/doctype/sales_order/sales_order.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-06-18 12:39:59",
"docstatus": 0,
- "modified": "2013-08-09 14:46:17",
+ "modified": "2013-10-11 13:18:47",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -272,7 +272,6 @@
"width": "100px"
},
{
- "default": "1.00",
"description": "Rate at which customer's currency is converted to company's base currency",
"doctype": "DocField",
"fieldname": "conversion_rate",
diff --git a/stock/doctype/delivery_note/delivery_note.txt b/stock/doctype/delivery_note/delivery_note.txt
index f1493bb..6834365 100644
--- a/stock/doctype/delivery_note/delivery_note.txt
+++ b/stock/doctype/delivery_note/delivery_note.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:09",
"docstatus": 0,
- "modified": "2013-08-09 14:46:32",
+ "modified": "2013-10-11 13:19:40",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -230,7 +230,7 @@
"depends_on": "eval:doc.po_no",
"doctype": "DocField",
"fieldname": "po_date",
- "fieldtype": "Data",
+ "fieldtype": "Date",
"hidden": 1,
"label": "Customer's Purchase Order Date",
"no_copy": 0,
@@ -263,7 +263,6 @@
"reqd": 1
},
{
- "default": "1.00",
"description": "Rate at which customer's currency is converted to company's base currency",
"doctype": "DocField",
"fieldname": "conversion_rate",
diff --git a/stock/doctype/purchase_receipt/purchase_receipt.txt b/stock/doctype/purchase_receipt/purchase_receipt.txt
index 1184643..f228a14 100755
--- a/stock/doctype/purchase_receipt/purchase_receipt.txt
+++ b/stock/doctype/purchase_receipt/purchase_receipt.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:39",
"docstatus": 0,
- "modified": "2013-08-09 14:47:05",
+ "modified": "2013-10-11 13:20:13",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -215,7 +215,6 @@
"reqd": 1
},
{
- "default": "1.00",
"description": "Rate at which supplier's currency is converted to company's base currency",
"doctype": "DocField",
"fieldname": "conversion_rate",
diff --git a/utilities/transaction_base.py b/utilities/transaction_base.py
index 36231bf..9921910 100644
--- a/utilities/transaction_base.py
+++ b/utilities/transaction_base.py
@@ -432,14 +432,7 @@
company_currency = webnotes.conn.get_value("Company", company, "default_currency")
- # parenthesis for 'OR' are necessary as we want it to evaluate as
- # mandatory valid condition and (1st optional valid condition
- # or 2nd optional valid condition)
- valid_conversion_rate = (conversion_rate and
- ((currency == company_currency and conversion_rate == 1.00)
- or (currency != company_currency and conversion_rate != 1.00)))
-
- if not valid_conversion_rate:
+ if not conversion_rate:
msgprint(_('Please enter valid ') + conversion_rate_label + (': ')
+ ("1 %s = [?] %s" % (currency, company_currency)),
raise_exception=True)