diff --git a/selling/doctype/sales_common/sales_common.js b/selling/doctype/sales_common/sales_common.js index e59a7474f9..b3ae0fe17a 100644 --- a/selling/doctype/sales_common/sales_common.js +++ b/selling/doctype/sales_common/sales_common.js @@ -29,6 +29,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this._super(); this.toggle_rounded_total(); this.setup_queries(); + this.toggle_editable_price_list_rate(); }, setup_queries: function() { @@ -317,6 +318,15 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ } }, + toggle_editable_price_list_rate: function() { + var df = wn.meta.get_docfield(this.tname, "ref_rate", this.frm.doc.name); + var editable_price_list_rate = cint(wn.defaults.get_default("editable_price_list_rate")); + + if(df && editable_price_list_rate) { + df.read_only = 0; + } + }, + calculate_taxes_and_totals: function() { this._super(); this.calculate_total_advance("Sales Invoice", "advance_adjustment_details"); diff --git a/selling/doctype/selling_settings/selling_settings.py b/selling/doctype/selling_settings/selling_settings.py index febf3754ef..b25e987c3f 100644 --- a/selling/doctype/selling_settings/selling_settings.py +++ b/selling/doctype/selling_settings/selling_settings.py @@ -8,5 +8,6 @@ class DocType: self.doc, self.doclist = d, dl def validate(self): - for key in ["cust_master_name", "customer_group", "territory", "maintain_same_sales_rate"]: - webnotes.conn.set_default(key, self.doc.fields.get(key, "")) + for key in ["cust_master_name", "customer_group", "territory", "maintain_same_sales_rate", + "editable_price_list_rate"]: + webnotes.conn.set_default(key, self.doc.fields.get(key, "")) diff --git a/selling/doctype/selling_settings/selling_settings.txt b/selling/doctype/selling_settings/selling_settings.txt index 934cd41d27..97a339a486 100644 --- a/selling/doctype/selling_settings/selling_settings.txt +++ b/selling/doctype/selling_settings/selling_settings.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-25 10:25:16", "docstatus": 0, - "modified": "2013-07-18 12:03:39", + "modified": "2013-08-02 12:09:20", "modified_by": "Administrator", "owner": "Administrator" }, @@ -94,6 +94,12 @@ "fieldtype": "Check", "label": "Maintain Same Rate Throughout Sales Cycle" }, + { + "doctype": "DocField", + "fieldname": "editable_price_list_rate", + "fieldtype": "Check", + "label": "Allow user to edit Price List Rate in transactions" + }, { "doctype": "DocPerm" }