mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 04:39:11 +00:00
Multiple Fixes
This commit is contained in:
@@ -6,6 +6,10 @@ frappe.provide("erpnext.item");
|
||||
frappe.ui.form.on("Item", {
|
||||
onload: function(frm) {
|
||||
erpnext.item.setup_queries(frm);
|
||||
if (frm.doc.variant_of){
|
||||
frm.fields_dict["attributes"].grid.set_column_disp("attribute_value", true);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
refresh: function(frm) {
|
||||
@@ -31,8 +35,8 @@ frappe.ui.form.on("Item", {
|
||||
frappe.set_route("List", "Item", {"variant_of": frm.doc.name});
|
||||
}, "icon-list", "btn-default");
|
||||
|
||||
frm.add_custom_button(__("Search Variant"), function() {
|
||||
erpnext.item.search_variant()
|
||||
frm.add_custom_button(__("Make Variant"), function() {
|
||||
erpnext.item.make_variant()
|
||||
}, "icon-list", "btn-default");
|
||||
}
|
||||
if (frm.doc.variant_of) {
|
||||
@@ -53,6 +57,8 @@ frappe.ui.form.on("Item", {
|
||||
}
|
||||
|
||||
erpnext.item.toggle_reqd(frm);
|
||||
|
||||
erpnext.item.toggle_attributes(frm);
|
||||
},
|
||||
|
||||
validate: function(frm){
|
||||
@@ -86,6 +92,10 @@ frappe.ui.form.on("Item", {
|
||||
|
||||
is_stock_item: function(frm) {
|
||||
erpnext.item.toggle_reqd(frm);
|
||||
},
|
||||
|
||||
has_variants: function(frm) {
|
||||
erpnext.item.toggle_attributes(frm);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -184,12 +194,12 @@ $.extend(erpnext.item, {
|
||||
}
|
||||
},
|
||||
|
||||
search_variant: function(doc) {
|
||||
make_variant: function(doc) {
|
||||
var fields = []
|
||||
|
||||
for(var i=0;i< cur_frm.doc.valid_attributes.length;i++){
|
||||
for(var i=0;i< cur_frm.doc.attributes.length;i++){
|
||||
var fieldtype, desc;
|
||||
var row = cur_frm.doc.valid_attributes[i];
|
||||
var row = cur_frm.doc.attributes[i];
|
||||
if (row.numeric_values){
|
||||
fieldtype = "Float";
|
||||
desc = "Min Value: "+ row.from_range +" , Max Value: "+ row.to_range +", in Increments of: "+ row.increment
|
||||
@@ -206,18 +216,13 @@ $.extend(erpnext.item, {
|
||||
"description": desc
|
||||
})
|
||||
}
|
||||
fields = fields.concat({
|
||||
"label": "Result",
|
||||
"fieldname": "result",
|
||||
"fieldtype": "HTML"
|
||||
})
|
||||
|
||||
var d = new frappe.ui.Dialog({
|
||||
title: __("Search Variant"),
|
||||
title: __("Make Variant"),
|
||||
fields: fields
|
||||
});
|
||||
|
||||
d.set_primary_action(__("Search"), function() {
|
||||
d.set_primary_action(__("Make"), function() {
|
||||
args = d.get_values();
|
||||
if(!args) return;
|
||||
frappe.call({
|
||||
@@ -227,28 +232,32 @@ $.extend(erpnext.item, {
|
||||
"args": d.get_values()
|
||||
},
|
||||
callback: function(r) {
|
||||
// returns variant item
|
||||
if (r.message) {
|
||||
d.get_field("result").set_value($('<a class="btn btn-default btn-sm">'+__("View {0}", [r.message[0]])+'</a>')
|
||||
.on("click", function() {
|
||||
d.hide();
|
||||
frappe.set_route("Form", "Item", r.message[0]);
|
||||
}));
|
||||
var variant = r.message[0];
|
||||
var msgprint_dialog = frappe.msgprint(__("Item Variant {0} already exists with same attributes",
|
||||
[repl('<a href="#Form/Item/%(item_encoded)s" class="strong variant-click">%(item)s</a>', {
|
||||
item_encoded: encodeURIComponent(variant),
|
||||
item: variant
|
||||
})]
|
||||
));
|
||||
msgprint_dialog.hide_on_page_refresh = true;
|
||||
msgprint_dialog.$wrapper.find(".variant-click").on("click", function() {
|
||||
d.hide();
|
||||
});
|
||||
} else {
|
||||
d.get_field("result").set_value($('<a class="btn btn-default btn-sm">'
|
||||
+__("Variant Not Found - Create New"+'</a>')).on("click", function() {
|
||||
d.hide();
|
||||
frappe.call({
|
||||
method:"erpnext.stock.doctype.item.item.create_variant",
|
||||
args: {
|
||||
"item": cur_frm.doc.name,
|
||||
"param": d.get_values()
|
||||
},
|
||||
callback: function(r) {
|
||||
var doclist = frappe.model.sync(r.message);
|
||||
frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
|
||||
}
|
||||
});
|
||||
}));
|
||||
d.hide();
|
||||
frappe.call({
|
||||
method:"erpnext.stock.doctype.item.item.create_variant",
|
||||
args: {
|
||||
"item": cur_frm.doc.name,
|
||||
"param": d.get_values()
|
||||
},
|
||||
callback: function(r) {
|
||||
var doclist = frappe.model.sync(r.message);
|
||||
frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -280,7 +289,6 @@ $.extend(erpnext.item, {
|
||||
fields: ["attribute_value"]
|
||||
},
|
||||
callback: function(r) {
|
||||
d.get_field("result").set_value("")
|
||||
if (r.message) {
|
||||
response($.map(r.message, function(d) { return d.attribute_value; }));
|
||||
}
|
||||
@@ -299,6 +307,10 @@ $.extend(erpnext.item, {
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
},
|
||||
toggle_attributes: function(frm) {
|
||||
frm.toggle_display("attributes", frm.doc.has_variants || frm.doc.variant_of);
|
||||
frm.fields_dict.attributes.grid.toggle_reqd("attribute_value", frm.doc.variant_of ? 1 : 0);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -819,32 +819,10 @@
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"depends_on": "has_variants",
|
||||
"fieldname": "valid_attributes",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Valid Attributes",
|
||||
"no_copy": 0,
|
||||
"options": "Item Template Attribute",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"depends_on": "variant_of",
|
||||
"depends_on": "",
|
||||
"fieldname": "attributes",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
@@ -854,7 +832,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 1,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
@@ -1951,7 +1929,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 1,
|
||||
"modified": "2015-08-04 07:04:46.573200",
|
||||
"modified": "2015-08-12 10:28:54.242793",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Item",
|
||||
|
||||
@@ -10,7 +10,6 @@ from frappe.website.website_generator import WebsiteGenerator
|
||||
from erpnext.setup.doctype.item_group.item_group import invalidate_cache_for, get_parent_item_groups
|
||||
from frappe.website.render import clear_cache
|
||||
from frappe.website.doctype.website_slideshow.website_slideshow import get_slideshow
|
||||
from erpnext.stock.doctype.manage_variants.manage_variants import update_variant
|
||||
|
||||
class WarehouseNotSet(frappe.ValidationError): pass
|
||||
class ItemTemplateCannotHaveStock(frappe.ValidationError): pass
|
||||
@@ -301,7 +300,9 @@ class Item(WebsiteGenerator):
|
||||
updated = []
|
||||
variants = frappe.db.get_all("Item", fields=["item_code"], filters={"variant_of": self.name })
|
||||
for d in variants:
|
||||
update_variant(self.name, d)
|
||||
variant = frappe.get_doc("Item", d)
|
||||
copy_attributes_to_variant(self, variant)
|
||||
variant.save()
|
||||
updated.append(d.item_code)
|
||||
if updated:
|
||||
frappe.msgprint(_("Item Variants {0} updated").format(", ".join(updated)))
|
||||
@@ -333,7 +334,9 @@ class Item(WebsiteGenerator):
|
||||
def validate_template_attributes(self):
|
||||
if self.has_variants:
|
||||
attributes = []
|
||||
for d in self.valid_attributes:
|
||||
if not self.attributes:
|
||||
frappe.throw(_("Attribute is mandatory for Item Template"))
|
||||
for d in self.attributes:
|
||||
if d.attribute in attributes:
|
||||
frappe.throw(_("Attribute {0} selected multiple times in Attributes Table".format(d.attribute)))
|
||||
else:
|
||||
@@ -343,6 +346,8 @@ class Item(WebsiteGenerator):
|
||||
if self.variant_of:
|
||||
args = {}
|
||||
for d in self.attributes:
|
||||
if not d.attribute_value:
|
||||
frappe.throw(_("Please specify Attribute Value for attribute {0}").format(d.attribute))
|
||||
args[d.attribute] = d.attribute_value
|
||||
|
||||
variant = get_variant(self.variant_of, args)
|
||||
@@ -495,7 +500,7 @@ def get_variant(item, args):
|
||||
|
||||
for d in args:
|
||||
if d in numeric_attributes:
|
||||
values = frappe.db.sql("""select from_range, to_range, increment from `tabItem Template Attribute` \
|
||||
values = frappe.db.sql("""select from_range, to_range, increment from `tabVariant Attribute` \
|
||||
where parent = %s and attribute = %s""", (item, d), as_dict=1)[0]
|
||||
|
||||
if (not values.from_range < cint(args[d]) < values.to_range) or ((cint(args[d]) - values.from_range) % values.increment != 0):
|
||||
@@ -525,10 +530,8 @@ def get_variant(item, args):
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_variant(item, param):
|
||||
from erpnext.stock.doctype.manage_variants.manage_variants import copy_attributes_to_variant
|
||||
args = json.loads(param)
|
||||
variant = frappe.new_doc("Item")
|
||||
variant.item_code = item
|
||||
variant_attributes = []
|
||||
for d in args:
|
||||
variant_attributes.append({
|
||||
@@ -538,3 +541,18 @@ def create_variant(item, param):
|
||||
variant.set("attributes", variant_attributes)
|
||||
copy_attributes_to_variant(item, variant)
|
||||
return variant
|
||||
|
||||
def copy_attributes_to_variant(item, variant):
|
||||
from frappe.model import no_value_fields
|
||||
for field in item.meta.fields:
|
||||
if field.fieldtype not in no_value_fields and (not field.no_copy)\
|
||||
and field.fieldname not in ("item_code", "item_name"):
|
||||
if variant.get(field.fieldname) != item.get(field.fieldname):
|
||||
variant.set(field.fieldname, item.get(field.fieldname))
|
||||
variant.variant_of = item.name
|
||||
variant.has_variants = 0
|
||||
variant.show_in_website = 0
|
||||
if variant.attributes:
|
||||
variant.description += "\n"
|
||||
for d in variant.attributes:
|
||||
variant.description += "<p>" + d.attribute + ": " + cstr(d.attribute_value) + "</p>"
|
||||
|
||||
@@ -29,48 +29,6 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"default": "1",
|
||||
"depends_on": "eval: doc.numeric_values==0",
|
||||
"description": "Lower the number, higher the priority in the Item Code suffix that will be created for this Item Attribute for the Item Variant",
|
||||
"fieldname": "priority",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Priority",
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"default": "0",
|
||||
@@ -95,7 +53,7 @@
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"depends_on": "numeric_values",
|
||||
"fieldname": "section_break_5",
|
||||
"fieldname": "section_break_4",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
@@ -114,6 +72,7 @@
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"depends_on": "",
|
||||
"fieldname": "from_range",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
@@ -134,6 +93,7 @@
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"depends_on": "",
|
||||
"fieldname": "increment",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
@@ -173,6 +133,7 @@
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"depends_on": "",
|
||||
"fieldname": "to_range",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
@@ -193,8 +154,8 @@
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"depends_on": "eval: doc.numeric_values==0",
|
||||
"fieldname": "section_break_10",
|
||||
"depends_on": "eval: !doc.numeric_values",
|
||||
"fieldname": "section_break_5",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
@@ -213,6 +174,7 @@
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"depends_on": "",
|
||||
"fieldname": "item_attribute_values",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
@@ -241,7 +203,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-05 05:27:55.912105",
|
||||
"modified": "2015-08-11 08:43:10.240847",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Item Attribute",
|
||||
|
||||
@@ -1,192 +0,0 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 0,
|
||||
"autoname": "",
|
||||
"creation": "2015-07-31 02:14:41.660844",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Other",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "attribute",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Attribute",
|
||||
"no_copy": 0,
|
||||
"options": "Item Attribute",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "column_break_2",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "numeric_values",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Numeric Values",
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"depends_on": "numeric_values",
|
||||
"fieldname": "section_break_4",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "from_range",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "From Range",
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "increment",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Increment",
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "column_break_7",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "to_range",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "To Range",
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "",
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2015-08-05 07:50:03.836731",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Item Template Attribute",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC"
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class ItemTemplateAttribute(Document):
|
||||
pass
|
||||
@@ -1,60 +0,0 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.ui.form.on("Manage Variants", {
|
||||
onload: function(frm) {
|
||||
var df = frappe.meta.get_docfield("Variant Attribute", "attribute_value", "Manage Variants");
|
||||
df.on_make = function(field) {
|
||||
$(field.input_area).addClass("ui-front");
|
||||
field.$input.autocomplete({
|
||||
minLength: 0,
|
||||
minChars: 0,
|
||||
source: function(request, response) {
|
||||
frappe.call({
|
||||
method:"frappe.client.get_list",
|
||||
args:{
|
||||
doctype:"Item Attribute Value",
|
||||
filters: [
|
||||
["parent","=", field.doc.attribute],
|
||||
["attribute_value", "like", request.term + "%"]
|
||||
],
|
||||
fields: ["attribute_value"]
|
||||
},
|
||||
callback: function(r) {
|
||||
response($.map(r.message, function(d) { return d.attribute_value; }));
|
||||
}
|
||||
});
|
||||
},
|
||||
select: function(event, ui) {
|
||||
field.$input.val(ui.item.value);
|
||||
field.$input.trigger("change");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
refresh: function(frm) {
|
||||
frm.disable_save();
|
||||
frm.page.set_primary_action(__("Create Variants"), function() {
|
||||
frappe.call({
|
||||
method: "create_variants",
|
||||
doc:frm.doc
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
onload_post_render: function(frm) {
|
||||
frm.get_field("variants").grid.cannot_add_rows = true;
|
||||
},
|
||||
|
||||
item_code:function(frm) {
|
||||
return frappe.call({
|
||||
method: "get_item_details",
|
||||
doc:frm.doc,
|
||||
callback: function(r) {
|
||||
refresh_field('attributes');
|
||||
refresh_field('variants');
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
@@ -1,103 +0,0 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"creation": "2015-05-19 05:39:59.345901",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Link",
|
||||
"label": "Item Code",
|
||||
"options": "Item",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_2",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Item Variant Attributes",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "attributes",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Attributes",
|
||||
"no_copy": 0,
|
||||
"options": "Variant Attribute",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "generate_combinations",
|
||||
"fieldtype": "Button",
|
||||
"label": "Generate Combinations",
|
||||
"options": "generate_combinations",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_4",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Item Variants",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"fieldname": "variants",
|
||||
"fieldtype": "Table",
|
||||
"label": "Variants",
|
||||
"options": "Manage Variants Item",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"in_create": 1,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-13 05:28:29.057918",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Manage Variants",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "Item Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"read_only": 1,
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC"
|
||||
}
|
||||
@@ -1,222 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import cstr, flt
|
||||
import copy
|
||||
import json
|
||||
|
||||
class DuplicateAttribute(frappe.ValidationError): pass
|
||||
|
||||
class ManageVariants(Document):
|
||||
|
||||
def get_item_details(self):
|
||||
self.clear_tables()
|
||||
if self.item_code:
|
||||
self.get_attributes()
|
||||
self.get_variants()
|
||||
|
||||
def generate_combinations(self):
|
||||
self.validate_attributes()
|
||||
self.validate_template_item()
|
||||
self.validate_attribute_values()
|
||||
self.validate_attributes_are_unique()
|
||||
self.get_variant_item_codes()
|
||||
|
||||
def create_variants(self):
|
||||
self.sync_variants()
|
||||
|
||||
def clear_tables(self):
|
||||
self.set('attributes', [])
|
||||
self.set('variants', [])
|
||||
|
||||
def get_attributes(self):
|
||||
attributes = {}
|
||||
self.set('attributes', [])
|
||||
for d in frappe.db.sql("""select attr.attribute, attr.attribute_value from `tabVariant Attribute` as attr,
|
||||
`tabItem` as item where attr.parent = item.name and item.variant_of = %s""", self.item_code, as_dict=1):
|
||||
attributes.setdefault(d.attribute, []).append(d.attribute_value)
|
||||
for d in attributes:
|
||||
attribute_values = set(attributes[d])
|
||||
for value in attribute_values:
|
||||
self.append('attributes',{"attribute": d, "attribute_value": value})
|
||||
|
||||
def get_variants(self):
|
||||
variants = [d.name for d in frappe.get_all("Item",
|
||||
filters={"variant_of":self.item_code})]
|
||||
data = frappe.db.sql("""select parent, attribute, attribute_value from `tabVariant Attribute`""", as_dict=1)
|
||||
for d in variants:
|
||||
variant_attributes, attributes = "", []
|
||||
for attribute in data:
|
||||
if attribute.parent == d:
|
||||
variant_attributes += attribute.attribute_value + " | "
|
||||
attributes.append([attribute.attribute, attribute.attribute_value])
|
||||
self.append('variants',{"variant": d, "variant_attributes": variant_attributes[: -3], "attributes": json.dumps(attributes)})
|
||||
|
||||
def validate_attributes(self):
|
||||
if not self.attributes:
|
||||
frappe.throw(_("Enter atleast one Attribute & its Value in Attribute table."))
|
||||
|
||||
def validate_template_item(self):
|
||||
if not frappe.db.get_value("Item", self.item_code, "has_variants"):
|
||||
frappe.throw(_("Selected Item cannot have Variants."))
|
||||
|
||||
if frappe.db.get_value("Item", self.item_code, "variant_of"):
|
||||
frappe.throw(_("Item cannot be a variant of a variant"))
|
||||
|
||||
def validate_attribute_values(self):
|
||||
attributes = {}
|
||||
numeric_attributes = []
|
||||
for t in frappe.db.get_all("Item Attribute Value", fields=["parent", "attribute_value"]):
|
||||
attributes.setdefault(t.parent, []).append(t.attribute_value)
|
||||
|
||||
for t in frappe.get_list("Item Attribute", filters={"numeric_values":1}):
|
||||
numeric_attributes.append(t.name)
|
||||
|
||||
for d in self.attributes:
|
||||
if d.attribute in numeric_attributes:
|
||||
values = frappe.db.sql("""select from_range, to_range, increment from `tabItem Template Attribute` \
|
||||
where parent = %s and attribute = %s""", (self.item_code, d.attribute), as_dict=1)[0]
|
||||
|
||||
if (not values.from_range < flt(d.attribute_value) < values.to_range) \
|
||||
or ((flt(d.attribute_value) - values.from_range) % values.increment != 0):
|
||||
frappe.throw(_("Attribute value {0} for attribute {1} must be within range of {2} to {3} and in increments of {4}")
|
||||
.format(d.attribute_value, d.attribute, values.from_range, values.to_range, values.increment))
|
||||
else:
|
||||
if d.attribute_value not in attributes.get(d.attribute):
|
||||
frappe.throw(_("Attribute value {0} for attribute {1} does not exist \
|
||||
in Item Attribute Master.").format(d.attribute_value, d.attribute))
|
||||
|
||||
def validate_attributes_are_unique(self):
|
||||
attributes = []
|
||||
for d in self.attributes:
|
||||
key = (d.attribute, d.attribute_value)
|
||||
if key in attributes:
|
||||
frappe.throw(_("{0} {1} is entered more than once in Attributes table")
|
||||
.format(d.attribute, d.attribute_value), DuplicateAttribute)
|
||||
attributes.append(key)
|
||||
|
||||
def get_variant_item_codes(self):
|
||||
"""Get all possible suffixes for variants"""
|
||||
variant_dict = {}
|
||||
self.set('variants', [])
|
||||
|
||||
for d in self.attributes:
|
||||
variant_dict.setdefault(d.attribute, []).append(d.attribute_value)
|
||||
|
||||
all_attributes = [d.name for d in frappe.get_all("Item Attribute", order_by = "priority asc")]
|
||||
|
||||
# sort attributes by their priority
|
||||
attributes = filter(None, map(lambda d: d if d in variant_dict else None, all_attributes))
|
||||
|
||||
def add_attribute_suffixes(item_code, my_attributes, attributes):
|
||||
attr = frappe.get_doc("Item Attribute", attributes[0])
|
||||
for value in attr.item_attribute_values:
|
||||
if value.attribute_value in variant_dict[attr.name]:
|
||||
_my_attributes = copy.deepcopy(my_attributes)
|
||||
_my_attributes.append([attr.name, value.attribute_value])
|
||||
if len(attributes) > 1:
|
||||
add_attribute_suffixes(item_code + "-" + value.abbr, _my_attributes, attributes[1:])
|
||||
else:
|
||||
variant_attributes = ""
|
||||
for d in _my_attributes:
|
||||
variant_attributes += d[1] + " | "
|
||||
self.append('variants', {"variant": item_code + "-" + value.abbr,
|
||||
"attributes": json.dumps(_my_attributes), "variant_attributes": variant_attributes[: -3]})
|
||||
add_attribute_suffixes(self.item_code, [], attributes)
|
||||
|
||||
def sync_variants(self):
|
||||
variant_item_codes = []
|
||||
item_variants_attributes = {}
|
||||
inserted, updated, old_variant_name, new_variant_name, deleted = [], [], [], [], []
|
||||
|
||||
for v in self.variants:
|
||||
variant_item_codes.append(v.variant)
|
||||
|
||||
existing_variants = [d.name for d in frappe.get_all("Item",
|
||||
filters={"variant_of":self.item_code})]
|
||||
|
||||
for d in existing_variants:
|
||||
attributes = []
|
||||
for attribute in frappe.db.sql("""select attribute, attribute_value from `tabVariant Attribute` where parent = %s""", d):
|
||||
attributes.append([attribute[0], attribute[1]])
|
||||
item_variants_attributes.setdefault(d, []).append(attributes)
|
||||
|
||||
for existing_variant in existing_variants:
|
||||
if existing_variant not in variant_item_codes:
|
||||
att = item_variants_attributes[existing_variant][0]
|
||||
for variant in self.variants:
|
||||
if sorted(json.loads(variant.attributes) ,key=lambda x: x[0]) == \
|
||||
sorted(att ,key=lambda x: x[0]):
|
||||
rename_variant(existing_variant, variant.variant)
|
||||
old_variant_name.append(existing_variant)
|
||||
new_variant_name.append(variant.variant)
|
||||
|
||||
if existing_variant not in old_variant_name:
|
||||
delete_variant(existing_variant)
|
||||
deleted.append(existing_variant)
|
||||
|
||||
for item_code in variant_item_codes:
|
||||
if item_code not in existing_variants:
|
||||
if item_code not in new_variant_name:
|
||||
make_variant(self.item_code, item_code, self.variants)
|
||||
inserted.append(item_code)
|
||||
else:
|
||||
update_variant(self.item_code, item_code, self.variants)
|
||||
updated.append(item_code)
|
||||
|
||||
if inserted:
|
||||
frappe.msgprint(_("Item Variants {0} created").format(", ".join(inserted)))
|
||||
|
||||
if updated:
|
||||
frappe.msgprint(_("Item Variants {0} updated").format(", ".join(updated)))
|
||||
|
||||
if old_variant_name:
|
||||
frappe.msgprint(_("Item Variants {0} renamed").format(", ".join(old_variant_name)))
|
||||
|
||||
if deleted:
|
||||
frappe.msgprint(_("Item Variants {0} deleted").format(", ".join(deleted)))
|
||||
|
||||
def make_variant(item, variant_code, variant_attribute):
|
||||
variant = frappe.new_doc("Item")
|
||||
variant.item_code = variant_code
|
||||
copy_attributes_to_variant(item, variant, variant_attribute, insert=True)
|
||||
variant.insert()
|
||||
|
||||
def update_variant(item, variant_code, variant_attribute=None):
|
||||
variant = frappe.get_doc("Item", variant_code)
|
||||
copy_attributes_to_variant(item, variant, variant_attribute, insert=True)
|
||||
variant.save()
|
||||
|
||||
def rename_variant(old_variant_code, new_variant_code):
|
||||
frappe.rename_doc("Item", old_variant_code, new_variant_code)
|
||||
|
||||
def delete_variant(variant_code):
|
||||
frappe.delete_doc("Item", variant_code)
|
||||
|
||||
def copy_attributes_to_variant(item, variant, variant_attribute=None, insert=False):
|
||||
template = frappe.get_doc("Item", item)
|
||||
from frappe.model import no_value_fields
|
||||
for field in template.meta.fields:
|
||||
if field.fieldtype not in no_value_fields and (insert or not field.no_copy)\
|
||||
and field.fieldname not in ("item_code", "item_name"):
|
||||
if variant.get(field.fieldname) != template.get(field.fieldname):
|
||||
variant.set(field.fieldname, template.get(field.fieldname))
|
||||
variant.item_name = template.item_name + variant.item_code[len(template.name):]
|
||||
variant.variant_of = template.name
|
||||
variant.has_variants = 0
|
||||
variant.show_in_website = 0
|
||||
if variant_attribute:
|
||||
for d in variant_attribute:
|
||||
if d.variant == variant.item_code:
|
||||
variant.attributes= []
|
||||
for a in json.loads(d.attributes):
|
||||
variant.append('attributes', {"attribute": a[0], "attribute_value": a[1]})
|
||||
if variant.attributes:
|
||||
variant.description += "\n"
|
||||
for d in variant.attributes:
|
||||
variant.description += "<p>" + d.attribute + ": " + cstr(d.attribute_value) + "</p>"
|
||||
@@ -1,49 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
import frappe
|
||||
|
||||
from erpnext.stock.doctype.manage_variants.manage_variants import DuplicateAttribute
|
||||
|
||||
class TestManageVariants(unittest.TestCase):
|
||||
def test_variant_item_codes(self):
|
||||
manage_variant = frappe.new_doc("Manage Variants")
|
||||
manage_variant.update({
|
||||
"item_code": "_Test Variant Item",
|
||||
"attributes": [
|
||||
{
|
||||
"attribute": "Test Size",
|
||||
"attribute_value": "Small"
|
||||
},
|
||||
{
|
||||
"attribute": "Test Size",
|
||||
"attribute_value": "Large"
|
||||
}
|
||||
]
|
||||
})
|
||||
manage_variant.generate_combinations()
|
||||
self.assertEqual(manage_variant.variants[0].variant, "_Test Variant Item-S")
|
||||
self.assertEqual(manage_variant.variants[1].variant, "_Test Variant Item-L")
|
||||
|
||||
self.assertEqual(manage_variant.variants[0].variant_attributes, "Small")
|
||||
self.assertEqual(manage_variant.variants[1].variant_attributes, "Large")
|
||||
manage_variant.create_variants()
|
||||
|
||||
def test_attributes_are_unique(self):
|
||||
manage_variant = frappe.new_doc("Manage Variants")
|
||||
manage_variant.update({
|
||||
"item_code": "_Test Variant Item",
|
||||
"attributes": [
|
||||
{
|
||||
"attribute": "Test Size",
|
||||
"attribute_value": "Small"
|
||||
},
|
||||
{
|
||||
"attribute": "Test Size",
|
||||
"attribute_value": "Small"
|
||||
}
|
||||
]
|
||||
})
|
||||
self.assertRaises(DuplicateAttribute, manage_variant.generate_combinations)
|
||||
@@ -1,76 +0,0 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 0,
|
||||
"autoname": "",
|
||||
"creation": "2015-05-19 05:55:31.155672",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Other",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "variant",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Variant",
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_2",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"fieldname": "variant_attributes",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Variant Attributes",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "attributes",
|
||||
"fieldtype": "Text",
|
||||
"hidden": 1,
|
||||
"label": "attributes",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "",
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2015-06-30 03:19:07.548196",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Manage Variants Item",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC"
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class ManageVariantsItem(Document):
|
||||
pass
|
||||
@@ -1178,7 +1178,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2015-08-07 12:28:35.832492",
|
||||
"modified": "2015-08-12 08:51:07.002600",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Stock Entry",
|
||||
|
||||
@@ -68,22 +68,6 @@ class TestStockEntry(unittest.TestCase):
|
||||
def test_auto_material_request(self):
|
||||
self._test_auto_material_request("_Test Item")
|
||||
|
||||
def test_auto_material_request_for_variant(self):
|
||||
manage_variant = frappe.new_doc("Manage Variants")
|
||||
|
||||
manage_variant.update({
|
||||
"item_code": "_Test Variant Item",
|
||||
"attributes": [
|
||||
{
|
||||
"attribute": "Test Size",
|
||||
"attribute_value": "Small"
|
||||
}
|
||||
]
|
||||
})
|
||||
manage_variant.generate_combinations()
|
||||
manage_variant.create_variants()
|
||||
self._test_auto_material_request("_Test Variant Item-S")
|
||||
|
||||
def _test_auto_material_request(self, item_code):
|
||||
item = frappe.get_doc("Item", item_code)
|
||||
|
||||
|
||||
@@ -828,7 +828,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2015-08-07 13:21:23.840052",
|
||||
"modified": "2015-08-12 08:51:15.789056",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Stock Entry Detail",
|
||||
|
||||
@@ -311,7 +311,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-03 13:00:36.082986",
|
||||
"modified": "2015-08-12 08:51:24.798096",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Stock Settings",
|
||||
|
||||
@@ -1,78 +1,168 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"creation": "2013-01-10 16:34:30",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Item",
|
||||
"no_copy": 0,
|
||||
"options": "Item",
|
||||
"permlevel": 0
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "current_stock_uom",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Current Stock UOM",
|
||||
"no_copy": 0,
|
||||
"options": "UOM",
|
||||
"permlevel": 0,
|
||||
"read_only": 1
|
||||
"print_hide": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "new_stock_uom",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "New Stock UOM",
|
||||
"no_copy": 0,
|
||||
"options": "UOM",
|
||||
"permlevel": 0
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "conversion_factor",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Conversion Factor",
|
||||
"permlevel": 0
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "update",
|
||||
"fieldtype": "Button",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Update",
|
||||
"no_copy": 0,
|
||||
"options": "update_stock_uom",
|
||||
"permlevel": 0
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "icon-magic",
|
||||
"idx": 1,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 1,
|
||||
"modified": "2015-07-13 05:28:25.689187",
|
||||
"istable": 0,
|
||||
"modified": "2015-08-12 08:52:09.322664",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Stock UOM Replace Utility",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "Item Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "Stock Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"read_only": 0
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0
|
||||
}
|
||||
@@ -27,19 +27,34 @@
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_2",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "column_break_2",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"depends_on": "",
|
||||
"fieldname": "attribute_value",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
@@ -51,9 +66,133 @@
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"depends_on": "has_variants",
|
||||
"fieldname": "numeric_values",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Numeric Values",
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"depends_on": "numeric_values",
|
||||
"fieldname": "section_break_4",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"depends_on": "",
|
||||
"fieldname": "from_range",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "From Range",
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"depends_on": "",
|
||||
"fieldname": "increment",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Increment",
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "column_break_8",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"depends_on": "",
|
||||
"fieldname": "to_range",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "To Range",
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
@@ -64,7 +203,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2015-05-20 06:16:16.803578",
|
||||
"modified": "2015-08-12 02:47:07.959104",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Variant Attribute",
|
||||
|
||||
Reference in New Issue
Block a user