added patch and set default fields after completion of setup wizard
This commit is contained in:
parent
0e28fccb34
commit
5b05335e89
@ -446,3 +446,4 @@ erpnext.patches.v8_9.set_print_zero_amount_taxes
|
|||||||
erpnext.patches.v8_9.set_default_customer_group
|
erpnext.patches.v8_9.set_default_customer_group
|
||||||
erpnext.patches.v8_9.remove_employee_from_salary_structure_parent
|
erpnext.patches.v8_9.remove_employee_from_salary_structure_parent
|
||||||
erpnext.patches.v8_9.delete_gst_doctypes_for_outside_india_accounts
|
erpnext.patches.v8_9.delete_gst_doctypes_for_outside_india_accounts
|
||||||
|
erpnext.patches.v8_9.set_default_fields_in_variant_settings
|
@ -0,0 +1,13 @@
|
|||||||
|
# Copyright (c) 2017, Frappe and Contributors
|
||||||
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
frappe.reload_doc('stock', 'doctype', 'item_variant_settings')
|
||||||
|
frappe.reload_doc('stock', 'doctype', 'variant_field')
|
||||||
|
|
||||||
|
doc = frappe.get_doc('Item Variant Settings')
|
||||||
|
doc.set_default_fields()
|
||||||
|
doc.save()
|
@ -33,6 +33,7 @@ def setup_complete(args=None):
|
|||||||
create_feed_and_todo()
|
create_feed_and_todo()
|
||||||
create_email_digest()
|
create_email_digest()
|
||||||
create_letter_head(args)
|
create_letter_head(args)
|
||||||
|
set_no_copy_fields_in_variant_settings()
|
||||||
|
|
||||||
if args.get('domain').lower() == 'education':
|
if args.get('domain').lower() == 'education':
|
||||||
create_academic_year()
|
create_academic_year()
|
||||||
@ -354,6 +355,12 @@ def create_letter_head(args):
|
|||||||
fileurl = save_file(filename, content, "Letter Head", _("Standard"), decode=True).file_url
|
fileurl = save_file(filename, content, "Letter Head", _("Standard"), decode=True).file_url
|
||||||
frappe.db.set_value("Letter Head", _("Standard"), "content", "<img src='%s' style='max-width: 100%%;'>" % fileurl)
|
frappe.db.set_value("Letter Head", _("Standard"), "content", "<img src='%s' style='max-width: 100%%;'>" % fileurl)
|
||||||
|
|
||||||
|
def set_no_copy_fields_in_variant_settings():
|
||||||
|
# set no copy fields of an item doctype to item variant settings
|
||||||
|
doc = frappe.get_doc('Item Variant Settings')
|
||||||
|
doc.set_default_fields()
|
||||||
|
doc.save()
|
||||||
|
|
||||||
def create_logo(args):
|
def create_logo(args):
|
||||||
if args.get("attach_logo"):
|
if args.get("attach_logo"):
|
||||||
attach_logo = args.get("attach_logo").split(",")
|
attach_logo = args.get("attach_logo").split(",")
|
||||||
|
@ -4,9 +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"];
|
||||||
|
|
||||||
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) && !d.no_copy) {
|
if(!in_list(['HTML', 'Section Break', 'Column Break', 'Button'], d.fieldtype)
|
||||||
|
&& !d.no_copy && !in_list(exclude_fields, d.fieldname)) {
|
||||||
allow_fields.push(d.fieldname);
|
allow_fields.push(d.fieldname);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"fieldname": "variant_fields",
|
"fieldname": "copy_fields_to_variant",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
@ -27,7 +27,7 @@
|
|||||||
"in_global_search": 0,
|
"in_global_search": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"in_standard_filter": 0,
|
"in_standard_filter": 0,
|
||||||
"label": "Variant Fields",
|
"label": "Copy Fields to Variant",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
@ -84,8 +84,8 @@
|
|||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-08-29 16:38:49.467749",
|
"modified": "2017-09-11 12:05:16.288601",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "rohit@erpnext.com",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Item Variant Settings",
|
"name": "Item Variant Settings",
|
||||||
"name_case": "",
|
"name_case": "",
|
||||||
|
@ -3,7 +3,18 @@
|
|||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
class ItemVariantSettings(Document):
|
class ItemVariantSettings(Document):
|
||||||
pass
|
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"]
|
||||||
|
|
||||||
|
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']:
|
||||||
|
self.append('fields', {
|
||||||
|
'field_name': d.fieldname
|
||||||
|
})
|
@ -0,0 +1,9 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
|
# See license.txt
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
class TestItemVariantSettings(unittest.TestCase):
|
||||||
|
pass
|
Loading…
x
Reference in New Issue
Block a user