From 2851dfad9974c9a49feee8f05a4adb6971c5cceb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 21 Sep 2017 15:41:15 +0530 Subject: [PATCH] Set fields in Item Variant Settings which should be copied from template to variant --- .../doctype/item_variant_settings/item_variant_settings.js | 5 +++-- .../doctype/item_variant_settings/item_variant_settings.py | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.js b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.js index 77ccfd0cc0..f3404cc78b 100644 --- a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.js +++ b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.js @@ -4,11 +4,12 @@ frappe.ui.form.on('Item Variant Settings', { setup: function(frm) { 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.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)) { allow_fields.push(d.fieldname); } diff --git a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.py b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.py index 1cc7c21520..80462d1ab8 100644 --- a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.py +++ b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.py @@ -10,11 +10,14 @@ class ItemVariantSettings(Document): def set_default_fields(self): self.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: 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', { 'field_name': d.fieldname }) \ No newline at end of file