Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Nabin Hait 2012-04-06 15:19:18 +05:30
commit 1299dab010
4 changed files with 32 additions and 6 deletions

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

@ -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})
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 unhide_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({

View File

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