diff --git a/data/master.sql.gz b/data/master.sql.gz
index f3eaf3488a8..9f2ed7f0d47 100644
Binary files a/data/master.sql.gz and b/data/master.sql.gz differ
diff --git a/erpnext/accounts/Module Def/Accounts/Accounts.txt b/erpnext/accounts/Module Def/Accounts/Accounts.txt
index 0a6921a13c2..f9c36c823f9 100644
--- a/erpnext/accounts/Module Def/Accounts/Accounts.txt
+++ b/erpnext/accounts/Module Def/Accounts/Accounts.txt
@@ -5,7 +5,7 @@
{
'creation': '2010-09-25 10:50:37',
'docstatus': 0,
- 'modified': '2011-09-27 12:44:04',
+ 'modified': '2011-12-07 16:18:28',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -179,6 +179,15 @@
'doctype': 'Module Def Item'
},
+ # Module Def Item
+ {
+ 'description': 'Track C-Form received from customers',
+ 'display_name': 'C-Form',
+ 'doc_name': 'C-Form',
+ 'doc_type': 'Setup Forms',
+ 'doctype': 'Module Def Item'
+ },
+
# Module Def Item
{
'display_name': 'General Ledger',
diff --git a/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt b/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt
index 2fed0c4d9cf..d6255d71e7b 100644
--- a/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt
+++ b/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2011-11-15 17:30:44',
+ 'creation': '2011-12-13 11:02:59',
'docstatus': 0,
- 'modified': '2011-11-16 13:46:05',
+ 'modified': '2011-12-13 13:31:22',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -14,7 +14,7 @@
{
'doc_type': 'Receivable Voucher',
'doctype': 'Print Format',
- 'html': '\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n\t\n\t\n
\n\n\t\n\t\n
\n\n',
+ 'html': '\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n
\n\n\t\n\t\n
\n\n\t\n\t\n
\n',
'module': 'Accounts',
'name': '__common__',
'standard': 'Yes'
diff --git a/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt b/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt
index ea8a9110829..f7d2c6b3870 100644
--- a/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt
+++ b/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2011-11-15 17:30:44',
+ 'creation': '2011-12-13 11:02:59',
'docstatus': 0,
- 'modified': '2011-11-16 13:44:58',
+ 'modified': '2011-12-13 13:37:39',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -14,7 +14,7 @@
{
'doc_type': 'Receivable Voucher',
'doctype': 'Print Format',
- 'html': '\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n
\n\n\t\n\t\n
\n\n\t\n\t\n
\n\n',
+ 'html': '\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n
\n\n\t\n\t\n
\n\n\t\n\t\n
\n',
'module': 'Accounts',
'name': '__common__',
'standard': 'Yes'
diff --git a/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt b/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt
index d466b73be0c..c24cde54648 100644
--- a/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt
+++ b/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2011-11-15 17:30:44',
+ 'creation': '2011-12-13 11:02:59',
'docstatus': 0,
- 'modified': '2011-11-16 14:45:46',
+ 'modified': '2011-12-13 13:39:55',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -14,7 +14,7 @@
{
'doc_type': 'Receivable Voucher',
'doctype': 'Print Format',
- 'html': '\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n
\n\n\t\n\t\n
\n\n\t\n\t\n
\n\n\n',
+ 'html': '\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n
\n\n\t\n\t\n
\n\n\t\n\t\n
\n',
'module': 'Accounts',
'name': '__common__',
'standard': 'Yes'
diff --git a/erpnext/accounts/doctype/c_form/__init__.py b/erpnext/accounts/doctype/c_form/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/erpnext/accounts/doctype/c_form/c_form.js b/erpnext/accounts/doctype/c_form/c_form.js
new file mode 100644
index 00000000000..6629de6f3bf
--- /dev/null
+++ b/erpnext/accounts/doctype/c_form/c_form.js
@@ -0,0 +1,10 @@
+//c-form js file
+// -----------------------------
+cur_frm.fields_dict.invoice_details.grid.get_field("invoice_no").get_query = function(doc) {
+ return 'SELECT `tabReceivable Voucher`.`name` FROM `tabReceivable Voucher` WHERE `tabReceivable Voucher`.`company` = "' +doc.company+'" AND `tabReceivable Voucher`.%(key)s LIKE "%s" AND `tabReceivable Voucher`.`customer` = "' + doc.customer + '" AND `tabReceivable Voucher`.`docstatus` = 1 and `tabReceivable Voucher`.`c_form_applicable` = "Yes" and ifnull(`tabReceivable Voucher`.c_form_no, "") = "" ORDER BY `tabReceivable Voucher`.`name` ASC LIMIT 50';
+}
+
+cur_frm.cscript.invoice_no = function(doc, cdt, cdn) {
+ var d = locals[cdt][cdn];
+ get_server_fields('get_invoice_details', d.invoice_no, 'invoice_details', doc, cdt, cdn, 1);
+}
diff --git a/erpnext/accounts/doctype/c_form/c_form.py b/erpnext/accounts/doctype/c_form/c_form.py
new file mode 100644
index 00000000000..7228f11a4fc
--- /dev/null
+++ b/erpnext/accounts/doctype/c_form/c_form.py
@@ -0,0 +1,61 @@
+# Please edit this list and import only required elements
+import webnotes
+from webnotes.utils import add_days, cint, cstr, date_diff, default_fields, flt, getdate, now, nowdate
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj
+from webnotes import msgprint, errprint
+
+sql = webnotes.conn.sql
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+ def __init__(self,d,dl):
+ self.doc, self.doclist = d,dl
+
+ def autoname(self):
+ self.doc.name = make_autoname(self.doc.naming_series + '.#####')
+
+
+ def on_update(self):
+ """ Update C-Form No on invoices"""
+
+ if len(getlist(self.doclist, 'invoice_details')):
+ inv = "'" + "', '".join([d.invoice_no for d in getlist(self.doclist, 'invoice_details')]) + "'"
+ sql("""update `tabReceivable Voucher` set c_form_no = '%s', modified ='%s'
+ where name in (%s)"""%(self.doc.name, self.doc.modified, inv))
+ sql("""update `tabReceivable Voucher` set c_form_no = '', modified = %s where name not
+ in (%s) and ifnull(c_form_no, '') = %s""", (self.doc.modified, self.doc.name, inv))
+ else:
+ msgprint("Please enter atleast 1 invoice in the table below", raise_exception=1)
+
+
+ def get_invoice_details(self, invoice_no):
+ """ Pull details from invoices for referrence """
+
+ inv = sql("""select posting_date, territory, net_total, grand_total from
+ `tabReceivable Voucher` where name = %s""", invoice_no)
+ ret = {
+ 'invoice_date' : inv and getdate(inv[0][0]).strftime('%Y-%m-%d') or '',
+ 'territory' : inv and inv[0][1] or '',
+ 'net_total' : inv and flt(inv[0][2]) or '',
+ 'grand_total' : inv and flt(inv[0][3]) or ''
+ }
+ return ret
+
+
+ def validate_invoice(self):
+ """Validate invoice that c-form is applicable and no other c-form is
+ received for that"""
+
+ for d in getlist(self.doclist, 'invoice_details'):
+ inv = sql("""select c_form_applicable, c_form_no from
+ `tabReceivable Voucher` where name = %s""", invoice_no)
+ if not inv:
+ msgprint("Invoice: %s is not exists in the system, please check." % d.invoice_no, raise_exception=1)
+ elif inv[0][0] != 'Yes':
+ msgprint("C-form is not applicable for Invoice: %s" % d.invoice_no, raise_exception=1)
+ elif inv[0][1] and inv[0][1] != self.doc.name:
+ msgprint("""Invoice %s is tagged in another C-form: %s. \nIf you want to change C-form no for this invoice,
+ please remove invoice no from the previous c-form and then try again""" % (d.invoice_no, inv[0][1]), raise_exception=1)
diff --git a/erpnext/accounts/doctype/c_form/c_form.txt b/erpnext/accounts/doctype/c_form/c_form.txt
new file mode 100644
index 00000000000..987bc9a7b37
--- /dev/null
+++ b/erpnext/accounts/doctype/c_form/c_form.txt
@@ -0,0 +1,190 @@
+# DocType, C-Form
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2011-12-07 16:16:16',
+ 'docstatus': 0,
+ 'modified': '2011-12-07 17:50:17',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ '_last_update': '1323255350',
+ 'colour': 'White:FFF',
+ 'doctype': 'DocType',
+ 'module': 'Accounts',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 11
+ },
+
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'C-Form',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType',
+ 'permlevel': 0
+ },
+
+ # These values are common for all DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'name': '__common__',
+ 'parent': 'C-Form',
+ 'parentfield': 'permissions',
+ 'parenttype': 'DocType',
+ 'read': 1
+ },
+
+ # DocType, C-Form
+ {
+ 'doctype': 'DocType',
+ 'name': 'C-Form'
+ },
+
+ # DocPerm
+ {
+ 'create': 1,
+ 'doctype': 'DocPerm',
+ 'permlevel': 0,
+ 'role': 'Accounts User',
+ 'write': 1
+ },
+
+ # DocPerm
+ {
+ 'create': 1,
+ 'doctype': 'DocPerm',
+ 'permlevel': 0,
+ 'role': 'Accounts Manager',
+ 'submit': 0,
+ 'write': 1
+ },
+
+ # DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'permlevel': 1,
+ 'role': 'All'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Column Break',
+ 'width': '50%'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'naming_series',
+ 'fieldtype': 'Select',
+ 'label': 'Series',
+ 'options': '\nC-FORM/',
+ 'reqd': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'c_form_no',
+ 'fieldtype': 'Data',
+ 'label': 'C-Form No',
+ 'reqd': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'received_date',
+ 'fieldtype': 'Date',
+ 'label': 'Received Date',
+ 'reqd': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'customer',
+ 'fieldtype': 'Link',
+ 'label': 'Customer',
+ 'options': 'Customer',
+ 'reqd': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Column Break',
+ 'width': '50%'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'company',
+ 'fieldtype': 'Select',
+ 'label': 'Company',
+ 'options': 'link:Company'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'fiscal_year',
+ 'fieldtype': 'Select',
+ 'label': 'Fiscal Year',
+ 'options': 'link:Fiscal Year',
+ 'reqd': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'quarter',
+ 'fieldtype': 'Select',
+ 'label': 'Quarter',
+ 'options': '\nI\nII\nIII\nIV'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'total_amount',
+ 'fieldtype': 'Currency',
+ 'label': 'Total Amount',
+ 'reqd': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'state',
+ 'fieldtype': 'Select',
+ 'label': 'State',
+ 'options': "link:State\ncountry='India'",
+ 'reqd': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Section Break'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'invoice_details',
+ 'fieldtype': 'Table',
+ 'label': 'Invoice Details',
+ 'options': 'C-Form Invoice Detail'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/c_form_invoice_detail/__init__.py b/erpnext/accounts/doctype/c_form_invoice_detail/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.txt b/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.txt
new file mode 100644
index 00000000000..d6be6c0d4d3
--- /dev/null
+++ b/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.txt
@@ -0,0 +1,91 @@
+# DocType, C-Form Invoice Detail
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2011-12-07 16:15:39',
+ 'docstatus': 0,
+ 'modified': '2011-12-07 16:21:55',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocType',
+ 'istable': 1,
+ 'module': 'Accounts',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 0,
+ 'version': 5
+ },
+
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'name': '__common__',
+ 'parent': 'C-Form Invoice Detail',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType'
+ },
+
+ # DocType, C-Form Invoice Detail
+ {
+ 'doctype': 'DocType',
+ 'name': 'C-Form Invoice Detail'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'invoice_no',
+ 'fieldtype': 'Link',
+ 'label': 'Invoice No',
+ 'options': 'Receivable Voucher',
+ 'permlevel': 0,
+ 'width': '160px'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'invoice_date',
+ 'fieldtype': 'Date',
+ 'label': 'Invoice Date',
+ 'permlevel': 1,
+ 'width': '120px'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'territory',
+ 'fieldtype': 'Link',
+ 'label': 'Territory',
+ 'options': 'Territory',
+ 'permlevel': 1,
+ 'width': '120px'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'net_total',
+ 'fieldtype': 'Currency',
+ 'label': 'Net Total',
+ 'permlevel': 1,
+ 'width': '120px'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'grand_total',
+ 'fieldtype': 'Currency',
+ 'label': 'Grand Total',
+ 'permlevel': 1,
+ 'width': '120px'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/gl_control/gl_control.py b/erpnext/accounts/doctype/gl_control/gl_control.py
index 01f31eb7ddc..bab86267c15 100644
--- a/erpnext/accounts/doctype/gl_control/gl_control.py
+++ b/erpnext/accounts/doctype/gl_control/gl_control.py
@@ -515,6 +515,7 @@ def manage_recurring_invoices():
send_notification(new_rv)
+
def create_new_invoice(prev_rv):
# clone rv
new_rv = clone(prev_rv)
@@ -533,6 +534,61 @@ def create_new_invoice(prev_rv):
return new_rv
+
def send_notification(new_rv):
"""Notify concerned persons about recurring invoice generation"""
- pass
+ subject = "Invoice : " + new_rv.doc.name
+
+ com = new_rv.doc.company # get_value('Control Panel', '', 'letter_head')
+
+ hd = '''%s
+ Invoice: %s
+
+
+ Customer %s %s |
+ Invoice Date: %s Due Date: %s |
+
+
+ ''' % (com, new_rv.doc.name, new_rv.doc.customer, new_rv.doc.address_display, new_rv.doc.posting_date, new_rv.doc.due_date)
+
+
+ tbl = '''
+
+ | Item |
+ Description |
+ Qty |
+ Rate |
+ Amount |
+
+ '''
+ for d in getlist(new_rv.doclist, 'entries'):
+ tbl += '| ' + d.item_code +' | ' + d.description+' | ' + cstr(d.qty) +' | ' + cstr(d.basic_rate) +' | ' + cstr(d.amount) +' |
'
+ tbl += '
'
+
+ totals ='''
+
+ |
+
+
+
+ | Net Total: | %s |
+
+ | Total Tax: | %s |
+
+ | Grand Total: | %s |
+
+ | In Words: | %s |
+
+
+ |
+
+ | Terms: |
+ | %s |
+
+ ''' % (new_rv.doc.net_total, new_rv.doc.total_tax,new_rv.doc.grand_total, new_rv.doc.in_words,new_rv.doc.terms)
+
+
+ msg = hd + tbl + totals
+ from webnotes.utils.email_lib import sendmail
+ sendmail(recipients = [new_rv.doc.email_notification_address], \
+ sender=new_rv.doc.owner, subject=subject, parts=[['text/plain', msg]])
diff --git a/erpnext/accounts/doctype/payable_voucher/payable_voucher.js b/erpnext/accounts/doctype/payable_voucher/payable_voucher.js
index ca79387e3d3..41722d57f78 100644
--- a/erpnext/accounts/doctype/payable_voucher/payable_voucher.js
+++ b/erpnext/accounts/doctype/payable_voucher/payable_voucher.js
@@ -66,7 +66,7 @@ cur_frm.cscript.supplier = function(doc,dt,dn) {
get_server_fields('get_default_values', args, 'entries', doc, el[i].doctype, el[i].name, 1);
}
}
- cur_frm.cscript.calc_total(doc);
+ cur_frm.cscript.calc_amount(doc, 1);
}
if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1,callback);
diff --git a/erpnext/accounts/doctype/pv_detail/pv_detail.txt b/erpnext/accounts/doctype/pv_detail/pv_detail.txt
index f14b44b01e5..e1181b0bb32 100755
--- a/erpnext/accounts/doctype/pv_detail/pv_detail.txt
+++ b/erpnext/accounts/doctype/pv_detail/pv_detail.txt
@@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:17',
'docstatus': 0,
- 'modified': '2011-12-13 12:06:35',
+ 'modified': '2011-12-14 10:44:21',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -14,6 +14,7 @@
{
'autoname': 'EVD.######',
'colour': 'White:FFF',
+ 'default_print_format': 'Standard',
'doctype': 'DocType',
'istable': 1,
'module': 'Accounts',
@@ -21,7 +22,7 @@
'section_style': 'Tray',
'server_code_error': ' ',
'show_in_menu': 0,
- 'version': 39
+ 'version': 42
},
# These values are common for all DocField
@@ -70,18 +71,6 @@
'search_index': 0
},
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'brand',
- 'fieldtype': 'Data',
- 'label': 'Brand',
- 'oldfieldname': 'brand',
- 'oldfieldtype': 'Data',
- 'permlevel': 0,
- 'print_hide': 1
- },
-
# DocField
{
'doctype': 'DocField',
@@ -94,21 +83,6 @@
'width': '300px'
},
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'item_group',
- 'fieldtype': 'Link',
- 'in_filter': 1,
- 'label': 'Item Group',
- 'oldfieldname': 'item_group',
- 'oldfieldtype': 'Link',
- 'options': 'Item Group',
- 'permlevel': 1,
- 'print_hide': 1,
- 'search_index': 1
- },
-
# DocField
{
'doctype': 'DocField',
@@ -123,6 +97,52 @@
'trigger': 'Client'
},
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'import_ref_rate',
+ 'fieldtype': 'Currency',
+ 'label': 'Ref Rate ',
+ 'permlevel': 0,
+ 'trigger': 'Client'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'discount_rate',
+ 'fieldtype': 'Currency',
+ 'label': 'Discount %',
+ 'permlevel': 0,
+ 'trigger': 'Client'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'import_rate',
+ 'fieldtype': 'Currency',
+ 'label': 'Rate ',
+ 'oldfieldname': 'import_rate',
+ 'oldfieldtype': 'Currency',
+ 'permlevel': 0,
+ 'print_hide': 0,
+ 'reqd': 1,
+ 'trigger': 'Client'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'import_amount',
+ 'fieldtype': 'Currency',
+ 'label': 'Amount',
+ 'oldfieldname': 'import_amount',
+ 'oldfieldtype': 'Currency',
+ 'permlevel': 1,
+ 'reqd': 1
+ },
+
# DocField
{
'doctype': 'DocField',
@@ -160,52 +180,6 @@
'reqd': 1
},
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'discount_rate',
- 'fieldtype': 'Currency',
- 'label': 'Discount %',
- 'permlevel': 0,
- 'trigger': 'Client'
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'import_ref_rate',
- 'fieldtype': 'Currency',
- 'label': 'Ref Rate ',
- 'permlevel': 0,
- 'trigger': 'Client'
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'import_rate',
- 'fieldtype': 'Currency',
- 'label': 'Rate ',
- 'oldfieldname': 'import_rate',
- 'oldfieldtype': 'Currency',
- 'permlevel': 0,
- 'print_hide': 0,
- 'reqd': 1,
- 'trigger': 'Client'
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'import_amount',
- 'fieldtype': 'Currency',
- 'label': 'Amount',
- 'oldfieldname': 'import_amount',
- 'oldfieldtype': 'Currency',
- 'permlevel': 1,
- 'reqd': 1
- },
-
# DocField
{
'colour': 'White:FFF',
@@ -239,6 +213,46 @@
'width': '120px'
},
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocField',
+ 'fieldname': 'project_name',
+ 'fieldtype': 'Link',
+ 'in_filter': 1,
+ 'label': 'Project Name',
+ 'options': 'Project',
+ 'permlevel': 0,
+ 'print_hide': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'brand',
+ 'fieldtype': 'Data',
+ 'label': 'Brand',
+ 'oldfieldname': 'brand',
+ 'oldfieldtype': 'Data',
+ 'permlevel': 0,
+ 'print_hide': 1
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'item_group',
+ 'fieldtype': 'Link',
+ 'in_filter': 1,
+ 'label': 'Item Group',
+ 'oldfieldname': 'item_group',
+ 'oldfieldtype': 'Link',
+ 'options': 'Item Group',
+ 'permlevel': 1,
+ 'print_hide': 1,
+ 'search_index': 1
+ },
+
# DocField
{
'doctype': 'DocField',
diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js
index 363da2ec573..12b57d94546 100644
--- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js
+++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js
@@ -67,6 +67,12 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) {
}
}
}
+
+ // India related fields
+ var cp = locals['Control Panel']['Control Panel'];
+ if (cp.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']);
+ else hide_field(['c_form_applicable', 'c_form_no']);
+
}
diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py
index 13ed8d3c5e2..57d8c55facc 100644
--- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py
+++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py
@@ -397,6 +397,14 @@ class DocType(TransactionBase):
if flt(self.doc.write_off_amount) and not self.doc.write_off_account:
msgprint("Please enter Write Off Account", raise_exception=1)
+
+ def validate_c_form(self):
+ """ Blank C-form no if C-form applicable marked as 'No'"""
+ if self.doc.amended_from and self.doc.c_form_applicable == 'No' and self.doc.c_form_no:
+ sql("""delete from `tabC-Form Invoice Detail` where invoice_no = %s
+ and parent = %s""", (self.doc.amended_from, self.doc.c_form_no))
+
+ set(self.doc, 'c_form_no', '')
# VALIDATE
# ====================================================================================
@@ -432,6 +440,7 @@ class DocType(TransactionBase):
self.clear_advances()
# Set against account
self.set_against_income_account()
+ self.validate_c_form()
# *************************************************** ON SUBMIT **********************************************
@@ -554,10 +563,21 @@ class DocType(TransactionBase):
if not cint(self.doc.is_pos) == 1:
self.update_against_document_in_jv()
-
+
+ self.update_c_form()
+
# on submit notification
# get_obj('Notification Control').notify_contact('Sales Invoice', self.doc.doctype,self.doc.name, self.doc.email_id, self.doc.contact_person)
-
+
+
+ def update_c_form(self):
+ """Update amended id in C-form"""
+ if self.doc.c_form_no and self.doc.amended_from:
+ sql("""update `tabC-Form Invoice Detail` set invoice_no = %s,
+ invoice_date = %s, territory = %s, net_total = %s,
+ grand_total = %s where invoice_no = %s and parent = %s""", (self.doc.name, self.doc.amended_from, self.doc.c_form_no))
+
+
# *************************************************** ON CANCEL **********************************************
# Check Next Document's docstatus
diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt
index e2fc0c6416e..eedb01c5dd5 100644
--- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt
+++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt
@@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:18',
'docstatus': 0,
- 'modified': '2011-12-06 13:17:26',
+ 'modified': '2011-12-08 16:28:22',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -21,7 +21,7 @@
# These values are common for all DocType
{
- '_last_update': '1323156733',
+ '_last_update': '1323341785',
'change_log': '1. Change in pull_details method dt.-26-06-2009',
'colour': 'White:FFF',
'default_print_format': 'Standard',
@@ -34,7 +34,7 @@
'server_code_error': ' ',
'show_in_menu': 0,
'subject': 'To %(customer_name)s worth %(currency)s %(grand_total_export)s due on %(due_date)s | %(outstanding_amount)s outstanding',
- 'version': 383
+ 'version': 388
},
# These values are common for all DocFormat
@@ -971,6 +971,31 @@
'permlevel': 0
},
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'c_form_applicable',
+ 'fieldtype': 'Select',
+ 'label': 'C-Form Applicable',
+ 'no_copy': 1,
+ 'options': 'No\nYes',
+ 'permlevel': 0,
+ 'print_hide': 1,
+ 'report_hide': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'c_form_no',
+ 'fieldtype': 'Link',
+ 'label': 'C-Form No',
+ 'no_copy': 1,
+ 'options': 'C-Form',
+ 'permlevel': 1,
+ 'print_hide': 1
+ },
+
# DocField
{
'doctype': 'DocField',
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js
index 38acfc9dc29..2a2435b0ad3 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.js
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js
@@ -124,7 +124,7 @@ pscript.make_ac_tree = function() {
var imgsrc=null;
var has_children = true;
if(cl[i].group_or_ledger=='Ledger') {
- var imgsrc = 'images/icons/page.gif';
+ var imgsrc = 'lib/images/icons/page.gif';
has_children = false;
}
var t = tree.addNode(n, cl[i].account_name, imgsrc,tree.std_onclick, has_children ? tree.std_onexp : null);
@@ -137,7 +137,7 @@ pscript.make_ac_tree = function() {
var imgsrc=null;
var has_children = true;
if(cl[i].group_or_ledger=='Ledger') {
- var imgsrc = 'images/icons/page.gif';
+ var imgsrc = 'lib/images/icons/page.gif';
has_children = false;
}
var t = tree.addNode(n, cl[i].cost_center_name, imgsrc,tree.std_onclick, has_children ? tree.std_onexp : null);
@@ -254,7 +254,7 @@ pscript.make_group_area = function(type) {
// refresh
ref_btn = $a(pscript.group_area, 'div', '', {fontSize: '14px',marginBottom: '8px', marginTop: '24px', fontWeight: 'bold'});
- ref_btn.innerHTML = '
Refresh Tree';
+ ref_btn.innerHTML = '
Refresh Tree';
ref_btn.onclick= function() {
pscript.cur_node.clear_child_nodes();
pscript.cur_node.expand();
@@ -312,7 +312,7 @@ pscript.make_ledger_area = function() {
//General ledger report link
pscript.gl_rep = $a(pscript.ledger_area, 'div','', {fontSize: '14px',marginBottom: '8px', fontWeight: 'bold'});
- pscript.gl_rep.innerHTML = '
Open Ledger';
+ pscript.gl_rep.innerHTML = '
Open Ledger';
pscript.gl_rep.onclick = function(){ pscript.make_report('gl'); }
//Budget report link
diff --git a/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt b/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt
index bd10b2d3289..604d2d81788 100644
--- a/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt
+++ b/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2011-11-15 17:30:44',
+ 'creation': '2011-12-13 11:02:59',
'docstatus': 0,
- 'modified': '2011-11-15 17:30:44',
+ 'modified': '2011-12-13 13:51:41',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -14,7 +14,7 @@
{
'doc_type': 'Purchase Order',
'doctype': 'Print Format',
- 'html': '\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n
\n\n\t\n\t\n
\n\n\t\n\t\n
\n\n',
+ 'html': '\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n
\n\n\t\n\t\n
\n\n\t\n\t\n
\n',
'module': 'Buying',
'name': '__common__',
'standard': 'Yes'
diff --git a/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt b/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt
index 94c5a3f1d81..f5cafe43351 100644
--- a/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt
+++ b/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2011-11-15 17:30:45',
+ 'creation': '2011-12-13 11:02:59',
'docstatus': 0,
- 'modified': '2011-11-15 17:30:45',
+ 'modified': '2011-12-13 13:53:52',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -14,7 +14,7 @@
{
'doc_type': 'Purchase Order',
'doctype': 'Print Format',
- 'html': '\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n
\n\n\t\n\t\n
\n\n\t\n\t\n
\n\n',
+ 'html': '\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n
\n\n\t\n\t\n
\n\n\t\n\t\n
\n',
'module': 'Buying',
'name': '__common__',
'standard': 'Yes'
diff --git a/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt b/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt
index adb397ab807..70d6961f4d7 100644
--- a/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt
+++ b/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2011-11-15 17:30:45',
+ 'creation': '2011-12-13 11:02:59',
'docstatus': 0,
- 'modified': '2011-11-16 14:45:05',
+ 'modified': '2011-12-13 13:55:23',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -14,7 +14,7 @@
{
'doc_type': 'Purchase Order',
'doctype': 'Print Format',
- 'html': '\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n
\n\n\t\n\t\n
\n\n\t\n\t\n
\n\n\n',
+ 'html': '\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n
\n\n\t\n\t\n
\n\n\t\n\t\n
\n',
'module': 'Buying',
'name': '__common__',
'standard': 'Yes'
diff --git a/erpnext/buying/doctype/po_detail/po_detail.txt b/erpnext/buying/doctype/po_detail/po_detail.txt
index c8d831b8dc4..1512666b03f 100755
--- a/erpnext/buying/doctype/po_detail/po_detail.txt
+++ b/erpnext/buying/doctype/po_detail/po_detail.txt
@@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:12',
'docstatus': 0,
- 'modified': '2011-12-13 13:02:05',
+ 'modified': '2011-12-14 10:49:46',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@@ -14,6 +14,7 @@
{
'autoname': 'POD/.#####',
'colour': 'White:FFF',
+ 'default_print_format': 'Standard',
'doctype': 'DocType',
'istable': 1,
'module': 'Buying',
@@ -21,7 +22,7 @@
'section_style': 'Tray',
'server_code_error': ' ',
'show_in_menu': 0,
- 'version': 59
+ 'version': 60
},
# These values are common for all DocField
@@ -104,6 +105,7 @@
# DocField
{
+ 'default': '0.00',
'doctype': 'DocField',
'fieldname': 'qty',
'fieldtype': 'Currency',
@@ -119,40 +121,12 @@
# DocField
{
'doctype': 'DocField',
- 'fieldname': 'purchase_rate',
+ 'fieldname': 'import_ref_rate',
'fieldtype': 'Currency',
- 'label': 'Rate (Default Curr.) *',
- 'oldfieldname': 'purchase_rate',
- 'oldfieldtype': 'Currency',
- 'permlevel': 0,
- 'print_hide': 1,
- 'reqd': 1,
- 'trigger': 'Client',
- 'width': '100px'
- },
-
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'purchase_ref_rate',
- 'fieldtype': 'Currency',
- 'label': 'Ref Rate *',
+ 'label': 'Ref Rate ',
'permlevel': 0
},
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'amount',
- 'fieldtype': 'Currency',
- 'label': 'Amount (Default Curr.)',
- 'oldfieldname': 'amount',
- 'oldfieldtype': 'Currency',
- 'permlevel': 1,
- 'print_hide': 1,
- 'reqd': 1
- },
-
# DocField
{
'doctype': 'DocField',
@@ -177,15 +151,6 @@
'trigger': 'Client'
},
- # DocField
- {
- 'doctype': 'DocField',
- 'fieldname': 'import_ref_rate',
- 'fieldtype': 'Currency',
- 'label': 'Ref Rate ',
- 'permlevel': 0
- },
-
# DocField
{
'doctype': 'DocField',
@@ -200,19 +165,42 @@
# DocField
{
'doctype': 'DocField',
- 'fieldname': 'uom',
- 'fieldtype': 'Link',
- 'label': 'UOM',
- 'oldfieldname': 'uom',
- 'oldfieldtype': 'Link',
- 'options': 'UOM',
+ 'fieldname': 'purchase_ref_rate',
+ 'fieldtype': 'Currency',
+ 'label': 'Ref Rate *',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'default': '0.00',
+ 'doctype': 'DocField',
+ 'fieldname': 'purchase_rate',
+ 'fieldtype': 'Currency',
+ 'label': 'Rate (Default Curr.) *',
+ 'oldfieldname': 'purchase_rate',
+ 'oldfieldtype': 'Currency',
'permlevel': 0,
- 'print_hide': 0,
+ 'print_hide': 1,
'reqd': 1,
'trigger': 'Client',
'width': '100px'
},
+ # DocField
+ {
+ 'default': '0.00',
+ 'doctype': 'DocField',
+ 'fieldname': 'amount',
+ 'fieldtype': 'Currency',
+ 'label': 'Amount (Default Curr.)',
+ 'oldfieldname': 'amount',
+ 'oldfieldtype': 'Currency',
+ 'permlevel': 1,
+ 'print_hide': 1,
+ 'reqd': 1
+ },
+
# DocField
{
'doctype': 'DocField',
@@ -229,6 +217,35 @@
'trigger': 'Client'
},
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'project_name',
+ 'fieldtype': 'Link',
+ 'in_filter': 1,
+ 'label': 'Project Name',
+ 'options': 'Project',
+ 'permlevel': 0,
+ 'print_hide': 1,
+ 'report_hide': 0
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'uom',
+ 'fieldtype': 'Link',
+ 'label': 'UOM',
+ 'oldfieldname': 'uom',
+ 'oldfieldtype': 'Link',
+ 'options': 'UOM',
+ 'permlevel': 0,
+ 'print_hide': 0,
+ 'reqd': 1,
+ 'trigger': 'Client',
+ 'width': '100px'
+ },
+
# DocField
{
'colour': 'White:FFF',
@@ -246,21 +263,6 @@
'width': '100px'
},
- # DocField
- {
- 'colour': 'White:FFF',
- 'doctype': 'DocField',
- 'fieldname': 'prevdoc_doctype',
- 'fieldtype': 'Data',
- 'hidden': 1,
- 'label': 'Prevdoc DocType',
- 'no_copy': 0,
- 'oldfieldname': 'prevdoc_doctype',
- 'oldfieldtype': 'Data',
- 'permlevel': 1,
- 'print_hide': 1
- },
-
# DocField
{
'doctype': 'DocField',
@@ -276,6 +278,21 @@
'width': '100px'
},
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocField',
+ 'fieldname': 'prevdoc_doctype',
+ 'fieldtype': 'Data',
+ 'hidden': 1,
+ 'label': 'Prevdoc DocType',
+ 'no_copy': 0,
+ 'oldfieldname': 'prevdoc_doctype',
+ 'oldfieldtype': 'Data',
+ 'permlevel': 1,
+ 'print_hide': 1
+ },
+
# DocField
{
'colour': 'White:FFF',
@@ -359,6 +376,7 @@
# DocField
{
+ 'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'stock_qty',
'fieldtype': 'Currency',
@@ -367,7 +385,7 @@
'no_copy': 1,
'oldfieldname': 'stock_qty',
'oldfieldtype': 'Currency',
- 'permlevel': 0,
+ 'permlevel': 1,
'print_hide': 1,
'trigger': 'Client',
'width': '100px'
@@ -389,6 +407,7 @@
# DocField
{
+ 'default': '0.00',
'doctype': 'DocField',
'fieldname': 'billed_qty',
'fieldtype': 'Currency',
diff --git a/erpnext/buying/doctype/supplier/supplier.txt b/erpnext/buying/doctype/supplier/supplier.txt
index a7a08c3a07d..08348987f1d 100644
--- a/erpnext/buying/doctype/supplier/supplier.txt
+++ b/erpnext/buying/doctype/supplier/supplier.txt
@@ -333,4 +333,4 @@
'oldfieldtype': 'Small Text',
'permlevel': 1
}
-]
\ No newline at end of file
+]
diff --git a/erpnext/home/page/dashboard/dashboard.js b/erpnext/home/page/dashboard/dashboard.js
index 08be0af675c..aac42a3e3b8 100644
--- a/erpnext/home/page/dashboard/dashboard.js
+++ b/erpnext/home/page/dashboard/dashboard.js
@@ -10,8 +10,20 @@ pscript.onload_dashboard = function() {
pscript.dashboard_settings = {
company: sys_defaults.company,
- start: dateutil.obj_to_str(dateutil.add_days(new Date(), -180)),
- end: dateutil.obj_to_str(new Date()),
+ start: (function() {
+ var start_date = dateutil.add_days(new Date(), -180);
+ var year_start_date = dateutil.str_to_obj(sys_defaults.year_start_date);
+ if (start_date < year_start_date) { start_date = year_start_date; }
+ console.log(start_date);
+ return dateutil.obj_to_str(start_date);
+ })(),
+ end: (function() {
+ var end_date = new Date();
+ var year_end_date = dateutil.str_to_obj(sys_defaults.year_end_date);
+ if (end_date > year_end_date) { end_date = year_end_date; }
+ console.log(end_date);
+ return dateutil.obj_to_str(end_date);
+ })(),
interval: 30
}
diff --git a/erpnext/home/page/dashboard/dashboard.py b/erpnext/home/page/dashboard/dashboard.py
index 9ead6d688d5..c2378d3155e 100644
--- a/erpnext/home/page/dashboard/dashboard.py
+++ b/erpnext/home/page/dashboard/dashboard.py
@@ -133,19 +133,27 @@ class DashboardWidget:
webnotes.msgprint('Wrongly defined account: ' + acc)
print acc
raise e
-
- return self.glc.get_as_on_balance(acc, self.get_fiscal_year(start), start, debit_or_credit, lft, rgt)
+
+ fiscal_year = self.get_fiscal_year(start)
+ if fiscal_year:
+ return self.glc.get_as_on_balance(acc, fiscal_year, start, debit_or_credit, lft, rgt)
+ else:
+ webnotes.msgprint('Please select the START DATE and END DATE such that\
+ they fall within fiscal year(s) as defined in\
+ Setup > System > Fiscal Year.', raise_exception=1)
+
def get_fiscal_year(self, dt):
"""
get fiscal year from date
"""
import webnotes
- return webnotes.conn.sql("""
+ fiscal_year = webnotes.conn.sql("""
select name from `tabFiscal Year`
where year_start_date <= %s and
DATE_ADD(year_start_date, INTERVAL 1 YEAR) >= %s
- """, (dt, dt))[0][0]
+ """, (dt, dt))
+ return fiscal_year and (fiscal_year[0] and fiscal_year[0][0]) or None
def get_creation_trend(self, doctype, start, end):
"""
@@ -257,4 +265,4 @@ if __name__=='__main__':
"start": "2011-05-01",
"end": "2011-08-01",
"interval": "7"
- }""")
\ No newline at end of file
+ }""")
diff --git a/erpnext/home/page/my_company/my_company.js b/erpnext/home/page/my_company/my_company.js
index e88c45897c9..6a905501ebf 100644
--- a/erpnext/home/page/my_company/my_company.js
+++ b/erpnext/home/page/my_company/my_company.js
@@ -42,13 +42,48 @@ pscript.myc_show_erpnext_message = function() {
// Add user dialog and server call
//
pscript.myc_add_user = function() {
+ var fields = [{
+ fieldtype: 'Data',
+ fieldname: 'user',
+ reqd: 1,
+ label: 'Email Id of the user to add'
+ }];
+ console.log(pscript.is_erpnext_saas);
+
+ if(pscript.is_erpnext_saas==0) {
+ fields = fields.concat([
+ {
+ fieldtype: 'Data',
+ fieldname: 'first_name',
+ reqd: 1,
+ label: 'First Name'
+ },
+ {
+ fieldtype: 'Data',
+ fieldname: 'last_name',
+ reqd: 1,
+ label: 'Last Name'
+ },
+ {
+ fieldtype: 'Data',
+ fieldname: 'password',
+ reqd: 1,
+ label: 'Password'
+ }]);
+ }
+
+ fields.push({
+ fieldtype: 'Button',
+ label: 'Add',
+ fieldname: 'add'
+ });
+
+ console.log(fields);
+
var d = new wn.widgets.Dialog({
title: 'Add User',
width: 400,
- fields: [
- {fieldtype:'Data', fieldname:'user',reqd:1,label:'Email Id of the user to add'},
- {fieldtype:'Button', label:'Add', fieldname:'add'}
- ]
+ fields: fields
});
d.make();
d.fields_dict.add.input.onclick = function() {
diff --git a/erpnext/home/page/my_company/my_company.py b/erpnext/home/page/my_company/my_company.py
index c96d99871df..ad0089dc14e 100644
--- a/erpnext/home/page/my_company/my_company.py
+++ b/erpnext/home/page/my_company/my_company.py
@@ -57,14 +57,15 @@ def add_user(args):
from server_tools.gateway_utils import add_user_gateway
add_user_gateway(args['user'])
- add_profile(args['user'])
+ add_profile(args)
#
# add profile record
#
-def add_profile(email):
+def add_profile(args):
from webnotes.utils import validate_email_add
from webnotes.model.doc import Document
+ email = args['user']
sql = webnotes.conn.sql
@@ -83,9 +84,17 @@ def add_profile(email):
pr = Document('Profile')
pr.name = email
pr.email = email
- pr.enabled=1
- pr.user_type='System User'
- pr.save(1)
+ pr.first_name = args.get('first_name')
+ pr.last_name = args.get('last_name')
+ pr.enabled = 1
+ pr.user_type = 'System User'
+ pr.save(1)
+
+ if args.get('password'):
+ sql("""
+ UPDATE tabProfile
+ SET password = PASSWORD(%s)
+ WHERE name = %s""", (args.get('password'), email))
#
# post comment
diff --git a/erpnext/patches/Discount_purchase_cycle.py b/erpnext/patches/Discount_purchase_cycle.py
index 8c41d5dd27b..34fd49827fd 100755
--- a/erpnext/patches/Discount_purchase_cycle.py
+++ b/erpnext/patches/Discount_purchase_cycle.py
@@ -5,5 +5,10 @@ def execute():
reload_doc('accounts', 'doctype', 'pv_detail')
reload_doc('buying', 'doctype', 'po_detail')
reload_doc('stock', 'doctype', 'purchase_receipt_detail')
- if webnotes.conn.sql("select name from 'tabDocField` where parent = 'PO Detail' and fieldname = 'discount'"):
+ if webnotes.conn.sql("select name from `tabDocField` where parent = 'PO Detail' and fieldname = 'discount'"):
webnotes.conn.sql("update `tabPO Detail` set discount_rate=discount")
+
+ # Features setup
+ reload_doc('setup', 'doctype', 'features_setup')
+ from webnotes.model.code import get_obj
+ get_obj('Features Setup').validate()
diff --git a/erpnext/patches/c_form_patch.py b/erpnext/patches/c_form_patch.py
new file mode 100644
index 00000000000..0f8fa22d686
--- /dev/null
+++ b/erpnext/patches/c_form_patch.py
@@ -0,0 +1,12 @@
+def execute():
+ import webnotes
+ from webnotes.modules.module_manager import reload_doc
+
+ reload_doc('accounts', 'doctype', 'receivable_voucher')
+ reload_doc('accounts', 'doctype', 'c_form')
+ reload_doc('accounts', 'doctype', 'c_form_invoice_detail')
+ reload_doc('accounts', 'Module Def', 'Accounts')
+
+ sql = webnotes.conn.sql
+ sql("update `tabReceivable Voucher` set c_form_applicable = 'Yes' where c_form_applicable = 'Y'")
+ sql("update `tabReceivable Voucher` set c_form_applicable = 'No' where c_form_applicable = 'N'")
diff --git a/erpnext/patches/deploy_email_digest.py b/erpnext/patches/deploy_email_digest.py
new file mode 100644
index 00000000000..1dd97e32498
--- /dev/null
+++ b/erpnext/patches/deploy_email_digest.py
@@ -0,0 +1,75 @@
+import webnotes
+
+def execute():
+ """
+ * Reload email_digest doctype
+ * Create default email digest
+ """
+ from webnotes.modules.module_manager import reload_doc
+
+ # Minor fix in print_format doctype
+ #reload_doc('core', 'doctype', 'print_format')
+
+ reload_doc('setup', 'doctype', 'email_digest')
+
+ global create_default_email_digest
+ create_default_email_digest()
+
+
+def create_default_email_digest():
+ """
+ * Weekly Digest
+ * For all companies
+ * Recipients: System Managers
+ * Full content
+ * Disabled by default
+ """
+ from webnotes.model.doc import Document
+ companies_list = webnotes.conn.sql("SELECT company_name FROM `tabCompany`", as_list=1)
+ global get_system_managers
+ system_managers = get_system_managers()
+ for company in companies_list:
+ if company and company[0]:
+ edigest = Document('Email Digest')
+ edigest.name = "Default Weekly Digest - " + company[0]
+ edigest.company = company[0]
+ edigest.frequency = 'Weekly'
+ edigest.recipient_list = system_managers
+ edigest.new_leads = 1
+ edigest.new_enquiries = 1
+ edigest.new_quotations = 1
+ edigest.new_sales_orders = 1
+ edigest.new_purchase_orders = 1
+ edigest.new_transactions = 1
+ edigest.payables = 1
+ edigest.payments = 1
+ edigest.expenses_booked = 1
+ edigest.invoiced_amount = 1
+ edigest.collections = 1
+ edigest.income = 1
+ edigest.bank_balance = 1
+ exists = webnotes.conn.sql("""\
+ SELECT name FROM `tabEmail Digest`
+ WHERE name = %s""", edigest.name)
+ if (exists and exists[0]) and exists[0][0]:
+ continue
+ else:
+ edigest.save(1)
+
+
+def get_system_managers():
+ """
+ Returns a string of system managers' email addresses separated by \n
+ """
+ system_managers_list = webnotes.conn.sql("""\
+ SELECT DISTINCT p.name
+ FROM tabUserRole ur, tabProfile p
+ WHERE
+ ur.parent = p.name AND
+ ur.role='System Manager' AND
+ p.docstatus<2 AND
+ p.enabled=1 AND
+ p.name not in ('Administrator', 'Guest')""", as_list=1)
+
+ return "\n".join([sysman[0] for sysman in system_managers_list])
+
diff --git a/erpnext/patches/employeewise_balance_leave_report.py b/erpnext/patches/employeewise_balance_leave_report.py
index 6af236484ea..59c59408a1a 100644
--- a/erpnext/patches/employeewise_balance_leave_report.py
+++ b/erpnext/patches/employeewise_balance_leave_report.py
@@ -6,7 +6,9 @@
"""
def execute():
from webnotes.model.doc import Document
+ from webnotes.modules.module_manager import reload_doc
+ reload_doc('hr', 'search_criteria', 'employeewise_balance_leave_report')
d = Document('Search Criteria', 'employeewise_balance_leave_report')
d.criteria_name = 'Employee Leave Balance Report'
d.description = 'Employeewise Balance Leave Report'
- d.save()
\ No newline at end of file
+ d.save()
diff --git a/erpnext/patches/install_print_formats.py b/erpnext/patches/install_print_formats.py
index 3b5627bba06..40a008ecfc9 100644
--- a/erpnext/patches/install_print_formats.py
+++ b/erpnext/patches/install_print_formats.py
@@ -53,7 +53,7 @@ def execute():
Install print formats
"""
from webnotes.modules.module_manager import reload_doc
- #reload_doc('core', 'doctype', 'print_format')
+ reload_doc('core', 'doctype', 'print_format')
#copy_doctype_to_pfs()
global pf_to_install
diff --git a/erpnext/patches/patch.py b/erpnext/patches/patch.py
index 7e8a083d4db..4e32c02e2ce 100644
--- a/erpnext/patches/patch.py
+++ b/erpnext/patches/patch.py
@@ -6,6 +6,7 @@ last_patch = 388
#-------------------------------------------
def execute(patch_no):
+ return
import webnotes
from webnotes.modules.module_manager import reload_doc
diff --git a/erpnext/patches/print_formats/DeliveryNoteClassic.html b/erpnext/patches/print_formats/DeliveryNoteClassic.html
index 0db80b9daba..64475d64d48 100644
--- a/erpnext/patches/print_formats/DeliveryNoteClassic.html
+++ b/erpnext/patches/print_formats/DeliveryNoteClassic.html
@@ -112,16 +112,25 @@
null,
{
'description' : function(data_row) {
- if(data_row.serial_no) {
- return (
- data_row.description +
- 'Serial No.:' +
- ((data_row.serial_no.indexOf('\n')>-1)?'
':' ') +
- data_row.serial_no + '
'
- );
- } else {
- return data_row.description;
+ var to_append = ''
+ if(data_row.adj_rate){
+ to_append = 'Discount: ' +
+ data_row.adj_rate + '%
';
+ if(data_row.description.indexOf(to_append)==-1) {
+ data_row.description = data_row.description + to_append;
+ }
}
+
+ if(data_row.serial_no) {
+ to_append = 'Serial No.:' +
+ ((data_row.serial_no.indexOf('\n')>-1)?'
':' ') +
+ data_row.serial_no + '
';
+ if(data_row.description.indexOf(to_append)==-1) {
+ data_row.description = data_row.description + to_append;
+ }
+ }
+
+ return data_row.description;
}
}
);
@@ -176,7 +185,7 @@
-->