[minor] clear Item's introduction section on refresh

This commit is contained in:
Anand Doshi 2015-06-16 13:06:37 -04:00
parent 6a8d7a1b91
commit ac59c2b300

View File

@ -55,6 +55,9 @@ frappe.ui.form.on("Item", {
// read only if any stock ledger entry exists // read only if any stock ledger entry exists
erpnext.item.make_dashboard(frm); erpnext.item.make_dashboard(frm);
// clear intro
frm.set_intro();
if (frm.doc.has_variants) { if (frm.doc.has_variants) {
frm.set_intro(__("This Item is a Template and cannot be used in transactions. Item attributes will be copied over into the variants unless 'No Copy' is set"), true); frm.set_intro(__("This Item is a Template and cannot be used in transactions. Item attributes will be copied over into the variants unless 'No Copy' is set"), true);
frm.add_custom_button(__("Show Variants"), function() { frm.add_custom_button(__("Show Variants"), function() {
@ -85,7 +88,7 @@ frappe.ui.form.on("Item", {
erpnext.item.weight_to_validate(frm); erpnext.item.weight_to_validate(frm);
erpnext.item.variants_can_not_be_created_manually(frm); erpnext.item.variants_can_not_be_created_manually(frm);
}, },
image: function(frm) { image: function(frm) {
refresh_field("image_view"); refresh_field("image_view");
}, },
@ -209,11 +212,11 @@ $.extend(erpnext.item, {
validated = 0; validated = 0;
} }
}, },
variants_can_not_be_created_manually: function(frm) { variants_can_not_be_created_manually: function(frm) {
if (frm.doc.__islocal && frm.doc.variant_of) if (frm.doc.__islocal && frm.doc.variant_of)
frappe.throw(__("Variants can not be created manually, add item attributes in the template item")) frappe.throw(__("Variants can not be created manually, add item attributes in the template item"))
} }
}); });