[minor] [fix] opportunity form, queries, stock uom replace utility

This commit is contained in:
Anand Doshi
2013-07-18 13:26:27 +05:30
parent 4daf3dd8a8
commit 61cad5076b
7 changed files with 133 additions and 282 deletions

View File

@@ -14,15 +14,17 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
cur_frm.fields_dict['item_code'].get_query = function(doc) {
return {
query: "controllers.queries.item_std"
}
}
//==================== Get Items Stock UOM =====================================================
cur_frm.cscript.item_code = function(doc,cdt,cdn) {
if (doc.item_code) {
get_server_fields('get_stock_uom', doc.item_code, '', doc, cdt, cdn, 1);
}
}
$.extend(cur_frm.cscript, {
onload: function() {
cur_frm.set_query("item_code", erpnext.queries.item);
},
item_code: function() {
if(cur_frm.doc.item_code) {
cur_frm.call({
method: "get_stock_uom",
args: { item_code: cur_frm.doc.item_code }
});
}
}
});

View File

@@ -31,9 +31,6 @@ class DocType:
def __init__(self, d, dl=[]):
self.doc, self.doclist = d,dl
def get_stock_uom(self, item_code):
return {'current_stock_uom': cstr(webnotes.conn.get_value('Item', item_code, 'stock_uom'))}
def validate_mandatory(self):
if not cstr(self.doc.item_code):
msgprint("Please Enter an Item.")
@@ -111,3 +108,8 @@ class DocType:
self.update_bin()
get_obj("Item", self.doc.item_code).on_update()
@webnotes.whitelist()
def get_stock_uom(item_code):
return { 'current_stock_uom': cstr(webnotes.conn.get_value('Item', item_code, 'stock_uom')) }