From d194e6b5cfa40187981539141cb78c28560a0f58 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 24 Jan 2012 17:08:53 +0530 Subject: [PATCH 1/5] Fix: show message if contact doesn't have email if notification control is enabled --- .../notification_control.js | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/erpnext/setup/doctype/notification_control/notification_control.js b/erpnext/setup/doctype/notification_control/notification_control.js index 13c3087fc5..2e9bb10a02 100644 --- a/erpnext/setup/doctype/notification_control/notification_control.js +++ b/erpnext/setup/doctype/notification_control/notification_control.js @@ -10,23 +10,22 @@ cur_frm.cscript.select_transaction = function(doc, dt, dn) { } cur_frm.cscript.notify = function(doc, args) { - if(validate_email(args['send_to'] || doc.contact_email || '')) { - $c_obj('Notification Control', 'get_formatted_message', { - type: args['type'], - doctype: args['doctype'], - contact_name: args['contact_name'] || doc.contact_display - }, function(r, rt) { - if(!r.exc) { - var res = JSON.parse(r.message); - var send_from = (function() { - if(user!='Administrator') { - return user; - } else { - var cp = locals['Control Panel']['Control Panel']; - return (cp.auto_email_id || 'automail@erpnext.com'); - } - })(); - if(res.send) { + $c_obj('Notification Control', 'get_formatted_message', { + type: args['type'], + doctype: args['doctype'], + contact_name: args['contact_name'] || doc.contact_display + }, function(r, rt) { + if(!r.exc) { + var res = JSON.parse(r.message); + var send_from = (function() { + if(user!='Administrator') { + return user; + } else { + return (wn.control_panel.auto_email_id || 'automail@erpnext.com'); + } + })(); + if(res.send) { + if(validate_email(args['send_to'] || doc.contact_email || '')) { var print_heading = (doc.select_print_heading || args['type']) sendmail( args['send_to'] || doc.contact_email, @@ -38,9 +37,11 @@ cur_frm.cscript.notify = function(doc, args) { ); msgprint('This ' + print_heading + ' is being sent to ' + (args['send_to'] || doc.contact_email) + '
...'); + } else { + msgprint('Invalid/Missing Email Address. ' + print_heading + ' not sent.'); } } - //console.log(JSON.parse(r.message)); - }); - } + } + //console.log(JSON.parse(r.message)); + }); } From c655e37f1a859acd549eb68434c46e11c1344b71 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 25 Jan 2012 09:58:06 +0530 Subject: [PATCH 2/5] Fixes in production and stock modules --- .../jan_mar_2012/jan_production_patches.py | 16 +++++ .../bill_of_materials/bill_of_materials.py | 2 - .../bill_of_materials/bill_of_materials.txt | 6 +- .../doctype/bom_control/bom_control.txt | 6 +- .../doctype/bom_material/bom_material.txt | 4 +- .../stock/doctype/stock_entry/stock_entry.py | 6 +- .../stock/doctype/stock_entry/stock_entry.txt | 58 ++----------------- 7 files changed, 31 insertions(+), 67 deletions(-) diff --git a/erpnext/patches/jan_mar_2012/jan_production_patches.py b/erpnext/patches/jan_mar_2012/jan_production_patches.py index 9f730c9652..8795cc3699 100644 --- a/erpnext/patches/jan_mar_2012/jan_production_patches.py +++ b/erpnext/patches/jan_mar_2012/jan_production_patches.py @@ -9,3 +9,19 @@ def execute(): reload_doc('stock', 'doctype', 'stock_entry_detail') reload_doc('stock', 'doctype', 'item_supplier') reload_doc('stock', 'doctype', 'item') + + webnotes.conn.sql(""" + UPDATE tabDocField SET fieldtype='Float' + WHERE parent='Bill Of Materials' + AND fieldname IN ('operating_cost', 'raw_material_cost', 'total_cost') + """) + + webnotes.conn.sql(""" + UPDATE tabDocField SET fieldtype='Float' + WHERE parent='BOM Material' + AND fieldname IN ('qty', 'rate', 'amount', 'qty_consumed_per_unit') + """) + + reload_doc('stock', 'doctype', 'stock_entry') + reload_doc('production', 'doctype', 'bill_of_materials') + reload_doc('production', 'doctype', 'bom_material') 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 6e99af94d7..4fec879aa6 100644 --- a/erpnext/production/doctype/bill_of_materials/bill_of_materials.py +++ b/erpnext/production/doctype/bill_of_materials/bill_of_materials.py @@ -175,7 +175,6 @@ class DocType: self.update_flat_bom_engine(is_submit = self.doc.docstatus) - def calculate_op_cost(self): @@ -371,7 +370,6 @@ class DocType: self.get_child_flat_bom_items(d.bom_no, d.qty) - def update_flat_bom_engine(self, is_submit = 0): """ Update Flat BOM, following will be correct data""" self.get_current_flat_bom_items() 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 bbb1cd9590..cc29380cb3 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': '2012-01-11 14:33:04', + 'modified': '2012-01-24 19:49:00', 'modified_by': 'Administrator', 'owner': 'Administrator' }, # These values are common for all DocType { - '_last_update': '1326272478', + '_last_update': '1326963484', 'allow_attach': 0, 'allow_copy': 0, 'allow_email': 0, @@ -36,7 +36,7 @@ 'server_code_error': ' ', 'show_in_menu': 0, 'subject': '%(item)s', - 'version': 194 + 'version': 196 }, # These values are common for all DocField diff --git a/erpnext/production/doctype/bom_control/bom_control.txt b/erpnext/production/doctype/bom_control/bom_control.txt index 6bf618c678..127d997aec 100644 --- a/erpnext/production/doctype/bom_control/bom_control.txt +++ b/erpnext/production/doctype/bom_control/bom_control.txt @@ -5,8 +5,8 @@ { 'creation': '2010-08-08 17:08:53', 'docstatus': 0, - 'modified': '2010-12-23 11:22:14', - 'modified_by': 'umair@iwebnotes.com', + 'modified': '2012-01-24 20:56:54', + 'modified_by': 'Administrator', 'owner': 'Administrator' }, @@ -20,7 +20,7 @@ 'section_style': 'Simple', 'server_code_error': ' ', 'show_in_menu': 0, - 'version': 107 + 'version': 108 }, # DocType, BOM Control diff --git a/erpnext/production/doctype/bom_material/bom_material.txt b/erpnext/production/doctype/bom_material/bom_material.txt index ff7c5901f6..ebef2b4b1f 100644 --- a/erpnext/production/doctype/bom_material/bom_material.txt +++ b/erpnext/production/doctype/bom_material/bom_material.txt @@ -5,7 +5,7 @@ { 'creation': '2010-08-08 17:08:53', 'docstatus': 0, - 'modified': '2011-12-27 14:49:54', + 'modified': '2012-01-24 19:47:34', 'modified_by': 'Administrator', 'owner': 'Administrator' }, @@ -21,7 +21,7 @@ 'section_style': 'Simple', 'server_code_error': ' ', 'show_in_menu': 0, - 'version': 26 + 'version': 27 }, # These values are common for all DocField diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index c94e71d410..ce6f7f6b59 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -107,7 +107,8 @@ class DocType: if fg_item and bom_no: # re-calculate cost for production item from bom get_obj('BOM Control').calculate_cost(bom_no) - in_rate = flt(get_value('Bill Of Materials', bom_no, 'total_cost')) + bom_obj = get_obj('Bill Of Materials', bom_no) + in_rate = flt(bom_obj.doc.total_cost) / (flt(bom_obj.doc.quantity) or 1) elif wh: in_rate = get_obj('Valuation Control').get_incoming_rate(dt, tm, item, wh, qty, serial_no) @@ -146,7 +147,6 @@ class DocType: child items of sub-contracted and sub assembly items and sub assembly items itself. """ - if pro_obj.doc.consider_sa_items == 'Yes': # Get all raw materials considering SA items as raw materials, # so no childs of SA items @@ -157,6 +157,7 @@ class DocType: group by item_code """ % ((self.doc.process == 'Backflush') and flt(self.doc.fg_completed_qty) \ or flt(pro_obj.doc.qty), cstr(pro_obj.doc.bom_no))) + self.make_items_dict(fl_bom_sa_items) else: @@ -174,7 +175,6 @@ class DocType: group by item_code,stock_uom """ , ((self.doc.process == 'Backflush') and flt(self.doc.fg_completed_qty) \ or flt(pro_obj.doc.qty), cstr(pro_obj.doc.bom_no))) - self.make_items_dict(fl_bom_sa_child_item) # Update only qty remaining to be issued for production diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.txt b/erpnext/stock/doctype/stock_entry/stock_entry.txt index 63f718bec1..395082f5d3 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.txt +++ b/erpnext/stock/doctype/stock_entry/stock_entry.txt @@ -5,14 +5,14 @@ { 'creation': '2010-08-08 17:09:25', 'docstatus': 0, - 'modified': '2011-08-22 14:36:19', + 'modified': '2012-01-24 19:47:47', 'modified_by': 'Administrator', 'owner': 'Administrator' }, # These values are common for all DocType { - '_last_update': '1311621379', + '_last_update': '1325570647', 'allow_attach': 0, 'allow_copy': 0, 'allow_email': 0, @@ -20,6 +20,7 @@ 'allow_rename': 0, 'allow_trash': 0, 'colour': 'White:FFF', + 'default_print_format': 'Standard', 'doctype': 'DocType', 'hide_heading': 0, 'hide_toolbar': 0, @@ -40,7 +41,7 @@ 'subject': '%(remarks)s', 'tag_fields': 'purpose', 'use_template': 0, - 'version': 245 + 'version': 248 }, # These values are common for all DocField @@ -74,7 +75,6 @@ 'cancel': 0, 'create': 0, 'doctype': 'DocPerm', - 'idx': 1, 'permlevel': 1, 'role': 'Material Manager', 'submit': 0, @@ -87,7 +87,6 @@ 'cancel': 0, 'create': 0, 'doctype': 'DocPerm', - 'idx': 2, 'permlevel': 1, 'role': 'Material User', 'submit': 0, @@ -100,7 +99,6 @@ 'cancel': 1, 'create': 1, 'doctype': 'DocPerm', - 'idx': 3, 'permlevel': 0, 'role': 'Production User', 'submit': 1, @@ -113,7 +111,6 @@ 'cancel': 0, 'create': 0, 'doctype': 'DocPerm', - 'idx': 4, 'permlevel': 1, 'role': 'Production User', 'submit': 0, @@ -126,7 +123,6 @@ 'cancel': 0, 'create': 0, 'doctype': 'DocPerm', - 'idx': 5, 'permlevel': 2, 'role': 'Production User', 'submit': 0, @@ -139,7 +135,6 @@ 'cancel': 1, 'create': 1, 'doctype': 'DocPerm', - 'idx': 6, 'permlevel': 0, 'role': 'Production Manager', 'submit': 1, @@ -152,7 +147,6 @@ 'cancel': 0, 'create': 0, 'doctype': 'DocPerm', - 'idx': 7, 'permlevel': 1, 'role': 'Production Manager', 'submit': 0, @@ -165,7 +159,6 @@ 'cancel': 0, 'create': 0, 'doctype': 'DocPerm', - 'idx': 8, 'permlevel': 2, 'role': 'Production Manager', 'submit': 0, @@ -176,7 +169,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 1, 'label': 'Warehouse', 'oldfieldtype': 'Section Break', 'permlevel': 0 @@ -186,7 +178,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Column Break', - 'idx': 2, 'oldfieldtype': 'Column Break', 'permlevel': 0, 'width': '50%' @@ -200,7 +191,6 @@ 'doctype': 'DocField', 'fieldname': 'naming_series', 'fieldtype': 'Select', - 'idx': 3, 'in_filter': 0, 'label': 'Series', 'no_copy': 1, @@ -221,7 +211,6 @@ 'doctype': 'DocField', 'fieldname': 'amendment_date', 'fieldtype': 'Date', - 'idx': 4, 'in_filter': 0, 'label': 'Amendment Date', 'no_copy': 1, @@ -240,7 +229,6 @@ 'doctype': 'DocField', 'fieldname': 'purpose', 'fieldtype': 'Select', - 'idx': 5, 'in_filter': 1, 'label': 'Purpose', 'no_copy': 0, @@ -262,7 +250,6 @@ 'fieldname': 'delivery_note_no', 'fieldtype': 'Link', 'hidden': 1, - 'idx': 6, 'in_filter': 0, 'label': 'Delivery Note No', 'no_copy': 0, @@ -284,7 +271,6 @@ 'fieldname': 'purchase_receipt_no', 'fieldtype': 'Link', 'hidden': 1, - 'idx': 7, 'in_filter': 0, 'label': 'Purchase Receipt No', 'no_copy': 0, @@ -304,7 +290,6 @@ 'fieldname': 'sales_invoice_no', 'fieldtype': 'Link', 'hidden': 1, - 'idx': 8, 'label': 'Sales Invoice No', 'options': 'Receivable Voucher', 'permlevel': 0, @@ -319,7 +304,6 @@ 'fieldname': 'supplier', 'fieldtype': 'Link', 'hidden': 1, - 'idx': 9, 'in_filter': 0, 'label': 'Supplier', 'no_copy': 0, @@ -339,7 +323,6 @@ 'doctype': 'DocField', 'fieldname': 'supplier_name', 'fieldtype': 'Data', - 'idx': 10, 'in_filter': 0, 'label': 'Supplier Name', 'no_copy': 0, @@ -358,7 +341,6 @@ 'fieldname': 'supplier_address', 'fieldtype': 'Small Text', 'hidden': 1, - 'idx': 11, 'in_filter': 0, 'label': 'Supplier Address', 'no_copy': 0, @@ -378,7 +360,6 @@ 'fieldname': 'customer', 'fieldtype': 'Link', 'hidden': 1, - 'idx': 12, 'in_filter': 0, 'label': 'Customer', 'no_copy': 0, @@ -399,7 +380,6 @@ 'fieldname': 'customer_name', 'fieldtype': 'Data', 'hidden': 1, - 'idx': 13, 'in_filter': 0, 'label': 'Customer Name', 'no_copy': 0, @@ -417,7 +397,6 @@ 'fieldname': 'customer_address', 'fieldtype': 'Small Text', 'hidden': 1, - 'idx': 14, 'in_filter': 0, 'label': 'Customer Address', 'no_copy': 0, @@ -436,7 +415,6 @@ 'fieldname': 'process', 'fieldtype': 'Select', 'hidden': 1, - 'idx': 15, 'in_filter': 1, 'label': 'Process', 'no_copy': 0, @@ -458,7 +436,6 @@ 'fieldname': 'production_order', 'fieldtype': 'Link', 'hidden': 1, - 'idx': 16, 'in_filter': 1, 'label': 'Production Order', 'no_copy': 0, @@ -478,7 +455,6 @@ 'doctype': 'DocField', 'fieldname': 'fg_completed_qty', 'fieldtype': 'Currency', - 'idx': 17, 'in_filter': 0, 'label': 'FG Completed Qty', 'no_copy': 0, @@ -496,7 +472,6 @@ 'colour': 'White:FFF', 'doctype': 'DocField', 'fieldtype': 'HTML', - 'idx': 18, 'label': 'Warehouse HTML', 'no_copy': 0, 'oldfieldtype': 'HTML', @@ -512,7 +487,6 @@ 'doctype': 'DocField', 'fieldname': 'from_warehouse', 'fieldtype': 'Link', - 'idx': 19, 'in_filter': 0, 'label': 'Source Warehouse', 'no_copy': 0, @@ -535,7 +509,6 @@ 'doctype': 'DocField', 'fieldname': 'to_warehouse', 'fieldtype': 'Link', - 'idx': 20, 'in_filter': 0, 'label': 'Target Warehouse', 'no_copy': 0, @@ -555,7 +528,6 @@ 'doctype': 'DocField', 'fieldname': 'project_name', 'fieldtype': 'Link', - 'idx': 21, 'in_filter': 1, 'label': 'Project Name', 'oldfieldname': 'project_name', @@ -568,7 +540,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Column Break', - 'idx': 22, 'oldfieldtype': 'Column Break', 'permlevel': 0, 'width': '50%' @@ -581,7 +552,6 @@ 'doctype': 'DocField', 'fieldname': 'transfer_date', 'fieldtype': 'Date', - 'idx': 23, 'in_filter': 1, 'label': 'Transfer Date', 'no_copy': 1, @@ -601,7 +571,6 @@ 'doctype': 'DocField', 'fieldname': 'posting_date', 'fieldtype': 'Date', - 'idx': 24, 'in_filter': 1, 'label': 'Posting Date', 'no_copy': 1, @@ -620,7 +589,6 @@ 'doctype': 'DocField', 'fieldname': 'posting_time', 'fieldtype': 'Time', - 'idx': 25, 'in_filter': 0, 'label': 'Posting Time', 'no_copy': 1, @@ -639,7 +607,6 @@ 'doctype': 'DocField', 'fieldname': 'amended_from', 'fieldtype': 'Link', - 'idx': 26, 'in_filter': 0, 'label': 'Amended From', 'no_copy': 1, @@ -658,7 +625,6 @@ 'doctype': 'DocField', 'fieldname': 'transporter', 'fieldtype': 'Data', - 'idx': 27, 'in_filter': 0, 'label': 'Transporter', 'no_copy': 0, @@ -676,7 +642,6 @@ 'doctype': 'DocField', 'fieldname': 'is_excisable_goods', 'fieldtype': 'Select', - 'idx': 28, 'in_filter': 0, 'label': 'Is Excisable Goods', 'no_copy': 0, @@ -695,7 +660,6 @@ 'doctype': 'DocField', 'fieldname': 'excisable_goods', 'fieldtype': 'Select', - 'idx': 29, 'in_filter': 0, 'label': 'Excisable Goods', 'no_copy': 0, @@ -715,7 +679,6 @@ 'fieldname': 'under_rule', 'fieldtype': 'Select', 'hidden': 1, - 'idx': 30, 'in_filter': 0, 'label': 'Under Rule', 'no_copy': 0, @@ -734,7 +697,6 @@ 'doctype': 'DocField', 'fieldname': 'remarks', 'fieldtype': 'Text', - 'idx': 31, 'in_filter': 0, 'label': 'Remarks', 'no_copy': 1, @@ -754,7 +716,6 @@ 'fieldname': 'cancel_reason', 'fieldtype': 'Data', 'hidden': 1, - 'idx': 32, 'in_filter': 0, 'label': 'Cancel Reason', 'no_copy': 1, @@ -771,7 +732,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 33, 'label': 'Items', 'oldfieldtype': 'Section Break', 'permlevel': 0 @@ -781,7 +741,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Button', - 'idx': 34, 'label': 'Get Stock and Rate', 'oldfieldtype': 'Button', 'options': 'get_stock_and_rate', @@ -793,7 +752,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Column Break', - 'idx': 35, 'oldfieldtype': 'Column Break', 'permlevel': 0 }, @@ -805,7 +763,6 @@ 'doctype': 'DocField', 'fieldtype': 'Button', 'hidden': 0, - 'idx': 36, 'in_filter': 0, 'label': 'Get Items', 'no_copy': 0, @@ -821,7 +778,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 37, 'oldfieldtype': 'Section Break', 'options': 'Simple', 'permlevel': 0 @@ -834,7 +790,6 @@ 'doctype': 'DocField', 'fieldname': 'mtn_details', 'fieldtype': 'Table', - 'idx': 38, 'in_filter': 0, 'label': 'MTN Details', 'no_copy': 0, @@ -853,7 +808,6 @@ 'doctype': 'DocField', 'fieldname': 'total_amount', 'fieldtype': 'Currency', - 'idx': 39, 'in_filter': 0, 'label': 'Total Amount', 'no_copy': 0, @@ -869,7 +823,6 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 40, 'label': 'Other Details', 'oldfieldtype': 'Section Break', 'permlevel': 0 @@ -881,7 +834,6 @@ 'doctype': 'DocField', 'fieldname': 'company', 'fieldtype': 'Link', - 'idx': 41, 'in_filter': 1, 'label': 'Company', 'no_copy': 0, @@ -901,7 +853,6 @@ 'doctype': 'DocField', 'fieldname': 'fiscal_year', 'fieldtype': 'Select', - 'idx': 42, 'in_filter': 0, 'label': 'Fiscal Year', 'no_copy': 0, @@ -921,7 +872,6 @@ 'doctype': 'DocField', 'fieldname': 'select_print_heading', 'fieldtype': 'Link', - 'idx': 43, 'in_filter': 0, 'label': 'Select Print Heading', 'no_copy': 0, From 1605c334a6ab090cfa79e37388e4ba61ae68abb1 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 25 Jan 2012 11:49:12 +0530 Subject: [PATCH 3/5] In Print Format, hide columns without any content --- index.html | 2 +- version.num | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 45a7cbed97..c6afcd1a21 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ ERPNext -