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
This commit is contained in:
Anand Doshi 2012-04-09 12:14:53 +05:30
commit 87a2c5cc69
10 changed files with 103 additions and 18 deletions

View File

@ -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 """

View File

@ -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
}
]
]

View File

@ -19,4 +19,12 @@ pscript['onload_accounts-home'] = function(wrapper) {
if(wn.control_panel.country!='India') {
$('.india-specific').toggle(false);
}
}
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);
});
}
}

View File

@ -226,7 +226,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
@ -238,9 +238,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.

View File

View File

@ -0,0 +1,4 @@
def execute():
import webnotes
from webnotes.modules.module_manager import reload_doc
reload_doc('accounts', 'doctype', 'c_form')

View File

@ -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'
""")

View File

@ -261,5 +261,10 @@ patch_list = [
'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'
},
]

View File

@ -157,11 +157,18 @@ 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']);
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});

View File

@ -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({