From 9e08c12a10374e4cbc9bd7c2a9a48b5a66ec2d63 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 28 Dec 2011 16:30:48 +0530 Subject: [PATCH 01/18] Default price list currency issue in delivery note fixed --- .../doctype/receivable_voucher/receivable_voucher.js | 4 ++-- erpnext/stock/doctype/delivery_note/delivery_note.js | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js index c2b478e8e2..d0d31bef25 100644 --- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js +++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js @@ -18,8 +18,8 @@ cur_frm.cscript.onload = function(doc,dt,dn) { if(!doc.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()}); if(!doc.due_date) set_multiple(dt,dn,{due_date:get_today()}); if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()}); - if(!doc.currency && sys_defaults.currency) set_multiple(cdt,cdn,{currency:sys_defaults.currency}); - if(!doc.price_list_currency) set_multiple(cdt, cdn, {price_list_currency: doc.currency, plc_conversion_rate: 1}); + if(!doc.currency && sys_defaults.currency) set_multiple(dt,dn,{currency:sys_defaults.currency}); + if(!doc.price_list_currency) set_multiple(dt, dn, {price_list_currency: doc.currency, plc_conversion_rate: 1}); //for previously created sales invoice, set required field related to pos if(doc.is_pos ==1) cur_frm.cscript.is_pos(doc, dt, dn); diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index 8f9fa6d822..e86c2fe9b6 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -15,14 +15,14 @@ cur_frm.cscript.onload = function(doc, dt, dn) { if(!doc.transaction_date) set_multiple(dt,dn,{transaction_date:get_today()}); if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()}); if(doc.__islocal && doc.customer) cur_frm.cscript.pull_item_details_onload(doc,dt,dn); - if(!doc.price_list_currency) set_multiple(cdt, cdn, {price_list_currency: doc.currency, plc_conversion_rate: 1}); - + if(!doc.price_list_currency) { + set_multiple(dt, dn, {price_list_currency: doc.currency, plc_conversion_rate:1}); +} if(!doc.posting_time) doc.posting_time = wn.datetime.get_cur_time() if(doc.__islocal){ hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']); } - } cur_frm.cscript.onload_post_render = function(doc, dt, dn) { @@ -34,7 +34,6 @@ cur_frm.cscript.onload_post_render = function(doc, dt, dn) { // REFRESH // ================================================================================================ cur_frm.cscript.refresh = function(doc, cdt, cdn) { - cur_frm.clear_custom_buttons(); if(doc.per_billed < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Sales Invoice']); From 6182b929bf44a8cd3db977b5a3679d1c9f696122 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 29 Dec 2011 12:56:55 +0530 Subject: [PATCH 02/18] set default value as blank insead of None through manage account --- .../doctype/manage_account/manage_account.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/erpnext/setup/doctype/manage_account/manage_account.py b/erpnext/setup/doctype/manage_account/manage_account.py index 5dd2d06045..5b1292aba2 100644 --- a/erpnext/setup/doctype/manage_account/manage_account.py +++ b/erpnext/setup/doctype/manage_account/manage_account.py @@ -42,16 +42,16 @@ class DocType: def_list = [['fiscal_year',self.doc.current_fiscal_year], ['company',self.doc.default_company], ['currency',self.doc.default_currency], - ['price_list_name',self.doc.default_price_list], - ['price_list_currency', self.doc.default_price_list_currency], - ['item_group',self.doc.default_item_group], - ['customer_group',self.doc.default_customer_group], - ['cust_master_name',self.doc.cust_master_name], - ['supplier_type',self.doc.default_supplier_type], + ['price_list_name',self.doc.default_price_list or ''], + ['price_list_currency', self.doc.default_price_list_currency or ''], + ['item_group',self.doc.default_item_group or ''], + ['customer_group',self.doc.default_customer_group or ''], + ['cust_master_name',self.doc.cust_master_name or ''], + ['supplier_type',self.doc.default_supplier_type or ''], ['supp_master_name',self.doc.supp_master_name], - ['territory',self.doc.default_territory], - ['stock_uom',self.doc.default_stock_uom], - ['fraction_currency',self.doc.default_currency_fraction], + ['territory',self.doc.default_territory or ''], + ['stock_uom',self.doc.default_stock_uom or ''], + ['fraction_currency',self.doc.default_currency_fraction or ''], ['valuation_method',self.doc.default_valuation_method]] for d in def_list: From 0dfb8e939cc67fb726a103ee062726592eb690d6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 29 Dec 2011 14:40:05 +0530 Subject: [PATCH 03/18] Pending patches to be run from patch.py --- erpnext/patches/pending_patches.py | 50 ++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 erpnext/patches/pending_patches.py diff --git a/erpnext/patches/pending_patches.py b/erpnext/patches/pending_patches.py new file mode 100644 index 0000000000..9ffa63af6d --- /dev/null +++ b/erpnext/patches/pending_patches.py @@ -0,0 +1,50 @@ +def execute(): + import webnotes + from webnotes.model.code import get_obj + from webnotes.modules.module_manager import reload_doc + sql = webnotes.conn.sql + + reload_doc('hr', 'doctype', 'appraisal') + reload_doc('hr', 'doctype', 'appraisal_detail') + + sql("update `tabDocField` set `hidden` = 0 where fieldname = 'group_or_ledger' and parent = 'Cost Center'") + sql("update tabDocPerm set amend = 0 where parent = 'Salary Structure'") + sql("update tabDocPerm set cancel = 1 where parent = 'Company' and role = 'System Manager'") + + if sql("select count(name) from `tabDocField` where label = 'View Ledger Entry' and parent = 'Journal Voucher' and fieldtype = 'Button'")[0][0] > 1: + sql("delete from `tabDocField` where label = 'View Ledger Entry' and parent = 'Journal Voucher' and fieldtype = 'Button' limit 1") + if sql("select count(name) from `tabDocField` where label = 'Get Balance' and parent = 'Journal Voucher' and fieldtype = 'Button'")[0][0] > 1: + sql("delete from `tabDocField` where label = 'Get Balance' and parent = 'Journal Voucher' and fieldtype = 'Button' limit 1") + + reload_doc('accounts', 'doctype', 'internal_reconciliation') + reload_doc('accounts', 'doctype', 'ir_payment_detail') + reload_doc('accounts', 'Module Def', 'Accounts') + + + reload_doc('setup', 'doctype','features_setup') + flds = ['page_break', 'projects', 'packing_details', 'discounts', 'brands', 'item_batch_nos', 'after_sales_installations', 'item_searial_nos', 'item_group_in_details', 'exports', 'imports', 'item_advanced', 'sales_extras', 'more_info', 'quality', 'manufacturing', 'pos', 'item_serial_nos'] + st = "'"+"', '".join(flds)+"'" + sql("delete from `tabDocField` where fieldname in (%s) and parent = 'Features Setup'" % st) + sql("delete from `tabDefaultValue` where defkey in (%s) and parent = 'Control Panel'" % st) + + fs = get_obj('Features Setup', 'Features Setup') + fs.doc.save() + fs.validate() + + if sql("select count(name) from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button'")[0][0] > 1: + sql("delete from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button' limit 1") + + reload_doc('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt') + + reload_doc('accounts', 'doctype', 'cost_center') + reload_doc('stock', 'Module Def', 'Stock') + sql("delete from `tabModule Def Item` where display_name = 'Serial No' and parent = 'Support'") + sql("update `tabDocType` set subject = 'Item Code: %(item_code)s, Warehouse: %(warehouse)s' where name = 'Serial No'") + + # Patch for adding packing related columns (packed by, checked by, shipping mark etc) + reload_doc('stock','doctype','delivery_note') + sql("update `tabDocField` set allow_on_submit = 1 where fieldname = 'page_break'") + sql("update `tabDocField` set allow_on_submit = 1 where fieldname in ('indent_details', 'po_details', 'purchase_receipt_details', 'entries', 'sales_order_details', 'delivery_note_details', 'quotation_details') and fieldtype = 'Table'") + + from webnotes.session_cache import clear_cache + clear_cache(webnotes.session['user']) From 21d0b68a7ded4eae6578b2a6198ee374faed3c0e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 29 Dec 2011 15:39:26 +0530 Subject: [PATCH 04/18] Fixes in pending_patches --- erpnext/patches/pending_patches.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/erpnext/patches/pending_patches.py b/erpnext/patches/pending_patches.py index 9ffa63af6d..970af74d2d 100644 --- a/erpnext/patches/pending_patches.py +++ b/erpnext/patches/pending_patches.py @@ -20,16 +20,7 @@ def execute(): reload_doc('accounts', 'doctype', 'ir_payment_detail') reload_doc('accounts', 'Module Def', 'Accounts') - - reload_doc('setup', 'doctype','features_setup') - flds = ['page_break', 'projects', 'packing_details', 'discounts', 'brands', 'item_batch_nos', 'after_sales_installations', 'item_searial_nos', 'item_group_in_details', 'exports', 'imports', 'item_advanced', 'sales_extras', 'more_info', 'quality', 'manufacturing', 'pos', 'item_serial_nos'] - st = "'"+"', '".join(flds)+"'" - sql("delete from `tabDocField` where fieldname in (%s) and parent = 'Features Setup'" % st) - sql("delete from `tabDefaultValue` where defkey in (%s) and parent = 'Control Panel'" % st) - fs = get_obj('Features Setup', 'Features Setup') - fs.doc.save() - fs.validate() if sql("select count(name) from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button'")[0][0] > 1: sql("delete from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button' limit 1") @@ -48,3 +39,20 @@ def execute(): from webnotes.session_cache import clear_cache clear_cache(webnotes.session['user']) + + # FEATURES SETUP + #---------------- + reload_doc('setup', 'doctype','features_setup') + flds = ['page_break', 'projects', 'packing_details', 'discounts', 'brands', 'item_batch_nos', 'after_sales_installations', 'item_searial_nos', 'item_group_in_details', 'exports', 'imports', 'item_advanced', 'sales_extras', 'more_info', 'quality', 'manufacturing', 'pos', 'item_serial_nos'] + st = "'"+"', '".join(flds)+"'" + sql("delete from `tabSingles` where field in (%s) and doctype = 'Features Setup'" % st) + sql("delete from `tabDocField` where fieldname in (%s) and parent = 'Features Setup'" % st) + sql("delete from `tabDefaultValue` where defkey in (%s) and parent = 'Control Panel'" % st) + + if not sql("select * from `tabDefaultValue` where defkey like 'fs_%' and parent = 'Control Panel'"): + rs = sql("select fieldname from tabDocField where parent='Features Setup' and fieldname is not null") + fs = get_obj('Features Setup', 'Features Setup') + for d in rs: + fs.doc.fields[d[0]] = 1 + fs.doc.save() + fs.validate() From a21156d4d36a9237647cbe0b6f95ce00464c37a6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 30 Dec 2011 11:16:15 +0530 Subject: [PATCH 05/18] Removed msgprint --- erpnext/stock/doctype/bin/bin.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py index 881a176ceb..5d4ba8be29 100644 --- a/erpnext/stock/doctype/bin/bin.py +++ b/erpnext/stock/doctype/bin/bin.py @@ -307,7 +307,6 @@ class DocType: # item re-order # ------------- def reorder_item(self,doc_type,doc_name): - msgprint(get_value('Manage Account', None, 'auto_indent')) if get_value('Manage Account', None, 'auto_indent'): #check if re-order is required indent_detail_fields = sql("select re_order_level,item_name,description,brand,item_group,lead_time_days,min_order_qty,email_notify from tabItem where item_code = %s",(self.doc.item_code),as_dict=1) From c184dc56a467cbe287edb9c1377ec2005abf53ee Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 30 Dec 2011 13:29:45 +0530 Subject: [PATCH 06/18] Error fixed in uom conversion rate fetching --- erpnext/buying/doctype/purchase_common/purchase_common.js | 2 +- erpnext/buying/doctype/purchase_common/purchase_common.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index a429b6894c..53304b0f69 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -53,7 +53,7 @@ cur_frm.cscript.uom = function(doc, cdt, cdn) { call_back = function(doc, cdt, cdn){ cur_frm.cscript.calc_amount(doc, 2); } - str_arg = {'item_code':d.item_code, 'uom':d.uom, 'stock_qty':flt(d.stock_qty), 'qty': flt(d.qty)} + str_arg = {'item_code':d.item_code, 'uom':d.uom, 'stock_qty':flt(d.stock_qty), 'qty': flt(d.qty), 'conversion_rate':doc.conversion_rate} // Updates Conversion Factor, Qty and Purchase Rate get_server_fields('get_uom_details',JSON.stringify(str_arg), fname, doc,cdt,cdn,1, call_back); // don't make mistake of calling update_stock_qty() the get_uom_details returns stock_qty as per conversion factor properly diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py index 84bfffb7ed..5bade929b3 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.py +++ b/erpnext/buying/doctype/purchase_common/purchase_common.py @@ -165,8 +165,8 @@ class DocType(TransactionBase): 'qty' : flt(arg['stock_qty']) / flt(uom[0]['conversion_factor']), 'purchase_ref_rate' : (lpr and flt(lpr[0]['last_purchase_rate']) * flt(uom[0]['conversion_factor'])) or 0, 'purchase_rate' : (lpr and flt(lpr[0]['last_purchase_rate']) * flt(uom[0]['conversion_factor'])) or 0, - 'import_ref_rate' : (lpr and flt(lpr[0]['last_purchase_rate']) * flt(uom[0]['conversion_factor'])/flt(self.doc.conversion_rate)) or 0, - 'import_rate' : (lpr and flt(lpr[0]['last_purchase_rate']) * flt(uom[0]['conversion_factor'])/flt(self.doc.conversion_rate)) or 0 + 'import_ref_rate' : (lpr and flt(lpr[0]['last_purchase_rate']) * flt(uom[0]['conversion_factor'])/flt(arg['conversion_rate'])) or 0, + 'import_rate' : (lpr and flt(lpr[0]['last_purchase_rate']) * flt(uom[0]['conversion_factor'])/flt(arg['conversion_rate'])) or 0 } return ret From db126e80b8aa5a58abf4d6810c6d8285acf92b97 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 3 Jan 2012 11:10:11 +0530 Subject: [PATCH 07/18] pos setting patch --- erpnext/patches/pos_setting_patch.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 erpnext/patches/pos_setting_patch.py diff --git a/erpnext/patches/pos_setting_patch.py b/erpnext/patches/pos_setting_patch.py new file mode 100644 index 0000000000..c202ab73b7 --- /dev/null +++ b/erpnext/patches/pos_setting_patch.py @@ -0,0 +1,6 @@ +def execute(): + import webnotes + webnotes.conn.sql("update `tabDocField` set `default` = 1 where fieldname = 'conversion_rate' and parent = 'POS Setting'") + + from webnotes.model import delete_doc + delete_doc('DocType', 'POS Settings') From 9d8e85c1f5f96f1d88c18789c97bbcb54b5f5757 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 4 Jan 2012 16:17:18 +0530 Subject: [PATCH 08/18] Dont update series starts from if no prefix --- .../setup/doctype/naming_series/naming_series.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/erpnext/setup/doctype/naming_series/naming_series.py b/erpnext/setup/doctype/naming_series/naming_series.py index c2594e38f4..4b7e7411c7 100644 --- a/erpnext/setup/doctype/naming_series/naming_series.py +++ b/erpnext/setup/doctype/naming_series/naming_series.py @@ -82,9 +82,10 @@ class DocType: #----------------------------------------------------------------------------------------------------------------------------------- def update_series_start(self): - ser_det = sql("select name from `tabSeries` where name = %s", self.doc.prefix) - if ser_det: - sql("update `tabSeries` set current = '%s' where name = '%s'" % (self.doc.starts_from-1,self.doc.prefix)) - else: - sql("insert into tabSeries (name, current) values (%s,%s)",(cstr(self.doc.prefix),cint(self.doc.starts_from)-1)) - msgprint("Series Updated Successfully") + if self.doc.prefix: + ser_det = sql("select name from `tabSeries` where name = %s", self.doc.prefix) + if ser_det: + sql("update `tabSeries` set current = '%s' where name = '%s'" % (self.doc.starts_from-1,self.doc.prefix)) + else: + sql("insert into tabSeries (name, current) values (%s,%s)",(cstr(self.doc.prefix),cint(self.doc.starts_from)-1)) + msgprint("Series Updated Successfully") From 15e8277a46dce00caf53626d31ebbbcaadd0e6be Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 4 Jan 2012 16:23:09 +0530 Subject: [PATCH 09/18] Dont update series starts from if no prefix --- erpnext/setup/doctype/naming_series/naming_series.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/setup/doctype/naming_series/naming_series.py b/erpnext/setup/doctype/naming_series/naming_series.py index 4b7e7411c7..2ad1236aa5 100644 --- a/erpnext/setup/doctype/naming_series/naming_series.py +++ b/erpnext/setup/doctype/naming_series/naming_series.py @@ -89,3 +89,5 @@ class DocType: else: sql("insert into tabSeries (name, current) values (%s,%s)",(cstr(self.doc.prefix),cint(self.doc.starts_from)-1)) msgprint("Series Updated Successfully") + else: + msgprint("Please select prefix first") From d2686b1c31ff279645f09fda7b9fe99cf380cfd1 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 5 Jan 2012 11:16:18 +0530 Subject: [PATCH 10/18] reload doctype --- erpnext/patches/reload_doctype.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 erpnext/patches/reload_doctype.py diff --git a/erpnext/patches/reload_doctype.py b/erpnext/patches/reload_doctype.py new file mode 100644 index 0000000000..a63039a0b3 --- /dev/null +++ b/erpnext/patches/reload_doctype.py @@ -0,0 +1,4 @@ +def execute(): + import webnotes + from webnotes.modules.module_manager import reload_doc + reload_doc('core', 'doctype', 'doctype') From 2abc6026f2296e33bbf1177bf1510b7cdd07a8eb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 5 Jan 2012 11:24:49 +0530 Subject: [PATCH 11/18] reload po-pr mapper --- erpnext/patches/reload_po_pr_mapper.py | 4 +++ .../Purchase Order-Purchase Receipt.txt | 28 +++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 erpnext/patches/reload_po_pr_mapper.py diff --git a/erpnext/patches/reload_po_pr_mapper.py b/erpnext/patches/reload_po_pr_mapper.py new file mode 100644 index 0000000000..c97f20cbbc --- /dev/null +++ b/erpnext/patches/reload_po_pr_mapper.py @@ -0,0 +1,4 @@ +def execute(): + import webnotes + from webnotes.modules.module_manager import reload_doc + reload_doc('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt') diff --git a/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt b/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt index 196d028b67..67738bdcb3 100644 --- a/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt +++ b/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt @@ -5,7 +5,7 @@ { 'creation': '2010-08-08 17:09:35', 'docstatus': 0, - 'modified': '2011-10-12 10:49:40', + 'modified': '2012-01-05 11:21:23', 'modified_by': 'Administrator', 'owner': 'Administrator' }, @@ -22,7 +22,6 @@ # These values are common for all Field Mapper Detail { 'doctype': 'Field Mapper Detail', - 'map': 'Yes', 'name': '__common__', 'parent': 'Purchase Order-Purchase Receipt', 'parentfield': 'field_mapper_details', @@ -50,6 +49,7 @@ 'checking_operator': '=', 'doctype': 'Field Mapper Detail', 'from_field': 'supplier', + 'map': 'Yes', 'match_id': 0, 'to_field': 'supplier' }, @@ -59,6 +59,7 @@ 'checking_operator': '=', 'doctype': 'Field Mapper Detail', 'from_field': 'company', + 'map': 'Yes', 'match_id': 0, 'to_field': 'company' }, @@ -68,6 +69,7 @@ 'checking_operator': '=', 'doctype': 'Field Mapper Detail', 'from_field': 'currency', + 'map': 'Yes', 'match_id': 0, 'to_field': 'currency' }, @@ -76,6 +78,7 @@ { 'doctype': 'Field Mapper Detail', 'from_field': 'name', + 'map': 'Yes', 'match_id': 1, 'to_field': 'prevdoc_detail_docname' }, @@ -84,6 +87,7 @@ { 'doctype': 'Field Mapper Detail', 'from_field': 'parent', + 'map': 'Yes', 'match_id': 1, 'to_field': 'prevdoc_docname' }, @@ -92,6 +96,7 @@ { 'doctype': 'Field Mapper Detail', 'from_field': 'parenttype', + 'map': 'Yes', 'match_id': 1, 'to_field': 'prevdoc_doctype' }, @@ -101,6 +106,7 @@ 'checking_operator': '=', 'doctype': 'Field Mapper Detail', 'from_field': 'item_code', + 'map': 'Yes', 'match_id': 1, 'to_field': 'item_code' }, @@ -109,6 +115,7 @@ { 'doctype': 'Field Mapper Detail', 'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) ', + 'map': 'Yes', 'match_id': 1, 'to_field': 'received_qty' }, @@ -117,6 +124,7 @@ { 'doctype': 'Field Mapper Detail', 'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) ', + 'map': 'Yes', 'match_id': 1, 'to_field': 'qty' }, @@ -125,6 +133,7 @@ { 'doctype': 'Field Mapper Detail', 'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.conversion_factor)', + 'map': 'Yes', 'match_id': 1, 'to_field': 'stock_qty' }, @@ -133,6 +142,7 @@ { 'doctype': 'Field Mapper Detail', 'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.import_rate)', + 'map': 'Yes', 'match_id': 1, 'to_field': 'import_amount' }, @@ -141,6 +151,7 @@ { 'doctype': 'Field Mapper Detail', 'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.purchase_rate)', + 'map': 'Yes', 'match_id': 1, 'to_field': 'amount' }, @@ -149,6 +160,7 @@ { 'doctype': 'Field Mapper Detail', 'from_field': 'schedule_date', + 'map': 'Yes', 'match_id': 1, 'to_field': 'schedule_date' }, @@ -157,6 +169,7 @@ { 'doctype': 'Field Mapper Detail', 'from_field': 'net_total', + 'map': 'Yes', 'match_id': 0, 'to_field': 'net_total' }, @@ -165,6 +178,7 @@ { 'doctype': 'Field Mapper Detail', 'from_field': 'grand_total', + 'map': 'Yes', 'match_id': 0, 'to_field': 'grand_total' }, @@ -173,10 +187,20 @@ { 'doctype': 'Field Mapper Detail', 'from_field': 'total_tax', + 'map': 'Yes', 'match_id': 0, 'to_field': 'total_tax' }, + # Field Mapper Detail + { + 'doctype': 'Field Mapper Detail', + 'from_field': 'transaction_date', + 'map': 'No', + 'match_id': 0, + 'to_field': 'transaction_date' + }, + # Table Mapper Detail { 'doctype': 'Table Mapper Detail', From 7394239e05c751493bf0a62e99454fbddfce5e18 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 5 Jan 2012 12:16:28 +0530 Subject: [PATCH 12/18] delete purpose of service --- erpnext/patches/delete_pur_of_service.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 erpnext/patches/delete_pur_of_service.py diff --git a/erpnext/patches/delete_pur_of_service.py b/erpnext/patches/delete_pur_of_service.py new file mode 100644 index 0000000000..eecece6f05 --- /dev/null +++ b/erpnext/patches/delete_pur_of_service.py @@ -0,0 +1,4 @@ +def execute(): + import webnotes + from webnotes.model import delete_doc + delete_doc('DocType', 'Purpose of Service') From b50c02214cd7672275ed297320be84da03008564 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 5 Jan 2012 12:21:03 +0530 Subject: [PATCH 13/18] removed pur of service --- erpnext/setup/page/setup/setup.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/setup/page/setup/setup.js b/erpnext/setup/page/setup/setup.js index f536c701c6..dc19c1ea81 100644 --- a/erpnext/setup/page/setup/setup.js +++ b/erpnext/setup/page/setup/setup.js @@ -235,8 +235,7 @@ SetupData = function(cnty){ this.buying = {'Buying':[['Supplier Type',1,'Supplier Type','','Manage supplier classifications'], ['Supplier',1,'Supplier','id'+NEWLINE+'supplier_type'+NEWLINE+'supplier_status'+NEWLINE+'company','Supplier master']]}; - this.maintenance = {'Maintenance':[['Serial No',1,'Serial No','item_code'+NEWLINE+'status'+NEWLINE+'pr_no'+NEWLINE+'delivery_note_no'+NEWLINE+'customer_name','Manage unique serial numbers for items'], - ['Purpose of Service',1,'Purpose of Service','','Purpose of service master']]}; + this.maintenance = {'Maintenance':[['Serial No',1,'Serial No','item_code'+NEWLINE+'status'+NEWLINE+'pr_no'+NEWLINE+'delivery_note_no'+NEWLINE+'customer_name','Manage unique serial numbers for items']]}; this.production = {'Production':[['Bill of Materials',1,'Bill Of Materials','id'+NEWLINE+'item'+NEWLINE+'description'+NEWLINE+'operating_cost'+NEWLINE+'maintained_by','Muti-level bill of materials and operations'], ['Workstation',1,'Workstation','id'+NEWLINE+'workstation_name'+NEWLINE+'warehouse'+NEWLINE+'description','Workstation master']]}; From 8fb9abd47e84d6d83668823aaa1fe50d6336dc93 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 5 Jan 2012 14:01:35 +0530 Subject: [PATCH 14/18] Subject added in notification mail --- erpnext/projects/doctype/project_control/project_control.py | 1 + erpnext/projects/doctype/ticket/ticket.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/erpnext/projects/doctype/project_control/project_control.py b/erpnext/projects/doctype/project_control/project_control.py index 4b382a555d..ed192d2efa 100644 --- a/erpnext/projects/doctype/project_control/project_control.py +++ b/erpnext/projects/doctype/project_control/project_control.py @@ -130,6 +130,7 @@ def sent_reminder_task(): msg2="""

Two days to complete: %(name)s

This is a reminder for the task %(name)s has been assigned to you by %(senders_name)s on %(opening_date)s

+

Subject: %(subject)s

Project: %(project)s

Expected Start Date: %(exp_start_date)s

Expected End Date: %(exp_end_date)s

diff --git a/erpnext/projects/doctype/ticket/ticket.py b/erpnext/projects/doctype/ticket/ticket.py index 4dbcfe78de..24c9750006 100644 --- a/erpnext/projects/doctype/ticket/ticket.py +++ b/erpnext/projects/doctype/ticket/ticket.py @@ -97,6 +97,7 @@ class DocType: 'opening_date': self.doc.opening_date, 'exp_start_date': self.doc.exp_start_date, 'exp_end_date' : self.doc.exp_end_date, + 'subject' : self.doc.subject, 'project': self.doc.project, 'review_date': self.doc.review_date, 'description': self.doc.description @@ -105,6 +106,7 @@ class DocType: msg2="""

%(name)s

This is a Notification for the task %(name)s that has been assigned to you by %(senders_name)s on %(opening_date)s

+

Subject: %(subject)s

Project: %(project)s

Review Date: %(review_date)s

Expected Start Date: %(exp_start_date)s

From a9cca2e2e942a305391424a3b6f151f2ce83c1de Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 5 Jan 2012 14:10:14 +0530 Subject: [PATCH 15/18] error fixed in reorder indent --- erpnext/stock/doctype/bin/bin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py index 5d4ba8be29..6a228c1f9b 100644 --- a/erpnext/stock/doctype/bin/bin.py +++ b/erpnext/stock/doctype/bin/bin.py @@ -330,7 +330,7 @@ class DocType: indent_details_child.item_code = self.doc.item_code indent_details_child.uom = self.doc.stock_uom indent_details_child.warehouse = self.doc.warehouse - indent_details_child.schedule_date= add_days(nowdate(),i['lead_time_days']) + indent_details_child.schedule_date= add_days(nowdate(),cint(i['lead_time_days'])) indent_details_child.item_name = i['item_name'] indent_details_child.description = i['description'] indent_details_child.item_group = i['item_group'] From 84745e7ac139eaaa99a4c0f2c8a83518748c5b2f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 5 Jan 2012 18:03:16 +0530 Subject: [PATCH 16/18] event notificationin maintenance schedule --- .../maintenance_schedule.py | 66 ++++++++++++++----- 1 file changed, 51 insertions(+), 15 deletions(-) diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py index d5c90b55fc..69f5d9228b 100644 --- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py +++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py @@ -46,14 +46,15 @@ class DocType(TransactionBase): import datetime self.doc.clear_table(self.doclist, 'maintenance_schedule_detail') count = 0 + sql("delete from `tabMaintenance Schedule Detail` where parent='%s'" %(self.doc.name)) for d in getlist(self.doclist, 'item_maintenance_detail'): self.validate_maintenance_detail() - s_list =[] + s_list =[] s_list = self.create_schedule_list(d.start_date, d.end_date, d.no_of_visits) - for i in range(d.no_of_visits): child = addchild(self.doc,'maintenance_schedule_detail','Maintenance Schedule Detail',1,self.doclist) child.item_code = d.item_code + child.item_name = d.item_name child.scheduled_date = s_list[i].strftime('%Y-%m-%d') if d.serial_no: child.serial_no = d.serial_no @@ -61,8 +62,45 @@ class DocType(TransactionBase): count = count+1 child.incharge_name = d.incharge_name child.save(1) + self.on_update() - + + + + def on_submit(self): + if not getlist(self.doclist, 'maintenance_schedule_detail'): + msgprint("Please click on 'Generate Schedule' to get schedule") + raise Exception + self.check_serial_no_added() + self.validate_serial_no_warranty() + self.validate_schedule() + email_map ={} + for d in getlist(self.doclist, 'item_maintenance_detail'): + if d.serial_no: + self.update_amc_date(d.serial_no, d.end_date) + if not d.incharge_name in email_map: + e = sql("select email_id, name from `tabSales Person` where name='%s' " %(d.incharge_name),as_dict=1)[0] + email_map[d.incharge_name] = (e['email_id']) + scheduled_date =sql("select scheduled_date from `tabMaintenance Schedule Detail` \ + where owner='%s' and item_code='%s' and parent='%s' " %(email_map[d.incharge_name], \ + d.item_code,self.doc.name), as_dict=1) + for key in scheduled_date: + if email_map[d.incharge_name]: + self.add_calender_event(key["scheduled_date"],email_map[d.incharge_name],d.item_code) + set(self.doc, 'status', 'Submitted') + + + def add_calender_event(self,scheduled_date,incharge_email,item_code): + """ Add calendar event for Maintenece Schedule in calendar of Allocated person""" + event = Document('Event') + event.owner = incharge_email + event.description = "Item Code:%s and Reference:%s" %(item_code,self.doc.name) + event.event_date = scheduled_date + event.event_hour = '10:00' + event.event_type = 'Private' + event.ref_type = 'Maintenance Schedule' + event.ref_name = self.doc.name + event.save(1) #get schedule dates #---------------------- def create_schedule_list(self, start_date, end_date, no_of_visit): @@ -97,6 +135,8 @@ class DocType(TransactionBase): msgprint("Weekly periodicity can be set for period of atleast 1 week or more") raise Exception + + #get count on the basis of periodicity selected #---------------------------------------------------- def get_no_of_visits(self, arg): @@ -121,6 +161,8 @@ class DocType(TransactionBase): ret = {'no_of_visits':count} return ret + + def validate_maintenance_detail(self): if not getlist(self.doclist, 'item_maintenance_detail'): msgprint("Please enter Maintaince Details first") @@ -269,21 +311,15 @@ class DocType(TransactionBase): msgprint("Please click on 'Generate Schedule' to fetch serial no added for item "+m.item_code) raise Exception - def on_submit(self): - if not getlist(self.doclist, 'maintenance_schedule_detail'): - msgprint("Please click on 'Generate Schedule' to get schedule") - raise Exception - self.check_serial_no_added() - self.validate_serial_no_warranty() - self.validate_schedule() - for d in getlist(self.doclist, 'item_maintenance_detail'): - if d.serial_no: - self.update_amc_date(d.serial_no, d.end_date) - set(self.doc, 'status', 'Submitted') - + def on_cancel(self): for d in getlist(self.doclist, 'item_maintenance_detail'): if d.serial_no: self.update_amc_date(d.serial_no, '') set(self.doc, 'status', 'Cancelled') + sql("delete from `tabEvent` where ref_type='Maintenance Schedule' and ref_name='%s' " %(self.doc.name)) + def on_trash(self): + sql("delete from `tabEvent` where ref_type='Maintenance Schedule' and ref_name='%s' " %(self.doc.name)) + + From fb5df36c380bd4f6d78cc1a47cde7f2985e1530e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 5 Jan 2012 18:37:27 +0530 Subject: [PATCH 17/18] event notificationin maintenance schedule --- .../maintenance_schedule/maintenance_schedule.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py index 69f5d9228b..c47ec2286b 100644 --- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py +++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py @@ -74,16 +74,20 @@ class DocType(TransactionBase): self.check_serial_no_added() self.validate_serial_no_warranty() self.validate_schedule() + email_map ={} for d in getlist(self.doclist, 'item_maintenance_detail'): if d.serial_no: self.update_amc_date(d.serial_no, d.end_date) - if not d.incharge_name in email_map: + + if d.incharge_name not in email_map: e = sql("select email_id, name from `tabSales Person` where name='%s' " %(d.incharge_name),as_dict=1)[0] email_map[d.incharge_name] = (e['email_id']) + scheduled_date =sql("select scheduled_date from `tabMaintenance Schedule Detail` \ - where owner='%s' and item_code='%s' and parent='%s' " %(email_map[d.incharge_name], \ - d.item_code,self.doc.name), as_dict=1) + where incharge_name='%s' and item_code='%s' and parent='%s' " %(d.incharge_name, \ + d.item_code, self.doc.name), as_dict=1, debug=1) + for key in scheduled_date: if email_map[d.incharge_name]: self.add_calender_event(key["scheduled_date"],email_map[d.incharge_name],d.item_code) @@ -101,6 +105,8 @@ class DocType(TransactionBase): event.ref_type = 'Maintenance Schedule' event.ref_name = self.doc.name event.save(1) + + #get schedule dates #---------------------- def create_schedule_list(self, start_date, end_date, no_of_visit): From 40de49110e79940281f4dae0f4bd099cd26f605c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 9 Jan 2012 12:54:20 +0530 Subject: [PATCH 18/18] Removed webforms link from setup --- erpnext/setup/page/setup/setup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/setup/page/setup/setup.js b/erpnext/setup/page/setup/setup.js index dc19c1ea81..b3a195effd 100644 --- a/erpnext/setup/page/setup/setup.js +++ b/erpnext/setup/page/setup/setup.js @@ -168,7 +168,7 @@ SetupData = function(cnty){ ['Manage Trash',2,'Trash','','Restore trashed items'], ['Import Data',2,'Import Data','','Import data from CSV files'], ['Manage Users',2,'My Company','','Add / remove users and manage their roles'], - ['Web Forms',2,'Webforms','', 'Code to embed forms in yor website'], + //['Web Forms',2,'Webforms','', 'Code to embed forms in yor website'], ['Permissions Manager',2,'Permission Engine','', 'Manage all permissions from one tool'], //['Property Setter',1,'Property Setter','', 'Customize properties of a Form (DocType) or Field'], ['Customize Form View',3,'DocLayer','', 'Customize properties of a Form (DocType) or Field'],