Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
b6f37b8195
@ -349,7 +349,7 @@ if (sys_defaults.auto_accounting_for_stock) {
|
|||||||
|
|
||||||
// warehouse in detail table
|
// warehouse in detail table
|
||||||
//----------------------------
|
//----------------------------
|
||||||
cur_frm.fields_dict['entries'].grid.get_field('warehouse').get_query= function(doc, cdt, cdn) {
|
cur_frm.fields_dict['entries'].grid.get_field('warehouse').get_query = function(doc, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
return{
|
return{
|
||||||
filters:[
|
filters:[
|
||||||
@ -370,34 +370,16 @@ cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = functio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.income_account = function(doc, cdt, cdn){
|
cur_frm.cscript.income_account = function(doc, cdt, cdn) {
|
||||||
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "income_account");
|
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "income_account");
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.expense_account = function(doc, cdt, cdn){
|
cur_frm.cscript.expense_account = function(doc, cdt, cdn) {
|
||||||
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "expense_account");
|
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "expense_account");
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.copy_account_in_all_row = function(doc, cdt, cdn, fieldname) {
|
cur_frm.cscript.cost_center = function(doc, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "cost_center");
|
||||||
if(d[fieldname]){
|
|
||||||
var cl = getchildren('Sales Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
|
|
||||||
for(var i = 0; i < cl.length; i++){
|
|
||||||
if(!cl[i][fieldname]) cl[i][fieldname] = d[fieldname];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
refresh_field(cur_frm.cscript.fname);
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.cscript.cost_center = function(doc, cdt, cdn){
|
|
||||||
var d = locals[cdt][cdn];
|
|
||||||
if(d.cost_center){
|
|
||||||
var cl = getchildren('Sales Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
|
|
||||||
for(var i = 0; i < cl.length; i++){
|
|
||||||
if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
refresh_field(cur_frm.cscript.fname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
||||||
|
@ -20,7 +20,7 @@ An Item can have multiple prices based on customer, currency, region, shipping c
|
|||||||
|
|
||||||
> Setup > Item Price
|
> Setup > Item Price
|
||||||
|
|
||||||
- Enter Price List and Item Code, Valid for Buying or Selling, Item Name & Item Description will be automatically fetched.
|
- Enter Price List and Item Code, Valid for Buying or Selling, Item Name and Item Description will be automatically fetched.
|
||||||
- Enter Rate and save the document.
|
- Enter Rate and save the document.
|
||||||
|
|
||||||

|

|
||||||
|
@ -18,6 +18,7 @@ erpnext.stock.StockController = wn.ui.form.Controller.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
show_general_ledger: function() {
|
show_general_ledger: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.docstatus===1 && cint(wn.defaults.get_default("auto_accounting_for_stock"))) {
|
if(this.frm.doc.docstatus===1 && cint(wn.defaults.get_default("auto_accounting_for_stock"))) {
|
||||||
@ -30,5 +31,16 @@ erpnext.stock.StockController = wn.ui.form.Controller.extend({
|
|||||||
wn.set_route("general-ledger");
|
wn.set_route("general-ledger");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
copy_account_in_all_row: function(doc, dt, dn, fieldname) {
|
||||||
|
var d = locals[dt][dn];
|
||||||
|
if(d[fieldname]){
|
||||||
|
var cl = getchildren(this.frm.cscript.tname, doc.name, this.frm.cscript.fname, doc.doctype);
|
||||||
|
for(var i = 0; i < cl.length; i++) {
|
||||||
|
if(!cl[i][fieldname]) cl[i][fieldname] = d[fieldname];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
refresh_field(this.frm.cscript.fname);
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -1,6 +1,9 @@
|
|||||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
cur_frm.cscript.tname = "Stock Entry Detail";
|
||||||
|
cur_frm.cscript.fname = "mtn_details";
|
||||||
|
|
||||||
wn.require("public/app/js/controllers/stock_controller.js");
|
wn.require("public/app/js/controllers/stock_controller.js");
|
||||||
wn.provide("erpnext.stock");
|
wn.provide("erpnext.stock");
|
||||||
|
|
||||||
@ -112,12 +115,6 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
entries_add: function(doc, cdt, cdn) {
|
|
||||||
var row = wn.model.get_doc(cdt, cdn);
|
|
||||||
this.frm.script_manager.copy_from_first_row("mtn_details", row,
|
|
||||||
["expense_account", "cost_center"]);
|
|
||||||
},
|
|
||||||
|
|
||||||
clean_up: function() {
|
clean_up: function() {
|
||||||
// Clear Production Order record from locals, because it is updated via Stock Entry
|
// Clear Production Order record from locals, because it is updated via Stock Entry
|
||||||
if(this.frm.doc.production_order &&
|
if(this.frm.doc.production_order &&
|
||||||
@ -224,6 +221,8 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
|||||||
|
|
||||||
mtn_details_add: function(doc, cdt, cdn) {
|
mtn_details_add: function(doc, cdt, cdn) {
|
||||||
var row = wn.model.get_doc(cdt, cdn);
|
var row = wn.model.get_doc(cdt, cdn);
|
||||||
|
this.frm.script_manager.copy_from_first_row("mtn_details", row,
|
||||||
|
["expense_account", "cost_center"]);
|
||||||
|
|
||||||
if(!row.s_warehouse) row.s_warehouse = this.frm.doc.from_warehouse;
|
if(!row.s_warehouse) row.s_warehouse = this.frm.doc.from_warehouse;
|
||||||
if(!row.t_warehouse) row.t_warehouse = this.frm.doc.to_warehouse;
|
if(!row.t_warehouse) row.t_warehouse = this.frm.doc.to_warehouse;
|
||||||
@ -260,24 +259,29 @@ cur_frm.cscript.toggle_related_fields = function(doc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.delivery_note_no = function(doc,cdt,cdn){
|
cur_frm.cscript.delivery_note_no = function(doc, cdt, cdn) {
|
||||||
if(doc.delivery_note_no) return get_server_fields('get_cust_values','','',doc,cdt,cdn,1);
|
if(doc.delivery_note_no)
|
||||||
|
return get_server_fields('get_cust_values', '', '', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.sales_invoice_no = function(doc,cdt,cdn){
|
cur_frm.cscript.sales_invoice_no = function(doc, cdt, cdn) {
|
||||||
if(doc.sales_invoice_no) return get_server_fields('get_cust_values','','',doc,cdt,cdn,1);
|
if(doc.sales_invoice_no)
|
||||||
|
return get_server_fields('get_cust_values', '', '', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.customer = function(doc,cdt,cdn){
|
cur_frm.cscript.customer = function(doc, cdt, cdn) {
|
||||||
if(doc.customer) return get_server_fields('get_cust_addr','','',doc,cdt,cdn,1);
|
if(doc.customer)
|
||||||
|
return get_server_fields('get_cust_addr', '', '', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.purchase_receipt_no = function(doc,cdt,cdn){
|
cur_frm.cscript.purchase_receipt_no = function(doc, cdt, cdn) {
|
||||||
if(doc.purchase_receipt_no) return get_server_fields('get_supp_values','','',doc,cdt,cdn,1);
|
if(doc.purchase_receipt_no)
|
||||||
|
return get_server_fields('get_supp_values', '', '', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.supplier = function(doc,cdt,cdn){
|
cur_frm.cscript.supplier = function(doc, cdt, cdn) {
|
||||||
if(doc.supplier) return get_server_fields('get_supp_addr','','',doc,cdt,cdn,1);
|
if(doc.supplier)
|
||||||
|
return get_server_fields('get_supp_addr', '', '', doc, cdt, cdn, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,9 +322,13 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
|||||||
'warehouse' : cstr(d.s_warehouse) || cstr(d.t_warehouse),
|
'warehouse' : cstr(d.s_warehouse) || cstr(d.t_warehouse),
|
||||||
'transfer_qty' : d.transfer_qty,
|
'transfer_qty' : d.transfer_qty,
|
||||||
'serial_no' : d.serial_no,
|
'serial_no' : d.serial_no,
|
||||||
'bom_no' : d.bom_no
|
'bom_no' : d.bom_no,
|
||||||
|
'expense_account' : d.expense_account,
|
||||||
|
'cost_center' : d.cost_center,
|
||||||
|
'company' : cur_frm.doc.company
|
||||||
};
|
};
|
||||||
return get_server_fields('get_item_details',JSON.stringify(args),'mtn_details',doc,cdt,cdn,1);
|
return get_server_fields('get_item_details', JSON.stringify(args),
|
||||||
|
'mtn_details', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.s_warehouse = function(doc, cdt, cdn) {
|
cur_frm.cscript.s_warehouse = function(doc, cdt, cdn) {
|
||||||
@ -343,7 +351,8 @@ cur_frm.cscript.uom = function(doc, cdt, cdn) {
|
|||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if(d.uom && d.item_code){
|
if(d.uom && d.item_code){
|
||||||
var arg = {'item_code':d.item_code, 'uom':d.uom, 'qty':d.qty}
|
var arg = {'item_code':d.item_code, 'uom':d.uom, 'qty':d.qty}
|
||||||
return get_server_fields('get_uom_details',JSON.stringify(arg),'mtn_details', doc, cdt, cdn, 1);
|
return get_server_fields('get_uom_details', JSON.stringify(arg),
|
||||||
|
'mtn_details', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,15 +363,25 @@ cur_frm.cscript.validate = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.validate_items = function(doc) {
|
cur_frm.cscript.validate_items = function(doc) {
|
||||||
cl = getchildren('Stock Entry Detail',doc.name,'mtn_details');
|
cl = getchildren('Stock Entry Detail', doc.name, 'mtn_details');
|
||||||
if (!cl.length) {
|
if (!cl.length) {
|
||||||
alert("Item table can not be blank");
|
alert("Item table can not be blank");
|
||||||
validated = false;
|
validated = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
|
cur_frm.cscript.expense_account = function(doc, cdt, cdn) {
|
||||||
return{ query:"controllers.queries.customer_query" } }
|
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "expense_account");
|
||||||
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict.supplier.get_query = function(doc,cdt,cdn) {
|
cur_frm.cscript.cost_center = function(doc, cdt, cdn) {
|
||||||
return{ query:"controllers.queries.supplier_query" } }
|
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "cost_center");
|
||||||
|
}
|
||||||
|
|
||||||
|
cur_frm.fields_dict.customer.get_query = function(doc, cdt, cdn) {
|
||||||
|
return{ query:"controllers.queries.customer_query" }
|
||||||
|
}
|
||||||
|
|
||||||
|
cur_frm.fields_dict.supplier.get_query = function(doc, cdt, cdn) {
|
||||||
|
return{ query:"controllers.queries.supplier_query" }
|
||||||
|
}
|
@ -369,7 +369,8 @@ class DocType(StockController):
|
|||||||
def get_item_details(self, arg):
|
def get_item_details(self, arg):
|
||||||
arg = json.loads(arg)
|
arg = json.loads(arg)
|
||||||
|
|
||||||
item = sql("""select stock_uom, description, item_name from `tabItem`
|
item = sql("""select stock_uom, description, item_name,
|
||||||
|
purchase_account, cost_center from `tabItem`
|
||||||
where name = %s and (ifnull(end_of_life,'')='' or end_of_life ='0000-00-00'
|
where name = %s and (ifnull(end_of_life,'')='' or end_of_life ='0000-00-00'
|
||||||
or end_of_life > now())""", (arg.get('item_code')), as_dict = 1)
|
or end_of_life > now())""", (arg.get('item_code')), as_dict = 1)
|
||||||
if not item:
|
if not item:
|
||||||
@ -380,6 +381,9 @@ class DocType(StockController):
|
|||||||
'stock_uom' : item and item[0]['stock_uom'] or '',
|
'stock_uom' : item and item[0]['stock_uom'] or '',
|
||||||
'description' : item and item[0]['description'] or '',
|
'description' : item and item[0]['description'] or '',
|
||||||
'item_name' : item and item[0]['item_name'] or '',
|
'item_name' : item and item[0]['item_name'] or '',
|
||||||
|
'expense_account' : item and item[0]['purchase_account'] or arg.get("expense_account") \
|
||||||
|
or webnotes.conn.get_value("Company", arg.get("company"), "default_expense_account"),
|
||||||
|
'cost_center' : item and item[0]['cost_center'] or arg.get("cost_center"),
|
||||||
'qty' : 0,
|
'qty' : 0,
|
||||||
'transfer_qty' : 0,
|
'transfer_qty' : 0,
|
||||||
'conversion_factor' : 1,
|
'conversion_factor' : 1,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-03-29 18:22:12",
|
"creation": "2013-03-29 18:22:12",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-08-28 19:25:38",
|
"modified": "2013-10-15 14:58:09",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -154,6 +154,7 @@
|
|||||||
"print_hide": 1
|
"print_hide": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"default": ":Company",
|
||||||
"depends_on": "eval:sys_defaults.auto_accounting_for_stock",
|
"depends_on": "eval:sys_defaults.auto_accounting_for_stock",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "cost_center",
|
"fieldname": "cost_center",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user