From bfcc16af170285d988d8f51261b9be1b7f28d2c8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 11 Dec 2012 15:14:30 +0530 Subject: [PATCH 1/2] rebuilt exploded bom items patch --- manufacturing/doctype/bom/bom.txt | 16 +++++----------- .../doctype/bom_replace_tool/bom_replace_tool.py | 5 ++--- patches/december_2012/production_cleanup.py | 6 +++++- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/manufacturing/doctype/bom/bom.txt b/manufacturing/doctype/bom/bom.txt index e381510898..90bcfc71b9 100644 --- a/manufacturing/doctype/bom/bom.txt +++ b/manufacturing/doctype/bom/bom.txt @@ -2,9 +2,9 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-07-03 13:30:03", + "creation": "2012-12-10 19:03:43", "modified_by": "Administrator", - "modified": "2012-12-10 18:30:00" + "modified": "2012-12-11 15:13:42" }, { "istable": 0, @@ -19,7 +19,6 @@ "hide_heading": 0, "issingle": 0, "name": "__common__", - "default_print_format": "Standard", "allow_rename": 0, "doctype": "DocType", "is_submittable": 1, @@ -178,12 +177,6 @@ "fieldtype": "Float", "permlevel": 1 }, - { - "doctype": "DocField", - "fieldname": "col_break24", - "fieldtype": "Column Break", - "permlevel": 0 - }, { "doctype": "DocField", "label": "Total Cost", @@ -223,6 +216,7 @@ "doctype": "DocField", "label": "Item Description", "oldfieldname": "description", + "width": "300px", "fieldname": "description", "fieldtype": "Small Text", "permlevel": 0 @@ -276,7 +270,7 @@ { "print_hide": 0, "doctype": "DocField", - "label": "BOM Explosion Items", + "label": "Exploded BOM Items", "options": "Simple", "fieldname": "section_break0", "fieldtype": "Section Break", @@ -289,7 +283,7 @@ "no_copy": 1, "oldfieldtype": "Table", "doctype": "DocField", - "label": "BOM Explosion Item", + "label": "Exploded BOM Items", "oldfieldname": "flat_bom_details", "default": "No Toolbar", "fieldname": "flat_bom_details", diff --git a/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py b/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py index d9d9598424..96e12d9720 100644 --- a/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py +++ b/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py @@ -31,9 +31,8 @@ class DocType: bom_list = self.get_parent_boms() for bom in bom_list: bom_obj = get_obj("BOM", bom, with_children=1) - bom_obj.update_cost_by_traversing() - bom_obj.update_flat_bom_by_traversing() - + bom_obj.on_update() + def validate_bom(self): if cstr(self.doc.current_bom) == cstr(self.doc.new_bom): msgprint("Current BOM and New BOM can not be same", raise_exception=1) diff --git a/patches/december_2012/production_cleanup.py b/patches/december_2012/production_cleanup.py index 6a17dbaeac..e4b363f66c 100644 --- a/patches/december_2012/production_cleanup.py +++ b/patches/december_2012/production_cleanup.py @@ -3,6 +3,7 @@ import webnotes def execute(): delete_doctypes() rename_module() + rebuilt_exploded_bom() def delete_doctypes(): from webnotes.model import delete_doc @@ -20,4 +21,7 @@ def rename_module(): webnotes.conn.set_global("modules_list", webnotes.conn.get_global('modules_list').replace("Production", "Manufacturing")) - \ No newline at end of file +def rebuilt_exploded_bom(): + from webnotes.model.code import get_obj + for bom in webnotes.conn.sql("""select name from `tabBOM` where docstatus < 2"""): + get_obj("BOM", bom[0], with_children=1).on_update() \ No newline at end of file From 559c16fabb6b30b2f903fc0dab2e759113f613b8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 11 Dec 2012 15:18:51 +0530 Subject: [PATCH 2/2] production cleanup patch --- patches/december_2012/production_cleanup.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/patches/december_2012/production_cleanup.py b/patches/december_2012/production_cleanup.py index 55881f2797..0c25b895ae 100644 --- a/patches/december_2012/production_cleanup.py +++ b/patches/december_2012/production_cleanup.py @@ -15,15 +15,18 @@ def rename_module(): webnotes.reload_doc("core", "doctype", "page") webnotes.reload_doc("core", "doctype", "module_def") - webnotes.rename_doc("Role", "Production User", "Manufacturing User") - webnotes.rename_doc("Role", "Production Manager", "Manufacturing Manager") + if webnotes.conn.exists("Role", "Production User"): + webnotes.rename_doc("Role", "Production User", "Manufacturing User") + if webnotes.conn.exists("Role", "Production Manager"): + webnotes.rename_doc("Role", "Production Manager", "Manufacturing Manager") if webnotes.conn.exists("Page", "manufacturing-home"): webnotes.delete_doc("Page", "production-home") else: webnotes.rename_doc("Page", "production-home", "manufacturing-home") - webnotes.rename_doc("Module Def", "Production", "Manufacturing") + if webnotes.conn.exists("Module Def", "Production"): + webnotes.rename_doc("Module Def", "Production", "Manufacturing") webnotes.conn.set_global("modules_list", webnotes.conn.get_global('modules_list').replace("Production", "Manufacturing"))