From 89d64f5b122f392020e629a4ccdc35db0601b38e Mon Sep 17 00:00:00 2001 From: Martin Ender Date: Mon, 14 Dec 2015 16:26:02 +0100 Subject: [PATCH] Update generate-code-based-on-custom-logic.md --- .../generate-code-based-on-custom-logic.md | 52 +++++++++---------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/erpnext/docs/user/manual/de/customize-erpnext/custom-scripts/custom-script-examples/generate-code-based-on-custom-logic.md b/erpnext/docs/user/manual/de/customize-erpnext/custom-scripts/custom-script-examples/generate-code-based-on-custom-logic.md index d2dd70c324..ca6a15b6f4 100644 --- a/erpnext/docs/user/manual/de/customize-erpnext/custom-scripts/custom-script-examples/generate-code-based-on-custom-logic.md +++ b/erpnext/docs/user/manual/de/customize-erpnext/custom-scripts/custom-script-examples/generate-code-based-on-custom-logic.md @@ -4,35 +4,33 @@ Fügen Sie diesen Kode so in einem benutzerdefinierten Skript eines Artikels hin (Vielen Dank an Aditya Duggal) + cur_frm.cscript.custom_validate = function(doc) { + // clear item_code (name is from item_code) + doc.item_code = ""; + // first 2 characters based on item_group + switch(doc.item_group) { + case "Test A": + doc.item_code = "TA"; + break; + case "Test B": + doc.item_code = "TB"; + break; + default: + doc.item_code = "XX"; + } -cur_frm.cscript.custom_validate = function(doc) { - // clear item_code (name is from item_code) - doc.item_code = ""; - - // first 2 characters based on item_group - switch(doc.item_group) { - case "Test A": - doc.item_code = "TA"; - break; - case "Test B": - doc.item_code = "TB"; - break; - default: - doc.item_code = "XX"; + // add next 2 characters based on brand + switch(doc.brand) { + case "Brand A": + doc.item_code += "BA"; + break; + case "Brand B": + doc.item_code += "BB"; + break; + default: + doc.item_code += "BX"; + } } - // add next 2 characters based on brand - switch(doc.brand) { - case "Brand A": - doc.item_code += "BA"; - break; - case "Brand B": - doc.item_code += "BB"; - break; - default: - doc.item_code += "BX"; - } -} - {next}