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 00000000000..438b34e946e --- /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/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js index cad8ec16f7d..b257d6da51c 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.js +++ b/erpnext/selling/doctype/sales_common/sales_common.js @@ -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}); diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py index ff9bf687190..fb3730cb25d 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.py +++ b/erpnext/setup/doctype/email_digest/email_digest.py @@ -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({ diff --git a/erpnext/setup/doctype/permission_control/permission_control.py b/erpnext/setup/doctype/permission_control/permission_control.py index 049a3f518d4..bb05bec1cde 100644 --- a/erpnext/setup/doctype/permission_control/permission_control.py +++ b/erpnext/setup/doctype/permission_control/permission_control.py @@ -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}