From 1b81badd5803302fe419baf5b25855f87b9c0e5e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 3 Apr 2012 11:27:03 +0530 Subject: [PATCH 01/11] validation changes for po item --- erpnext/buying/doctype/purchase_common/purchase_common.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py index ca9181f154..597eec4fde 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.py +++ b/erpnext/buying/doctype/purchase_common/purchase_common.py @@ -227,7 +227,7 @@ class DocType(TransactionBase): if d.fields.has_key(x): d.fields[x] = f_lst[x] - item = sql("select is_stock_item, is_purchase_item from tabItem where name=%s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())", d.item_code) + item = sql("select is_stock_item, is_purchase_item, is_sub_contracted_item from tabItem where name=%s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())", d.item_code) if not item: msgprint("Item %s does not exist in Item Master." % cstr(d.item_code)) raise Exception @@ -239,9 +239,10 @@ class DocType(TransactionBase): raise Exception # validate purchase item - if not item[0][1]=='Yes': - msgprint("Item %s is not purchase item." % (d.item_code)) + if item[0][1] != 'Yes' and item[0][2] != 'Yes': + msgprint("Item %s is not a purchase item or sub-contracted item. Please check" % (d.item_code)) raise Exception + if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname: # check warehouse, uom in previous doc and in current doc are same. From a6eb15df4a29a659a47341cf26b63543e016d3c0 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 3 Apr 2012 13:22:20 +0530 Subject: [PATCH 02/11] fix in earning and deduction type field tyep --- .../mar_2012/earning_deduction_type_patch.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 erpnext/patches/mar_2012/earning_deduction_type_patch.py diff --git a/erpnext/patches/mar_2012/earning_deduction_type_patch.py b/erpnext/patches/mar_2012/earning_deduction_type_patch.py new file mode 100644 index 0000000000..438b34e946 --- /dev/null +++ b/erpnext/patches/mar_2012/earning_deduction_type_patch.py @@ -0,0 +1,14 @@ +def execute(): + import webnotes + webnotes.conn.sql(""" + UPDATE `tabDocField` + SET fieldtype = 'Link', options = 'Deduction Type' + WHERE parent = 'Deduction Detail' + AND fieldname = 'd_type' + """) + webnotes.conn.sql(""" + UPDATE `tabDocField` + SET fieldtype = 'Link', options = 'Earning Type' + WHERE parent = 'Earning Detail' + AND fieldname = 'e_type' + """) From fc8bf7b1d87be5018ea79ff4c6b45cadc2334657 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 3 Apr 2012 13:49:14 +0530 Subject: [PATCH 03/11] add select type link fields in permission control --- .../setup/doctype/permission_control/permission_control.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/permission_control/permission_control.py b/erpnext/setup/doctype/permission_control/permission_control.py index 049a3f518d..bb05bec1cd 100644 --- a/erpnext/setup/doctype/permission_control/permission_control.py +++ b/erpnext/setup/doctype/permission_control/permission_control.py @@ -70,7 +70,10 @@ class DocType: ret.append(p) # fields list - fl = ['', 'owner'] + [l[0] for l in sql("select fieldname from tabDocField where parent=%s and fieldtype='Link' and ifnull(options,'')!=''", doctype)] + fl = ['', 'owner'] + [l[0] for l in sql("""\ + select fieldname from tabDocField where parent=%s + and ((fieldtype='Link' and ifnull(options,'')!='') or + (fieldtype='Select') and lcase(ifnull(options,'')) like 'link:%%')""", doctype)] return {'perms':ret, 'fields':fl} From 00ceafb42d7da5f7f318caded189d5c65206a754 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 3 Apr 2012 18:43:17 +0530 Subject: [PATCH 04/11] fix in fiscal year of email digest --- erpnext/setup/doctype/email_digest/email_digest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py index ff9bf68719..fb3730cb25 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.py +++ b/erpnext/setup/doctype/email_digest/email_digest.py @@ -240,7 +240,9 @@ class DocType: Adds common conditions in dictionary "args" """ start_date, end_date = self.get_start_end_dates() - fiscal_start_date = webnotes.utils.get_defaults()['year_start_date'] + fiscal_year = webnotes.utils.get_defaults()['fiscal_year'] + fiscal_start_date = webnotes.conn.get_value('Fiscal Year', fiscal_year, + 'year_start_date') if 'new' in args['type']: args.update({ From f77c940fcfc8a0c459d53a12a2dd6111ae59137e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 5 Apr 2012 16:29:02 +0530 Subject: [PATCH 05/11] fixed price list currency issue --- .../selling/doctype/sales_common/sales_common.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js index cad8ec16f7..a3470ec460 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.js +++ b/erpnext/selling/doctype/sales_common/sales_common.js @@ -157,11 +157,17 @@ cur_frm.cscript.hide_price_list_currency = function(doc, cdt, cdn, callback1) { args: {'price_list':doc.price_list_name, 'company': doc.company}, callback: function(r, rt) { pl_currency = r.message[0]?r.message[0]:[]; + unhide_field(['price_list_currency', 'plc_conversion_rate']); + if (pl_currency.length==1) { - if (pl_currency[0] == doc.currency) set_multiple(cdt, cdn, {price_list_currency:doc.currency, plc_conversion_rate:doc.conversion_rate}); - else if (pl_currency[0] = r.message[1]) set_multiple(cdt, cdn, {price_list_currency:pl_currency[0], plc_conversion_rate:1}) - hide_field(['price_list_currency', 'plc_conversion_rate']); - } else unhide_field(['price_list_currency', 'plc_conversion_rate']); + if (pl_currency[0] == doc.currency) { + set_multiple(cdt, cdn, {price_list_currency:doc.currency, plc_conversion_rate:doc.conversion_rate}); + hide_field(['price_list_currency', 'plc_conversion_rate']); + } else if (pl_currency[0] = r.message[1]) { + set_multiple(cdt, cdn, {price_list_currency:pl_currency[0], plc_conversion_rate:1}) + hide_field(['price_list_currency', 'plc_conversion_rate']); + } + } if (r.message[1] == doc.currency) { set_multiple(cdt, cdn, {conversion_rate:1}); From 758eed555c8f837f8938e517d70680b1c1e1e64f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 5 Apr 2012 16:45:33 +0530 Subject: [PATCH 06/11] Update erpnext/selling/doctype/sales_common/sales_common.js --- erpnext/selling/doctype/sales_common/sales_common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js index a3470ec460..5dcdb69339 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.js +++ b/erpnext/selling/doctype/sales_common/sales_common.js @@ -163,7 +163,7 @@ cur_frm.cscript.hide_price_list_currency = function(doc, cdt, cdn, callback1) { if (pl_currency[0] == doc.currency) { set_multiple(cdt, cdn, {price_list_currency:doc.currency, plc_conversion_rate:doc.conversion_rate}); hide_field(['price_list_currency', 'plc_conversion_rate']); - } else if (pl_currency[0] = r.message[1]) { + } else if (pl_currency[0] == r.message[1]) { set_multiple(cdt, cdn, {price_list_currency:pl_currency[0], plc_conversion_rate:1}) hide_field(['price_list_currency', 'plc_conversion_rate']); } From 9ba2e49468f87fe1af147a8860d25de9e5cb3fde Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 5 Apr 2012 16:54:19 +0530 Subject: [PATCH 07/11] Update erpnext/selling/doctype/sales_common/sales_common.js --- erpnext/selling/doctype/sales_common/sales_common.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js index 5dcdb69339..b257d6da51 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.js +++ b/erpnext/selling/doctype/sales_common/sales_common.js @@ -160,11 +160,12 @@ cur_frm.cscript.hide_price_list_currency = function(doc, cdt, cdn, callback1) { unhide_field(['price_list_currency', 'plc_conversion_rate']); if (pl_currency.length==1) { + set_multiple(cdt, cdn, {price_list_currency:pl_currency[0]}); if (pl_currency[0] == doc.currency) { - set_multiple(cdt, cdn, {price_list_currency:doc.currency, plc_conversion_rate:doc.conversion_rate}); + set_multiple(cdt, cdn, {plc_conversion_rate:doc.conversion_rate}); hide_field(['price_list_currency', 'plc_conversion_rate']); } else if (pl_currency[0] == r.message[1]) { - set_multiple(cdt, cdn, {price_list_currency:pl_currency[0], plc_conversion_rate:1}) + set_multiple(cdt, cdn, {plc_conversion_rate:1}) hide_field(['price_list_currency', 'plc_conversion_rate']); } } From 05e4fc6eb68c8aec65fbc5e9da0900d2d9b606a4 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 6 Apr 2012 15:19:02 +0530 Subject: [PATCH 08/11] Chart of account/cc link only for accounts user and account manager role in account home page --- erpnext/accounts/page/accounts_home/accounts_home.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/page/accounts_home/accounts_home.js b/erpnext/accounts/page/accounts_home/accounts_home.js index 4551db0caa..52738a83bd 100644 --- a/erpnext/accounts/page/accounts_home/accounts_home.js +++ b/erpnext/accounts/page/accounts_home/accounts_home.js @@ -19,4 +19,12 @@ pscript['onload_accounts-home'] = function(wrapper) { if(wn.control_panel.country!='India') { $('.india-specific').toggle(false); } -} \ No newline at end of file + + if(wn.boot.profile.roles.indexOf('Accounts Manager')==-1 && wn.boot.profile.roles.indexOf('Accounts User')==-1) { + $('[href*="Accounts Browser"]').each(function() { + var txt = $(this).text(); + $(this).parent().css('color', '#999').html(txt); + }); + } + +} From 7da6ebc9af429fae358c34fec3721121bf5aa755 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 6 Apr 2012 17:30:53 +0530 Subject: [PATCH 09/11] Attachment option and total invoiced amt added in c-form --- erpnext/accounts/doctype/c_form/c_form.py | 8 + erpnext/accounts/doctype/c_form/c_form.txt | 195 ++++++++++++--------- 2 files changed, 123 insertions(+), 80 deletions(-) diff --git a/erpnext/accounts/doctype/c_form/c_form.py b/erpnext/accounts/doctype/c_form/c_form.py index 367b27aca6..bc5ed7b2a7 100644 --- a/erpnext/accounts/doctype/c_form/c_form.py +++ b/erpnext/accounts/doctype/c_form/c_form.py @@ -46,6 +46,14 @@ class DocType: else: msgprint("Please enter atleast 1 invoice in the table below", raise_exception=1) + self.calculate_total_invoiced_amount() + + def calculate_total_invoiced_amount(self): + total = 0 + for d in getlist(self.doclist, 'invoice_details'): + total += flt(d.grand_total) + webnotes.conn.set(self.doc, 'total_invoiced_amount', total) + def get_invoice_details(self, invoice_no): """ Pull details from invoices for referrence """ diff --git a/erpnext/accounts/doctype/c_form/c_form.txt b/erpnext/accounts/doctype/c_form/c_form.txt index 987bc9a7b3..2cead8913f 100644 --- a/erpnext/accounts/doctype/c_form/c_form.txt +++ b/erpnext/accounts/doctype/c_form/c_form.txt @@ -3,188 +3,223 @@ # These values are common in all dictionaries { - 'creation': '2011-12-07 16:16:16', + 'creation': '2011-12-14 11:40:47', 'docstatus': 0, - 'modified': '2011-12-07 17:50:17', - 'modified_by': 'Administrator', - 'owner': 'Administrator' + 'modified': '2012-04-06 17:29:50', + 'modified_by': u'Administrator', + 'owner': u'Administrator' }, # These values are common for all DocType { - '_last_update': '1323255350', - 'colour': 'White:FFF', + '_last_update': u'1333712835', + 'allow_attach': 1, + 'colour': u'White:FFF', 'doctype': 'DocType', - 'module': 'Accounts', + 'max_attachments': 3, + 'module': u'Accounts', 'name': '__common__', - 'section_style': 'Simple', + 'section_style': u'Simple', 'show_in_menu': 0, - 'version': 11 + 'version': 19 }, # These values are common for all DocField { - 'doctype': 'DocField', + 'doctype': u'DocField', 'name': '__common__', - 'parent': 'C-Form', - 'parentfield': 'fields', - 'parenttype': 'DocType', - 'permlevel': 0 + 'parent': u'C-Form', + 'parentfield': u'fields', + 'parenttype': u'DocType' }, # These values are common for all DocPerm { - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'name': '__common__', - 'parent': 'C-Form', - 'parentfield': 'permissions', - 'parenttype': 'DocType', + 'parent': u'C-Form', + 'parentfield': u'permissions', + 'parenttype': u'DocType', 'read': 1 }, # DocType, C-Form { 'doctype': 'DocType', - 'name': 'C-Form' + 'name': u'C-Form' }, # DocPerm { 'create': 1, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 0, - 'role': 'Accounts User', + 'role': u'Accounts User', 'write': 1 }, # DocPerm { 'create': 1, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 0, - 'role': 'Accounts Manager', + 'role': u'Accounts Manager', 'submit': 0, 'write': 1 }, # DocPerm { - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 1, - 'role': 'All' + 'role': u'All' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', - 'width': '50%' + 'doctype': u'DocField', + 'fieldtype': u'Column Break', + 'permlevel': 0, + 'width': u'50%' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'naming_series', - 'fieldtype': 'Select', - 'label': 'Series', - 'options': '\nC-FORM/', + 'doctype': u'DocField', + 'fieldname': u'naming_series', + 'fieldtype': u'Select', + 'label': u'Series', + 'options': u'\nC-FORM/', + 'permlevel': 0, 'reqd': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'c_form_no', - 'fieldtype': 'Data', - 'label': 'C-Form No', + 'doctype': u'DocField', + 'fieldname': u'c_form_no', + 'fieldtype': u'Data', + 'label': u'C-Form No', + 'permlevel': 0, 'reqd': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'received_date', - 'fieldtype': 'Date', - 'label': 'Received Date', + 'doctype': u'DocField', + 'fieldname': u'received_date', + 'fieldtype': u'Date', + 'label': u'Received Date', + 'permlevel': 0, 'reqd': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'customer', - 'fieldtype': 'Link', - 'label': 'Customer', - 'options': 'Customer', + 'doctype': u'DocField', + 'fieldname': u'customer', + 'fieldtype': u'Link', + 'label': u'Customer', + 'options': u'Customer', + 'permlevel': 0, 'reqd': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', - 'width': '50%' + 'doctype': u'DocField', + 'fieldtype': u'Column Break', + 'permlevel': 0, + 'width': u'50%' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'company', - 'fieldtype': 'Select', - 'label': 'Company', - 'options': 'link:Company' + 'doctype': u'DocField', + 'fieldname': u'company', + 'fieldtype': u'Select', + 'label': u'Company', + 'options': u'link:Company', + 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'fiscal_year', - 'fieldtype': 'Select', - 'label': 'Fiscal Year', - 'options': 'link:Fiscal Year', + 'doctype': u'DocField', + 'fieldname': u'fiscal_year', + 'fieldtype': u'Select', + 'label': u'Fiscal Year', + 'options': u'link:Fiscal Year', + 'permlevel': 0, 'reqd': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'quarter', - 'fieldtype': 'Select', - 'label': 'Quarter', - 'options': '\nI\nII\nIII\nIV' + 'doctype': u'DocField', + 'fieldname': u'quarter', + 'fieldtype': u'Select', + 'label': u'Quarter', + 'options': u'\nI\nII\nIII\nIV', + 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'total_amount', - 'fieldtype': 'Currency', - 'label': 'Total Amount', + 'doctype': u'DocField', + 'fieldname': u'total_amount', + 'fieldtype': u'Currency', + 'label': u'Total Amount', + 'permlevel': 0, 'reqd': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'state', - 'fieldtype': 'Select', - 'label': 'State', - 'options': "link:State\ncountry='India'", + 'doctype': u'DocField', + 'fieldname': u'state', + 'fieldtype': u'Select', + 'label': u'State', + 'options': u"link:State\ncountry='India'", + 'permlevel': 0, 'reqd': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break' + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'invoice_details', - 'fieldtype': 'Table', - 'label': 'Invoice Details', - 'options': 'C-Form Invoice Detail' + 'doctype': u'DocField', + 'fieldname': u'invoice_details', + 'fieldtype': u'Table', + 'label': u'Invoice Details', + 'options': u'C-Form Invoice Detail', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'total_invoiced_amount', + 'fieldtype': u'Currency', + 'label': u'Total Invoiced Amount', + 'permlevel': 1, + 'print_hide': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'file_list', + 'fieldtype': u'Text', + 'hidden': 1, + 'label': u'File List', + 'permlevel': 0, + 'print_hide': 1 } ] \ No newline at end of file From c63a58d4168093bd6a0fcaa2ade35966dc331748 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 6 Apr 2012 17:42:02 +0530 Subject: [PATCH 10/11] c-form reload pach --- erpnext/patches/april_2012/reload_c_form.py | 4 ++++ erpnext/patches/patch_list.py | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 erpnext/patches/april_2012/reload_c_form.py diff --git a/erpnext/patches/april_2012/reload_c_form.py b/erpnext/patches/april_2012/reload_c_form.py new file mode 100644 index 0000000000..246ea0fdb1 --- /dev/null +++ b/erpnext/patches/april_2012/reload_c_form.py @@ -0,0 +1,4 @@ +def execute(): + import webnotes + from webnotes.modules.module_manager import reload_doc + reload_doc('accounts', 'doctype', 'c_form') diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 3099456f19..cd38480100 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -222,5 +222,10 @@ patch_list = [ 'patch_file': 'so_rv_mapper_fix', 'description': 'SO-RV duplicate mapper entry removal' }, + { + 'patch_module': 'patches.april_2012', + 'patch_file': 'reload_c_form', + 'description': 'Added attchemnt option and total field' + }, ] From 3525d92cfbc0bc9c9fe28decc6626e72f9f427d0 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 6 Apr 2012 17:49:25 +0530 Subject: [PATCH 11/11] c-form reload pach --- erpnext/patches/april_2012/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 erpnext/patches/april_2012/__init__.py diff --git a/erpnext/patches/april_2012/__init__.py b/erpnext/patches/april_2012/__init__.py new file mode 100644 index 0000000000..e69de29bb2