From 55fd5f3ed6ba29e0c49c19c2833135cb0e56d3f2 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 26 Sep 2012 19:00:02 +0530 Subject: [PATCH] added voucher import tool --- accounts/doctype/lease_agreement/__init__.py | 1 - .../lease_agreement/lease_agreement.js | 94 ------ .../lease_agreement/lease_agreement.py | 54 ---- .../lease_agreement/lease_agreement.txt | 276 ------------------ .../doctype/lease_installment/__init__.py | 1 - .../lease_installment/lease_installment.txt | 86 ------ accounts/page/voucher_import_tool/__init__.py | 0 .../voucher_import_tool.js | 55 ++++ .../voucher_import_tool.py | 185 ++++++++++++ .../voucher_import_tool.txt | 28 ++ accounts/utils/__init__.py | 36 +-- .../september_2012/event_permission.py | 0 .../september_2012/reload_gross_profit.py | 0 .../september_2012/repost_stock.py | 0 utilities/page/users/users.js | 2 +- website/templates/html/outer.html | 2 +- 16 files changed, 281 insertions(+), 539 deletions(-) delete mode 100644 accounts/doctype/lease_agreement/__init__.py delete mode 100644 accounts/doctype/lease_agreement/lease_agreement.js delete mode 100644 accounts/doctype/lease_agreement/lease_agreement.py delete mode 100644 accounts/doctype/lease_agreement/lease_agreement.txt delete mode 100644 accounts/doctype/lease_installment/__init__.py delete mode 100644 accounts/doctype/lease_installment/lease_installment.txt create mode 100644 accounts/page/voucher_import_tool/__init__.py create mode 100644 accounts/page/voucher_import_tool/voucher_import_tool.js create mode 100644 accounts/page/voucher_import_tool/voucher_import_tool.py create mode 100644 accounts/page/voucher_import_tool/voucher_import_tool.txt rename {erpnext/patches => patches}/september_2012/event_permission.py (100%) rename {erpnext/patches => patches}/september_2012/reload_gross_profit.py (100%) rename {erpnext/patches => patches}/september_2012/repost_stock.py (100%) diff --git a/accounts/doctype/lease_agreement/__init__.py b/accounts/doctype/lease_agreement/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/accounts/doctype/lease_agreement/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/accounts/doctype/lease_agreement/lease_agreement.js b/accounts/doctype/lease_agreement/lease_agreement.js deleted file mode 100644 index bf0495c52b..0000000000 --- a/accounts/doctype/lease_agreement/lease_agreement.js +++ /dev/null @@ -1,94 +0,0 @@ -// ERPNext - web based ERP (http://erpnext.com) -// Copyright (C) 2012 Web Notes Technologies Pvt Ltd -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -$.extend(cur_frm.cscript, { - Generate: function(doc, dt, dn) { - if(doc.installment_amount==''){ - msgprint('Set Installment Amount before generating schedule'); - return; - } - if(doc.no_of_installments==''){ - msgprint('Set Number of Installments before generating schedule'); - return; - } - if(doc.start_date==''){ - msgprint('Set Start Date before generating schedule'); - return; - } - cur_frm.cscript.clear_installments(doc); - tot=0;i=0; - while(tot. - -from __future__ import unicode_literals -import webnotes -from webnotes.model.doc import make_autoname, Document, addchild -from webnotes import msgprint -from webnotes.utils import get_defaults -import json -from accounts.utils import post_jv -sql = webnotes.conn.sql - -class DocType: - def __init__(self, doc, doclist): - self.doc, self.doclist = doc, doclist - - def autoname(self): - """ - Create Lease Id using naming_series pattern - """ - self.doc.name = make_autoname(self.doc.naming_series+ '.#####') - - def lease_installment_post(self, args): - """ - Posts the Installment receipt into Journal Voucher - """ - next_inst = sql("select amount,name from `tabLease Installment` where parent=%s and ifnull(cheque_number,'')='' order by due_date limit 1",self.doc.name) - - data = json.loads(args) - data['voucher_type']='Lease Receipt' - data['naming_series']='JV' - data['amount']=next_inst[0][0] - data['debit_account']=data.get('bank_account') - data['credit_account']=self.doc.account - data['fiscal_year']=get_defaults()['fiscal_year'] - data['company']=get_defaults()['company'] - jv_name=post_jv(data) - - sql("update `tabLease Installment` set cheque_number=%s, cheque_date=%s, jv_number=%s where name=%s",(data.get('cheque_number'),data.get('cheque_date'),jv_name,next_inst[0][1])) - - self.doclist = [Document(d.doctype, d.name) for d in self.doclist] diff --git a/accounts/doctype/lease_agreement/lease_agreement.txt b/accounts/doctype/lease_agreement/lease_agreement.txt deleted file mode 100644 index c4f3e12cb6..0000000000 --- a/accounts/doctype/lease_agreement/lease_agreement.txt +++ /dev/null @@ -1,276 +0,0 @@ -# DocType, Lease Agreement -[ - - # These values are common in all dictionaries - { - 'creation': '2012-03-27 14:35:44', - 'docstatus': 0, - 'modified': '2012-03-27 14:35:44', - 'modified_by': u'Administrator', - 'owner': u'Administrator' - }, - - # These values are common for all DocType - { - '_last_update': u'1311555967', - 'colour': u'White:FFF', - 'default_print_format': u'Standard', - 'doctype': 'DocType', - 'module': u'Accounts', - 'name': '__common__', - 'section_style': u'Simple', - 'show_in_menu': 0, - 'version': 24 - }, - - # These values are common for all DocField - { - 'doctype': u'DocField', - 'name': '__common__', - 'parent': u'Lease Agreement', - 'parentfield': u'fields', - 'parenttype': u'DocType' - }, - - # These values are common for all DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'name': '__common__', - 'parent': u'Lease Agreement', - 'parentfield': u'permissions', - 'parenttype': u'DocType', - 'read': 1, - 'role': u'Accounts Manager' - }, - - # DocType, Lease Agreement - { - 'doctype': 'DocType', - 'name': u'Lease Agreement' - }, - - # DocPerm - { - 'amend': 1, - 'cancel': 1, - 'doctype': u'DocPerm', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'doctype': u'DocPerm', - 'submit': 0, - 'write': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'naming_series', - 'fieldtype': u'Select', - 'label': u'Naming Series', - 'no_copy': 1, - 'options': u'\nLA', - 'permlevel': 0, - 'reqd': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'lessee_info', - 'fieldtype': u'Section Break', - 'label': u'Lessee Info.', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'account', - 'fieldtype': u'Link', - 'label': u'Account', - 'options': u'Account', - 'permlevel': 0, - 'reqd': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'lessee_father', - 'fieldtype': u'Data', - 'label': u'Lessee Father', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'lessee_nic', - 'fieldtype': u'Data', - 'label': u'Lessee NIC', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'lessee_contact', - 'fieldtype': u'Data', - 'label': u'Lessee Contact', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'lessee_address', - 'fieldtype': u'Text', - 'label': u'Lessee Address', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'vehicle_info', - 'fieldtype': u'Section Break', - 'label': u'Vehicle Info.', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'model_no', - 'fieldtype': u'Data', - 'label': u'Model No', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'engine_no', - 'fieldtype': u'Data', - 'label': u'Engine No', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'chassis_no', - 'fieldtype': u'Data', - 'label': u'Chassis No', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'invoice_and_payment_info', - 'fieldtype': u'Section Break', - 'label': u'Invoice and Payment Info.', - 'permlevel': 0 - }, - - # DocField - { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'invoice', - 'fieldtype': u'Link', - 'label': u'Invoice', - 'options': u'Sales Invoice', - 'permlevel': 0, - 'reqd': 1, - 'trigger': u'Client' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'invoice_amount', - 'fieldtype': u'Currency', - 'label': u'Invoice Amount', - 'permlevel': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'down_payment', - 'fieldtype': u'Currency', - 'label': u'Down Payment', - 'permlevel': 0, - 'reqd': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'start_date', - 'fieldtype': u'Date', - 'label': u'Start Date', - 'permlevel': 0, - 'reqd': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'no_of_installments', - 'fieldtype': u'Int', - 'label': u'No of Installments', - 'permlevel': 0, - 'reqd': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'installment_amount', - 'fieldtype': u'Currency', - 'label': u'Installment Amount', - 'permlevel': 0 - }, - - # DocField - { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'generate', - 'fieldtype': u'Button', - 'label': u'Generate', - 'permlevel': 0, - 'trigger': u'Client' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'installments', - 'fieldtype': u'Table', - 'label': u'Installments', - 'options': u'Lease Installment', - 'permlevel': 0 - }, - - # DocField - { - 'allow_on_submit': 1, - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'installment_reciept', - 'fieldtype': u'Button', - 'label': u'Installment Reciept', - 'permlevel': 0 - } -] \ No newline at end of file diff --git a/accounts/doctype/lease_installment/__init__.py b/accounts/doctype/lease_installment/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/accounts/doctype/lease_installment/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/accounts/doctype/lease_installment/lease_installment.txt b/accounts/doctype/lease_installment/lease_installment.txt deleted file mode 100644 index 475d22626d..0000000000 --- a/accounts/doctype/lease_installment/lease_installment.txt +++ /dev/null @@ -1,86 +0,0 @@ -# DocType, Lease Installment -[ - - # These values are common in all dictionaries - { - 'creation': '2012-03-27 14:35:44', - 'docstatus': 0, - 'modified': '2012-03-27 14:35:44', - 'modified_by': u'Administrator', - 'owner': u'Administrator' - }, - - # These values are common for all DocType - { - 'colour': u'White:FFF', - 'doctype': 'DocType', - 'istable': 1, - 'module': u'Accounts', - 'name': '__common__', - 'section_style': u'Simple', - 'show_in_menu': 0, - 'version': 5 - }, - - # These values are common for all DocField - { - 'doctype': u'DocField', - 'name': '__common__', - 'parent': u'Lease Installment', - 'parentfield': u'fields', - 'parenttype': u'DocType' - }, - - # DocType, Lease Installment - { - 'doctype': 'DocType', - 'name': u'Lease Installment' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'amount', - 'fieldtype': u'Currency', - 'label': u'Amount', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'due_date', - 'fieldtype': u'Date', - 'label': u'Due Date', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'cheque_number', - 'fieldtype': u'Data', - 'label': u'Cheque Number', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'cheque_date', - 'fieldtype': u'Date', - 'label': u'Cheque Date', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'jv_number', - 'fieldtype': u'Link', - 'hidden': 0, - 'label': u'JV Number', - 'options': u'Journal Voucher', - 'permlevel': 1 - } -] \ No newline at end of file diff --git a/accounts/page/voucher_import_tool/__init__.py b/accounts/page/voucher_import_tool/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/accounts/page/voucher_import_tool/voucher_import_tool.js b/accounts/page/voucher_import_tool/voucher_import_tool.js new file mode 100644 index 0000000000..4b9e3f7b03 --- /dev/null +++ b/accounts/page/voucher_import_tool/voucher_import_tool.js @@ -0,0 +1,55 @@ +wn.pages['voucher-import-tool'].onload = function(wrapper) { + wn.ui.make_app_page({ + parent: wrapper, + title: 'Voucher Import Tool', + single_column: true + }); + + $(wrapper).find('.layout-main').html('\ +

Import multiple accounting entries via CSV (spreadsheet) file:

\ +

1. Download Template


\ +
\ + \ +

Import multiple vouchers with one debit and one credit entry

\ +
\ +
\ +

2. Upload


\ +
\ +

Upload file in CSV format with UTF-8 encoding

\ +
\ +

\ +
\ + '); + + wn.upload.make({ + parent: $(wrapper).find("#voucher-upload"), + args: { + method: "accounts.page.voucher_import_tool.voucher_import_tool.upload" + }, + callback: function(r) { + wrapper.waiting.toggle(false); + $(wrapper).find(".messages").toggle(true).html( + r.join("
")) + } + }); + + wrapper.waiting = wn.messages.waiting($(wrapper).find('.working'), + "Importing Vouchers...").toggle(false); + + $(wrapper).find(".btn-download-single").click(function() { + window.location.href = wn.request.url + + '?cmd=accounts.page.voucher_import_tool.voucher_import_tool.get_template_single'; + }); + + $(wrapper).find(".btn-download-multiple").click(function() { + window.location.href = wn.request.url + + '?cmd=accounts.page.voucher_import_tool.voucher_import_tool.get_template_multiple'; + }); + + // rename button + $(wrapper).find('#voucher-upload form input[type="submit"]') + .click(function() { + $(wrapper).find(".messages").toggle(false); + wrapper.waiting.toggle(true); + }); +} \ No newline at end of file diff --git a/accounts/page/voucher_import_tool/voucher_import_tool.py b/accounts/page/voucher_import_tool/voucher_import_tool.py new file mode 100644 index 0000000000..1cbeb998d2 --- /dev/null +++ b/accounts/page/voucher_import_tool/voucher_import_tool.py @@ -0,0 +1,185 @@ +import webnotes +from webnotes.utils import formatdate + +@webnotes.whitelist() +def get_template_multiple(): + """download single template""" + from webnotes.model.doctype import get_field_property + naming_options = get_field_property("Journal Voucher", "naming_series", "options") + voucher_type = get_field_property("Journal Voucher", "voucher_type", "options") + + webnotes.response['result'] = '''"Voucher Import :Multiple" +"Each entry below will be a separate Journal Voucher." +"Note:" +"1. Dates in format: %(user_fmt)s" +"2. Cost Center is required for Income or Expense accounts" +"3. Naming Series Options: %(naming_options)s" +"4. Voucher Type Options: %(voucher_type)s" +"-------Common Values-----------" +"Company:","%(default_company)s" +"--------Data----------" +"Naming Series","Voucher Type","Posting Date","Amount","Debit Account","Credit Account","Cost Center","Against Sales Invoice","Against Purchase Invoice","Against Journal Voucher","Remarks","Due Date","Ref Number","Ref Date" +''' % { + "user_fmt": webnotes.conn.get_value('Control Panel', None, 'date_format'), + "default_company": webnotes.conn.get_default("company"), + "naming_options": naming_options.replace("\n", ", "), + "voucher_type": voucher_type.replace("\n", ", ") + } + webnotes.response['type'] = 'csv' + webnotes.response['doctype'] = "Voucher-Import-Single" + +@webnotes.whitelist() +def upload(): + from webnotes.utils.datautils import read_csv_content_from_uploaded_file + rows = read_csv_content_from_uploaded_file() + + common_values = get_common_values(rows) + data = get_data(rows) + + if rows[0][0]=="Voucher Import :Single": + return import_single(common_values, data) + else: + return import_multiple(common_values, data) + +def map_fields(field_list, source, target): + for f in field_list: + if ":" in f: + target[f.split(":")[1]] = source.get(f.split(":")[0]) + else: + target[f] = source.get(f) + +def import_multiple(common_values, data): + from webnotes.model.doc import Document + from webnotes.model.doclist import DocList + from webnotes.model.code import get_obj + from accounts.utils import get_fiscal_year_from_date + from webnotes.utils.dateutils import user_to_str + + messages = [] + + def get_account_details(account): + acc_details = webnotes.conn.sql("""select is_pl_account, + master_name from tabAccount where name=%s""", account, as_dict=1) + if not acc_details: + webnotes.msgprint("%s is not an Account" % account, raise_exception=1) + return acc_details[0] + + def apply_cost_center_and_against_invoice(detail, d): + account = get_account_details(detail.account) + + if account.is_pl_account=="Yes": + detail.cost_center = d.cost_center + + if account.master_name: + map_fields(["against_sales_invoice:against_invoice", + "against_purhase_invoice:against_voucher", + "against_journal_voucher:against_jv"], d, detail.fields) + + webnotes.conn.commit() + + for i in xrange(len(data)): + d = data[i] + jv = webnotes.DictObj() + webnotes.message_log = [] + try: + d.posting_date = user_to_str(d.posting_date) + d.due_date = user_to_str(d.due_date) + d.ref_date = user_to_str(d.ref_date) + d.company = common_values.company + + jv = Document("Journal Voucher") + map_fields(["voucher_type", "posting_date", "naming_series", "remarks:remark", + "ref_no:cheque_no", "ref_date:cheque_date", "is_opening", + "amount:total_debit", "amount:total_credit", "due_date", "company"], d, jv.fields) + + jv.fiscal_year = get_fiscal_year_from_date(jv.posting_date) + + detail1 = Document("Journal Voucher Detail") + detail1.parent = True + detail1.parentfield = "entries" + map_fields(["debit_account:account","amount:debit"], d, detail1.fields) + apply_cost_center_and_against_invoice(detail1, d) + + + detail2 = Document("Journal Voucher Detail") + detail2.parent = True + detail2.parentfield = "entries" + map_fields(["credit_account:account","amount:credit"], d, detail2.fields) + apply_cost_center_and_against_invoice(detail2, d) + + webnotes.conn.begin() + doclist = DocList([jv, detail1, detail2]) + doclist.submit() + webnotes.conn.commit() + + messages.append("

[row #%s] %s imported

" \ + % (i, jv.name)) + + except Exception, e: + webnotes.conn.rollback() + messages.append("

[row #%s] %s failed: %s

" \ + % (i, jv.name, webnotes.message_log and webnotes.message_log[0] or "No message")) + webnotes.errprint(webnotes.getTraceback()) + + webnotes.message_log = [] + + return messages + +def get_common_values(rows): + start = False + common_values = webnotes.DictObj() + + for r in rows: + if start: + if r[0].startswith("---"): + break + common_values[r[0][:-1].replace(" ", "_").lower()] = r[1] + if r[0]=="-------Common Values-----------": + start = True + + return common_values + +def get_data(rows): + start_row = 0 + data = [] + + for i in xrange(len(rows)): + r = rows[i] + if r[0]: + if start_row and i >= start_row: + d = webnotes.DictObj() + for cidx in xrange(len(columns)): + d[columns[cidx]] = r[cidx] + data.append(d) + + if r[0]=="--------Data----------": + start_row = i+2 + columns = [c.replace(" ", "_").lower() for c in rows[i+1]] + + return data + +@webnotes.whitelist() +def get_template_single(): + """download single template""" + + webnotes.response['result'] = '''"Voucher Import :Single" +"All entries below will be uploaded in one Journal Voucher." +"Enter details below:" +"-------Common Values-----------" +"Voucher Series:", +"Voucher Type:", +"Posting Date:","%(posting_date)s" +"Remarks:", +"Is Opening:","No" +"Company:","%(default_company)s" +"------------------" +"Enter rows below headings:" +"Cost Center is required for Income or Expense accounts" +"--------Data----------" +"Account","Cost Center","Debit Amount","Credit Amount","Against Sales Invoice","Against Purchase Invoice","Against Journal Voucher" +''' % { + "posting_date": formatdate(), + "default_company": webnotes.conn.get_default("company") + } + webnotes.response['type'] = 'csv' + webnotes.response['doctype'] = "Voucher-Import-Single" diff --git a/accounts/page/voucher_import_tool/voucher_import_tool.txt b/accounts/page/voucher_import_tool/voucher_import_tool.txt new file mode 100644 index 0000000000..658ef00524 --- /dev/null +++ b/accounts/page/voucher_import_tool/voucher_import_tool.txt @@ -0,0 +1,28 @@ +# Page, voucher-import-tool +[ + + # These values are common in all dictionaries + { + u'creation': '2012-09-26 15:21:57', + u'docstatus': 0, + u'modified': '2012-09-26 15:21:57', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Page + { + u'doctype': u'Page', + 'module': u'Accounts', + u'name': u'__common__', + 'page_name': u'voucher-import-tool', + 'standard': u'Yes', + 'title': u'Voucher Import Tool' + }, + + # Page, voucher-import-tool + { + u'doctype': u'Page', + u'name': u'voucher-import-tool' + } +] \ No newline at end of file diff --git a/accounts/utils/__init__.py b/accounts/utils/__init__.py index 05d2391f2a..3dbc728ad9 100644 --- a/accounts/utils/__init__.py +++ b/accounts/utils/__init__.py @@ -15,30 +15,16 @@ # along with this program. If not, see . from __future__ import unicode_literals -from webnotes.model.doc import make_autoname, Document, addchild -# Posts JV -def post_jv(data): - jv = Document('Journal Voucher') - jv.voucher_type = data.get('voucher_type') - jv.naming_series = data.get('naming_series') - jv.voucher_date = data.get('cheque_date') - jv.posting_date = data.get('cheque_date') - jv.cheque_no = data.get('cheque_number') - jv.cheque_date = data.get('cheque_date') - jv.fiscal_year = data.get('fiscal_year') # To be modified to take care - jv.company = data.get('company') +import webnotes - jv.save(1) - - jc = addchild(jv,'entries','Journal Voucher Detail',0) - jc.account = data.get('debit_account') - jc.debit = data.get('amount') - jc.save() - - jc = addchild(jv,'entries','Journal Voucher Detail',0) - jc.account = data.get('credit_account') - jc.credit = data.get('amount') - jc.save() - - return jv.name \ No newline at end of file +def get_fiscal_year_from_date(date): + from webnotes.utils import formatdate + fy = webnotes.conn.sql("""select name from `tabFiscal Year` + where %s between year_start_date and adddate(year_start_date, + interval 1 year)""", date) + + if not fy: + webnotes.msgprint("""%s not in any Fiscal Year""" % formatdate(date), raise_exception=1) + + return fy[0][0] \ No newline at end of file diff --git a/erpnext/patches/september_2012/event_permission.py b/patches/september_2012/event_permission.py similarity index 100% rename from erpnext/patches/september_2012/event_permission.py rename to patches/september_2012/event_permission.py diff --git a/erpnext/patches/september_2012/reload_gross_profit.py b/patches/september_2012/reload_gross_profit.py similarity index 100% rename from erpnext/patches/september_2012/reload_gross_profit.py rename to patches/september_2012/reload_gross_profit.py diff --git a/erpnext/patches/september_2012/repost_stock.py b/patches/september_2012/repost_stock.py similarity index 100% rename from erpnext/patches/september_2012/repost_stock.py rename to patches/september_2012/repost_stock.py diff --git a/utilities/page/users/users.js b/utilities/page/users/users.js index ee05001edf..7f92609906 100644 --- a/utilities/page/users/users.js +++ b/utilities/page/users/users.js @@ -95,7 +95,7 @@ $.extend(wn.pages.users, { if(data.file_list) { data.imgsrc = 'files/' + data.file_list.split('\n')[0].split(',')[1]; } else { - data.imgsrc = 'images/lib/ui/no_img_' + (data.gender=='Female' ? 'f' : 'm') + '.gif'; + data.imgsrc = 'lib/images/ui/no_img_' + (data.gender=='Female' ? 'f' : 'm') + '.gif'; } data.fullname = wn.user_info(data.name).fullname; data.delete_html = ''; diff --git a/website/templates/html/outer.html b/website/templates/html/outer.html index a671d985d1..1a036f04f8 100644 --- a/website/templates/html/outer.html +++ b/website/templates/html/outer.html @@ -45,7 +45,7 @@ {% endif %} {% endfor %} - +