Set fields in Item Variant Settings which should be copied from template to variant
This commit is contained in:
parent
5b05335e89
commit
2851dfad99
@ -4,11 +4,12 @@
|
|||||||
frappe.ui.form.on('Item Variant Settings', {
|
frappe.ui.form.on('Item Variant Settings', {
|
||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
const allow_fields = [];
|
const allow_fields = [];
|
||||||
const exclude_fields = ["item_code", "item_name", "show_in_website", "show_variant_in_website", "standard_rate"];
|
const exclude_fields = ["item_code", "item_name", "show_in_website", "show_variant_in_website",
|
||||||
|
"opening_stock", "variant_of", "valuation_rate", "variant_based_on"];
|
||||||
|
|
||||||
frappe.model.with_doctype('Item', () => {
|
frappe.model.with_doctype('Item', () => {
|
||||||
frappe.get_meta('Item').fields.forEach(d => {
|
frappe.get_meta('Item').fields.forEach(d => {
|
||||||
if(!in_list(['HTML', 'Section Break', 'Column Break', 'Button'], d.fieldtype)
|
if(!in_list(['HTML', 'Section Break', 'Column Break', 'Button', 'Read Only'], d.fieldtype)
|
||||||
&& !d.no_copy && !in_list(exclude_fields, d.fieldname)) {
|
&& !d.no_copy && !in_list(exclude_fields, d.fieldname)) {
|
||||||
allow_fields.push(d.fieldname);
|
allow_fields.push(d.fieldname);
|
||||||
}
|
}
|
||||||
|
@ -10,11 +10,14 @@ class ItemVariantSettings(Document):
|
|||||||
def set_default_fields(self):
|
def set_default_fields(self):
|
||||||
self.fields = []
|
self.fields = []
|
||||||
fields = frappe.get_meta('Item').fields
|
fields = frappe.get_meta('Item').fields
|
||||||
exclude_fields = ["item_code", "item_name", "show_in_website", "show_variant_in_website", "standard_rate"]
|
exclude_fields = ["item_code", "item_name", "show_in_website", "show_variant_in_website",
|
||||||
|
"standard_rate", "opening_stock", "image", "description",
|
||||||
|
"variant_of", "valuation_rate", "description", "variant_based_on",
|
||||||
|
"website_image", "thumbnail", "website_specifiations", "web_long_description"]
|
||||||
|
|
||||||
for d in fields:
|
for d in fields:
|
||||||
if not d.no_copy and d.fieldname not in exclude_fields and \
|
if not d.no_copy and d.fieldname not in exclude_fields and \
|
||||||
d.fieldtype not in ['HTML', 'Section Break', 'Column Break', 'Button']:
|
d.fieldtype not in ['HTML', 'Section Break', 'Column Break', 'Button', 'Read Only']:
|
||||||
self.append('fields', {
|
self.append('fields', {
|
||||||
'field_name': d.fieldname
|
'field_name': d.fieldname
|
||||||
})
|
})
|
Loading…
Reference in New Issue
Block a user