[fix] allow editing of variant properties, reverting earlier fix (#8905)
This commit is contained in:
parent
83f8344e62
commit
c6d75eb942
@ -65,7 +65,7 @@ frappe.ui.form.on("Item", {
|
|||||||
frm.page.set_inner_btn_group_as_primary(__("Make"));
|
frm.page.set_inner_btn_group_as_primary(__("Make"));
|
||||||
}
|
}
|
||||||
if (frm.doc.variant_of) {
|
if (frm.doc.variant_of) {
|
||||||
frm.set_intro(__("This Item is a Variant of {0} (Template). Attributes will be copied over from the template unless 'No Copy' is set",
|
frm.set_intro(__("This Item is a Variant of {0} (Template).",
|
||||||
[frm.doc.variant_of]), true);
|
[frm.doc.variant_of]), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,8 +97,6 @@ frappe.ui.form.on("Item", {
|
|||||||
}
|
}
|
||||||
frappe.set_route('Form', 'Item', new_item.name);
|
frappe.set_route('Form', 'Item', new_item.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.trigger('make_variant_fields_read_only');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
validate: function(frm){
|
validate: function(frm){
|
||||||
@ -109,16 +107,6 @@ frappe.ui.form.on("Item", {
|
|||||||
refresh_field("image_view");
|
refresh_field("image_view");
|
||||||
},
|
},
|
||||||
|
|
||||||
make_variant_fields_read_only: function(frm) {
|
|
||||||
if(frm.doc.variant_of) {
|
|
||||||
frm.meta.fields.forEach(function(df) {
|
|
||||||
if (!df.no_copy) {
|
|
||||||
frm.toggle_enable(df.fieldname, false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
is_fixed_asset: function(frm) {
|
is_fixed_asset: function(frm) {
|
||||||
if (frm.doc.is_fixed_asset) {
|
if (frm.doc.is_fixed_asset) {
|
||||||
frm.set_value("is_stock_item", 0);
|
frm.set_value("is_stock_item", 0);
|
||||||
|
@ -86,7 +86,6 @@ class Item(WebsiteGenerator):
|
|||||||
self.validate_has_variants()
|
self.validate_has_variants()
|
||||||
self.validate_attributes()
|
self.validate_attributes()
|
||||||
self.validate_variant_attributes()
|
self.validate_variant_attributes()
|
||||||
self.copy_variant_attributes()
|
|
||||||
self.validate_website_image()
|
self.validate_website_image()
|
||||||
self.make_thumbnail()
|
self.make_thumbnail()
|
||||||
self.validate_fixed_asset()
|
self.validate_fixed_asset()
|
||||||
@ -673,12 +672,6 @@ class Item(WebsiteGenerator):
|
|||||||
|
|
||||||
validate_item_variant_attributes(self, args)
|
validate_item_variant_attributes(self, args)
|
||||||
|
|
||||||
def copy_variant_attributes(self):
|
|
||||||
'''Copy attributes from template (if they have been changed before saving)'''
|
|
||||||
if self.variant_of:
|
|
||||||
template = frappe.get_doc('Item', self.variant_of)
|
|
||||||
copy_attributes_to_variant(template, self)
|
|
||||||
|
|
||||||
def get_timeline_data(doctype, name):
|
def get_timeline_data(doctype, name):
|
||||||
'''returns timeline data based on stock ledger entry'''
|
'''returns timeline data based on stock ledger entry'''
|
||||||
out = {}
|
out = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user