diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index e444a668f5..9a45c70091 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -50,10 +50,9 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { } } cur_frm.cscript.make_communication_body(); - } -cur_frm.cscript.onload_post_render = function(doc, dt, dn) { +cur_frm.cscript.onload_post_render = function(doc, dt, dn) { var callback = function(doc, dt, dn) { // defined in sales_common.js cur_frm.cscript.update_item_details(doc, dt, dn); diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 5756710779..a80fe11bf2 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -81,12 +81,19 @@ class DocType(TransactionBase): obj = get_obj('Sales Common') for doc in self.doclist: if doc.fields.get('item_code'): - arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'), - 'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')}; - ret = obj.get_item_defaults(arg) - for r in ret: - if not doc.fields.get(r): - doc.fields[r] = ret[r] + arg = { + 'item_code': doc.fields.get('item_code'), + 'income_account': doc.fields.get('income_account'), + 'cost_center': doc.fields.get('cost_center'), + 'warehouse': doc.fields.get('warehouse') + } + fields_dict = obj.get_item_details(arg, self) + if fields_dict: + doc.fields.update(fields_dict) + #ret = obj.get_item_defaults(arg) + #for r in ret: + # if not doc.fields.get(r): + # doc.fields[r] = ret[r] # Re-calculates Basic Rate & amount based on Price List Selected