Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set child table's value after v7.1 update #7148

Closed
jof2jc opened this issue Dec 6, 2016 · 6 comments
Closed

Cannot set child table's value after v7.1 update #7148

jof2jc opened this issue Dec 6, 2016 · 6 comments
Assignees

Comments

@jof2jc
Copy link
Contributor

jof2jc commented Dec 6, 2016

Before v7.1 the script did work, but affter v7.1 update..it's not working

frappe.ui.form.on("Stock Entry Detail", "item_code", function(frm, cdt, cdn) {
    var d = locals[cdt][cdn];
    
    if (frm.doc.purpose == "Material Receipt"){
	if (frm.doc.company == "Toko GBU"){
		//d.expense_account = "Capital Stock - tk";
   		frappe.model.set_value(d.doctype, d.name, "expense_account", "Capital Stock - tk");
		
	}
	else{
		d.expense_account = "Capital Stock - pt";
	}

    }
  //msgprint(d.expense_account);
});
@KanchanChauhan
Copy link
Contributor

Script looks fine, what is it complaining about?

@jof2jc
Copy link
Contributor Author

jof2jc commented Dec 6, 2016

if you test above script in Stock Entry, then expense account is always overridden by Stock Adjustment account.. I want to set another default account if users do MaterialReceipt transaction

@strixaluco
Copy link
Contributor

Is this still valid?

@jwrober jwrober added bug framework to-validate Old issues pending validation labels May 11, 2017
@mbauskar mbauskar self-assigned this May 15, 2017
@mbauskar mbauskar removed bug framework to-validate Old issues pending validation labels May 17, 2017
@mbauskar
Copy link
Contributor

@jof2jc,

It is not a bug, Your script works perfectly fine, the custom script is setting a value to expense account as Capital Stock - pt then system fetches the item details from the item master and sets the expense account defined in selected item.

please check https://github.com/frappe/erpnext/blob/develop/erpnext/stock/doctype/stock_entry/stock_entry.js#L157.

@jof2jc
Copy link
Contributor Author

jof2jc commented May 18, 2017

@mbauskar so custom script is not priority here...how to override it?

@mbauskar
Copy link
Contributor

@jof2jc you can set the value on validate trigger instead of item_code trigger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants