Merge branch 'master' of github.com:webnotes/erpnext into shf_rename
Conflicts:
erpnext/accounts/doctype/c_form/c_form.txt
erpnext/patches/patch_list.py
erpnext/setup/doctype/permission_control/permission_control.py
diff --git a/erpnext/accounts/doctype/c_form/c_form.py b/erpnext/accounts/doctype/c_form/c_form.py
index 943cef2..416657b 100644
--- a/erpnext/accounts/doctype/c_form/c_form.py
+++ b/erpnext/accounts/doctype/c_form/c_form.py
@@ -46,6 +46,14 @@
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 503992e..e24de31 100644
--- a/erpnext/accounts/doctype/c_form/c_form.txt
+++ b/erpnext/accounts/doctype/c_form/c_form.txt
@@ -3,23 +3,25 @@
# These values are common in all dictionaries
{
- 'creation': '2012-03-27 14:35:41',
+ 'creation': '2011-12-14 11:40:47',
'docstatus': 0,
- 'modified': '2012-03-27 14:35:41',
+ 'modified': '2012-04-06 17:29:50',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
- '_last_update': u'1323255350',
+ '_last_update': u'1333712835',
+ 'allow_attach': 1,
'colour': u'White:FFF',
'doctype': 'DocType',
+ 'max_attachments': 3,
'module': u'Accounts',
'name': '__common__',
'section_style': u'Simple',
'show_in_menu': 0,
- 'version': 11
+ 'version': 19
},
# These values are common for all DocField
@@ -79,6 +81,7 @@
'doctype': u'DocField',
'fieldname': u'column_break0',
'fieldtype': u'Column Break',
+ 'permlevel': 0,
'width': u'50%'
},
@@ -89,6 +92,7 @@
'fieldtype': u'Select',
'label': u'Series',
'options': u'\nC-FORM/',
+ 'permlevel': 0,
'reqd': 1
},
@@ -98,6 +102,7 @@
'fieldname': u'c_form_no',
'fieldtype': u'Data',
'label': u'C-Form No',
+ 'permlevel': 0,
'reqd': 1
},
@@ -107,6 +112,7 @@
'fieldname': u'received_date',
'fieldtype': u'Date',
'label': u'Received Date',
+ 'permlevel': 0,
'reqd': 1
},
@@ -117,6 +123,7 @@
'fieldtype': u'Link',
'label': u'Customer',
'options': u'Customer',
+ 'permlevel': 0,
'reqd': 1
},
@@ -125,6 +132,7 @@
'doctype': u'DocField',
'fieldname': u'column_break1',
'fieldtype': u'Column Break',
+ 'permlevel': 0,
'width': u'50%'
},
@@ -134,7 +142,8 @@
'fieldname': u'company',
'fieldtype': u'Select',
'label': u'Company',
- 'options': u'link:Company'
+ 'options': u'link:Company',
+ 'permlevel': 0
},
# DocField
@@ -144,6 +153,7 @@
'fieldtype': u'Select',
'label': u'Fiscal Year',
'options': u'link:Fiscal Year',
+ 'permlevel': 0,
'reqd': 1
},
@@ -153,7 +163,8 @@
'fieldname': u'quarter',
'fieldtype': u'Select',
'label': u'Quarter',
- 'options': u'\nI\nII\nIII\nIV'
+ 'options': u'\nI\nII\nIII\nIV',
+ 'permlevel': 0
},
# DocField
@@ -162,6 +173,7 @@
'fieldname': u'total_amount',
'fieldtype': u'Currency',
'label': u'Total Amount',
+ 'permlevel': 0,
'reqd': 1
},
@@ -172,6 +184,7 @@
'fieldtype': u'Select',
'label': u'State',
'options': u"link:State\ncountry='India'",
+ 'permlevel': 0,
'reqd': 1
},
@@ -180,6 +193,7 @@
'doctype': u'DocField',
'fieldname': u'section_break0',
'fieldtype': u'Section Break'
+ 'permlevel': 0
},
# DocField
@@ -188,6 +202,28 @@
'fieldname': u'invoice_details',
'fieldtype': u'Table',
'label': u'Invoice Details',
- 'options': u'C-Form Invoice Detail'
+ '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
+]
diff --git a/erpnext/accounts/page/accounts_home/accounts_home.js b/erpnext/accounts/page/accounts_home/accounts_home.js
index 4551db0..52738a8 100644
--- a/erpnext/accounts/page/accounts_home/accounts_home.js
+++ b/erpnext/accounts/page/accounts_home/accounts_home.js
@@ -19,4 +19,12 @@
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);
+ });
+ }
+
+}
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py
index a9e0c87..bef418d 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.py
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.py
@@ -226,7 +226,7 @@
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
@@ -238,9 +238,10 @@
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.
diff --git a/erpnext/patches/april_2012/__init__.py b/erpnext/patches/april_2012/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/patches/april_2012/__init__.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 0000000..246ea0f
--- /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/mar_2012/earning_deduction_type_patch.py b/erpnext/patches/mar_2012/earning_deduction_type_patch.py
new file mode 100644
index 0000000..438b34e
--- /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'
+ """)
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
index d5ff35e..7bb6001 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -261,5 +261,10 @@
'patch_module': 'patches.mar_2012',
'patch_file': 'usertags',
'description': 'Adds _user_tags columns to tables'
- }
+ },
+ {
+ 'patch_module': 'patches.april_2012',
+ 'patch_file': 'reload_c_form',
+ 'description': 'Added attchemnt option and total field'
+ },
]
diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js
index 2a6e5a3..52f3124 100644
--- a/erpnext/selling/doctype/sales_common/sales_common.js
+++ b/erpnext/selling/doctype/sales_common/sales_common.js
@@ -157,11 +157,18 @@
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']);
+ set_multiple(cdt, cdn, {price_list_currency:pl_currency[0]});
+ if (pl_currency[0] == doc.currency) {
+ 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, {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});
diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py
index 31cc637..b3ea118 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.py
+++ b/erpnext/setup/doctype/email_digest/email_digest.py
@@ -240,7 +240,9 @@
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({