[fix] frappe.require in stock_entry.js

This commit is contained in:
Rushabh Mehta 2016-04-26 12:59:08 +05:30
parent 3d2622ce91
commit 5dfe20ce17
3 changed files with 27 additions and 8 deletions

View File

@ -2,8 +2,10 @@
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
frappe.provide("erpnext"); frappe.provide("erpnext");
frappe.require("assets/erpnext/js/controllers/taxes_and_totals.js"); frappe.require([
frappe.require("assets/erpnext/js/utils.js"); "assets/erpnext/js/controllers/taxes_and_totals.js",
"assets/erpnext/js/utils.js",
"assets/erpnext/js/utils/item_selector.js"]);
erpnext.TransactionController = erpnext.taxes_and_totals.extend({ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
onload: function() { onload: function() {
@ -309,8 +311,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date; if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date;
else var date = this.frm.doc.transaction_date; else var date = this.frm.doc.transaction_date;
if (frappe.meta.get_docfield(this.frm.doctype, "shipping_address") && if (frappe.meta.get_docfield(this.frm.doctype, "shipping_address") &&
in_list(['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'], this.frm.doctype)){ in_list(['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'], this.frm.doctype)){
erpnext.utils.get_shipping_address(this.frm, function(){ erpnext.utils.get_shipping_address(this.frm, function(){
set_party_account(set_pricing); set_party_account(set_pricing);

View File

@ -124,7 +124,7 @@ erpnext.stock.move_item = function(item, source, target, actual_qty, rate, callb
} }
if(rate) { if(rate) {
dialog.get_field('rate').set_value('rate'); dialog.get_field('rate').set_value(rate);
dialog.get_field('rate').df.hidden = 0; dialog.get_field('rate').df.hidden = 0;
dialog.get_field('rate').refresh(); dialog.get_field('rate').refresh();
} }
@ -136,7 +136,7 @@ erpnext.stock.move_item = function(item, source, target, actual_qty, rate, callb
} }
dialog.set_primary_action(__('Submit'), function() { dialog.set_primary_action(__('Submit'), function() {
values = dialog.get_values(); var values = dialog.get_values();
if(!values) { if(!values) {
return; return;
} }
@ -159,4 +159,18 @@ erpnext.stock.move_item = function(item, source, target, actual_qty, rate, callb
}, },
}); });
}); });
$('<p><a class="link-open">' + __("Add more items or open form") + '</a></p>')
.appendTo(dialog.body)
.find('.link-open')
.on('click', function() {
var doc = frappe.new_doc('Stock Entry');
doc.from_warehouse = dialog.get_value('source');
doc.to_warehouse = dialog.get_value('target');
row = frappe.model.add_child(doc, 'items');
row.item_code = dialog.get_value('item_code');
row.qty = dialog.get_value('qty');
row.basic_rate = dialog.get_value('rate');
frappe.set_route('Form', doc.doctype, doc.name);
});
} }

View File

@ -1,7 +1,10 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt
frappe.require("assets/erpnext/js/controllers/stock_controller.js"); frappe.require([
frappe.require("assets/erpnext/js/utils.js"); "assets/erpnext/js/controllers/stock_controller.js",
"assets/erpnext/js/utils.js",
"assets/erpnext/js/utils/item_selector.js"]);
frappe.provide("erpnext.stock"); frappe.provide("erpnext.stock");
erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({