[usability] Allow user to edit Price List if this option is checked in Selling Settings [issue] webnotes/erpnext#707

This commit is contained in:
Anand Doshi 2013-08-02 12:39:10 +05:30
parent a1ad6e14ae
commit 33fe86777c
3 changed files with 20 additions and 3 deletions

View File

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

View File

@ -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"]:
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, ""))

View File

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