From 33e19480aeef5c57aa44c01612f26d97d1fb22a7 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 9 Nov 2011 13:53:16 +0530 Subject: [PATCH] UOM field added in BOM, will be fetched from item master --- erpnext/patches/reload_bom.py | 5 ++ .../bill_of_materials/bill_of_materials.py | 5 +- .../bill_of_materials/bill_of_materials.txt | 76 ++++++++----------- 3 files changed, 39 insertions(+), 47 deletions(-) create mode 100644 erpnext/patches/reload_bom.py diff --git a/erpnext/patches/reload_bom.py b/erpnext/patches/reload_bom.py new file mode 100644 index 00000000000..f050f3c710d --- /dev/null +++ b/erpnext/patches/reload_bom.py @@ -0,0 +1,5 @@ +def execute(): + import webnotes + from webnotes.modules.module_manager import reload_doc + + reload_doc('production', 'doctype', 'bill_of_materials') diff --git a/erpnext/production/doctype/bill_of_materials/bill_of_materials.py b/erpnext/production/doctype/bill_of_materials/bill_of_materials.py index 85db9f142be..627fc54a230 100644 --- a/erpnext/production/doctype/bill_of_materials/bill_of_materials.py +++ b/erpnext/production/doctype/bill_of_materials/bill_of_materials.py @@ -32,9 +32,10 @@ class DocType: #----------- Client Trigger function ---------- def get_item_detail(self, item_code): - item = sql("select description from `tabItem` where (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now()) and name = %s",item_code , as_dict =1) + item = sql("select description, stock_uom from `tabItem` where (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now()) and name = %s",item_code , as_dict =1) ret={ - 'description' : item and item[0]['description'] or '' + 'description' : item and item[0]['description'] or '', + 'uom' : item and item[0]['stock_uom'] or '' } return ret diff --git a/erpnext/production/doctype/bill_of_materials/bill_of_materials.txt b/erpnext/production/doctype/bill_of_materials/bill_of_materials.txt index 259081793dc..3713667fb7e 100644 --- a/erpnext/production/doctype/bill_of_materials/bill_of_materials.txt +++ b/erpnext/production/doctype/bill_of_materials/bill_of_materials.txt @@ -5,14 +5,14 @@ { 'creation': '2010-08-08 17:08:52', 'docstatus': 0, - 'modified': '2010-12-20 17:27:58', - 'modified_by': 'umair@iwebnotes.com', + 'modified': '2011-11-09 12:47:50', + 'modified_by': 'Administrator', 'owner': 'Administrator' }, # These values are common for all DocType { - '_last_update': '1309508837', + '_last_update': '1319016431', 'allow_attach': 0, 'allow_copy': 0, 'allow_email': 0, @@ -20,6 +20,7 @@ 'allow_rename': 0, 'allow_trash': 1, 'colour': 'White:FFF', + 'default_print_format': 'Standard', 'doctype': 'DocType', 'document_type': 'Master', 'hide_heading': 0, @@ -35,7 +36,7 @@ 'server_code_error': ' ', 'show_in_menu': 0, 'subject': '%(item)s', - 'version': 170 + 'version': 171 }, # These values are common for all DocField @@ -49,6 +50,7 @@ # These values are common for all DocPerm { + 'amend': 0, 'doctype': 'DocPerm', 'name': '__common__', 'parent': 'Bill Of Materials', @@ -68,7 +70,6 @@ 'cancel': 1, 'create': 1, 'doctype': 'DocPerm', - 'idx': 1, 'permlevel': 0, 'role': 'System Manager', 'submit': 1, @@ -77,10 +78,13 @@ # DocPerm { + 'cancel': 0, + 'create': 0, 'doctype': 'DocPerm', - 'idx': 2, 'permlevel': 1, - 'role': 'System Manager' + 'role': 'System Manager', + 'submit': 0, + 'write': 0 }, # DocPerm @@ -88,7 +92,6 @@ 'cancel': 1, 'create': 1, 'doctype': 'DocPerm', - 'idx': 3, 'permlevel': 0, 'role': 'Production Manager', 'submit': 1, @@ -97,10 +100,13 @@ # DocPerm { + 'cancel': 0, + 'create': 0, 'doctype': 'DocPerm', - 'idx': 4, 'permlevel': 1, - 'role': 'Production Manager' + 'role': 'Production Manager', + 'submit': 0, + 'write': 0 }, # DocPerm @@ -108,7 +114,6 @@ 'cancel': 1, 'create': 1, 'doctype': 'DocPerm', - 'idx': 5, 'permlevel': 0, 'role': 'Production User', 'submit': 1, @@ -117,10 +122,13 @@ # DocPerm { + 'cancel': 0, + 'create': 0, 'doctype': 'DocPerm', - 'idx': 6, 'permlevel': 1, - 'role': 'Production User' + 'role': 'Production User', + 'submit': 0, + 'write': 0 }, # DocField @@ -128,7 +136,6 @@ 'doctype': 'DocField', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', - 'idx': 1, 'label': 'Trash Reason', 'oldfieldname': 'trash_reason', 'oldfieldtype': 'Small Text', @@ -139,7 +146,6 @@ { 'doctype': 'DocField', 'fieldtype': 'HTML', - 'idx': 2, 'label': 'TreeView1', 'oldfieldtype': 'HTML', 'options': '
', @@ -150,7 +156,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 3, 'oldfieldtype': 'Section Break', 'options': 'Simple', 'permlevel': 0 @@ -162,7 +167,6 @@ 'colour': 'White:FFF', 'doctype': 'DocField', 'fieldtype': 'Button', - 'idx': 4, 'label': 'Set as Default BOM', 'oldfieldtype': 'Button', 'permlevel': 0, @@ -173,7 +177,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Column Break', - 'idx': 5, 'oldfieldtype': 'Column Break', 'permlevel': 0 }, @@ -185,7 +188,6 @@ 'doctype': 'DocField', 'fieldtype': 'Button', 'hidden': 1, - 'idx': 6, 'label': 'Activate BOM', 'oldfieldtype': 'Button', 'permlevel': 0, @@ -199,7 +201,6 @@ 'doctype': 'DocField', 'fieldtype': 'Button', 'hidden': 1, - 'idx': 7, 'label': 'Inactivate BOM', 'oldfieldtype': 'Button', 'permlevel': 0, @@ -210,7 +211,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 8, 'label': 'Details', 'oldfieldtype': 'Section Break', 'permlevel': 0 @@ -223,7 +223,6 @@ 'doctype': 'DocField', 'fieldname': 'item', 'fieldtype': 'Link', - 'idx': 9, 'in_filter': 1, 'label': 'Item', 'oldfieldname': 'item', @@ -240,7 +239,6 @@ 'doctype': 'DocField', 'fieldname': 'description', 'fieldtype': 'Text', - 'idx': 10, 'label': 'Description', 'oldfieldname': 'description', 'oldfieldtype': 'Text', @@ -255,7 +253,6 @@ 'doctype': 'DocField', 'fieldname': 'quantity', 'fieldtype': 'Currency', - 'idx': 11, 'label': 'Quantity', 'oldfieldname': 'quantity', 'oldfieldtype': 'Currency', @@ -263,13 +260,22 @@ 'reqd': 1 }, + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'uom', + 'fieldtype': 'Select', + 'label': 'UOM', + 'options': 'link:UOM', + 'permlevel': 1 + }, + # DocField { 'colour': 'White:FFF', 'doctype': 'DocField', 'fieldname': 'is_active', 'fieldtype': 'Select', - 'idx': 12, 'label': 'Is Active', 'no_copy': 1, 'oldfieldname': 'is_active', @@ -285,7 +291,6 @@ 'doctype': 'DocField', 'fieldname': 'is_default', 'fieldtype': 'Check', - 'idx': 13, 'label': 'Is Default', 'no_copy': 1, 'oldfieldname': 'is_default', @@ -299,7 +304,6 @@ 'doctype': 'DocField', 'fieldname': 'project_name', 'fieldtype': 'Link', - 'idx': 14, 'in_filter': 1, 'label': 'Project Name', 'oldfieldname': 'project_name', @@ -313,7 +317,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 15, 'label': 'Operations', 'oldfieldtype': 'Section Break', 'permlevel': 0 @@ -326,7 +329,6 @@ 'doctype': 'DocField', 'fieldname': 'bom_operations', 'fieldtype': 'Table', - 'idx': 16, 'label': 'BOM Operations', 'oldfieldname': 'bom_operations', 'oldfieldtype': 'Table', @@ -338,7 +340,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 17, 'label': 'Materials', 'oldfieldtype': 'Section Break', 'permlevel': 0 @@ -351,7 +352,6 @@ 'doctype': 'DocField', 'fieldname': 'bom_materials', 'fieldtype': 'Table', - 'idx': 18, 'label': 'BOM Material', 'oldfieldname': 'bom_materials', 'oldfieldtype': 'Table', @@ -363,7 +363,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 19, 'label': 'Costing', 'oldfieldtype': 'Section Break', 'permlevel': 0 @@ -375,7 +374,6 @@ 'doctype': 'DocField', 'fieldname': 'remarks', 'fieldtype': 'Text', - 'idx': 20, 'label': 'Remarks', 'no_copy': 1, 'oldfieldname': 'remarks', @@ -388,7 +386,6 @@ 'doctype': 'DocField', 'fieldname': 'cost_as_per_mar', 'fieldtype': 'Currency', - 'idx': 21, 'label': 'Cost As Per Valuation Rate', 'oldfieldname': 'cost_as_per_mar', 'oldfieldtype': 'Currency', @@ -400,7 +397,6 @@ 'doctype': 'DocField', 'fieldname': 'cost_as_per_lpr', 'fieldtype': 'Currency', - 'idx': 22, 'label': 'Cost As Per LPR', 'oldfieldname': 'cost_as_per_lpr', 'oldfieldtype': 'Currency', @@ -412,7 +408,6 @@ 'doctype': 'DocField', 'fieldname': 'cost_as_per_sr', 'fieldtype': 'Currency', - 'idx': 23, 'label': 'Cost As Per SR', 'oldfieldname': 'cost_as_per_sr', 'oldfieldtype': 'Currency', @@ -425,7 +420,6 @@ 'doctype': 'DocField', 'fieldname': 'cost_as_on', 'fieldtype': 'Data', - 'idx': 24, 'label': 'Cost as on', 'oldfieldname': 'cost_as_on', 'oldfieldtype': 'Data', @@ -437,7 +431,6 @@ 'doctype': 'DocField', 'fieldname': 'dir_mat_as_per_mar', 'fieldtype': 'Currency', - 'idx': 25, 'label': 'Direct Material As Per Valuation', 'oldfieldname': 'dir_mat_as_per_mar', 'oldfieldtype': 'Currency', @@ -449,7 +442,6 @@ 'doctype': 'DocField', 'fieldname': 'dir_mat_as_per_lpr', 'fieldtype': 'Currency', - 'idx': 26, 'label': 'Direct Material As Per LPR', 'oldfieldname': 'dir_mat_as_per_lpr', 'oldfieldtype': 'Currency', @@ -461,7 +453,6 @@ 'doctype': 'DocField', 'fieldname': 'dir_mat_as_per_sr', 'fieldtype': 'Currency', - 'idx': 27, 'label': 'Direct Material As Per SR', 'oldfieldname': 'dir_mat_as_per_sr', 'oldfieldtype': 'Currency', @@ -473,7 +464,6 @@ 'doctype': 'DocField', 'fieldname': 'operating_cost', 'fieldtype': 'Currency', - 'idx': 28, 'label': 'Operating Cost', 'oldfieldname': 'operating_cost', 'oldfieldtype': 'Currency', @@ -485,7 +475,6 @@ 'doctype': 'DocField', 'fieldname': 'maintained_by', 'fieldtype': 'Data', - 'idx': 29, 'label': 'Maintained By', 'oldfieldname': 'maintained_by', 'oldfieldtype': 'Data', @@ -497,7 +486,6 @@ 'doctype': 'DocField', 'fieldtype': 'Section Break', 'hidden': 1, - 'idx': 30, 'label': 'BOM Report', 'oldfieldtype': 'Section Break', 'permlevel': 0 @@ -508,7 +496,6 @@ 'doctype': 'DocField', 'fieldtype': 'Section Break', 'hidden': 0, - 'idx': 31, 'label': 'Flat BOM', 'oldfieldtype': 'Section Break', 'permlevel': 0 @@ -522,7 +509,6 @@ 'fieldname': 'flat_bom_details', 'fieldtype': 'Table', 'hidden': 0, - 'idx': 32, 'label': 'Flat BOM Detail', 'no_copy': 1, 'oldfieldname': 'flat_bom_details',