'update defaults'

def on_update(self):

    for key in keydict:
        frappe.db.set_default(key, self.get(keydict[key], u''))
    year_start_end_date = frappe.db.sql(u'select    year_start_date,    year_end_date\n DCTB  DCTB  DCTB from    `tabFiscal    Year`    where    name=%s', self.current_fiscal_year)
    if year_start_end_date:
        ysd = (year_start_end_date[0][0] or u'')
        yed = (year_start_end_date[0][1] or u'')
        if (ysd and yed):
            frappe.db.set_default(u'year_start_date', ysd.strftime(u'%Y-%m-%d'))
            frappe.db.set_default(u'year_end_date', yed.strftime(u'%Y-%m-%d'))
    if self.default_currency:
        frappe.db.set_value(u'Currency', self.default_currency, u'enabled', 1)
    self.toggle_rounded_total()
    self.toggle_in_words()
    frappe.clear_cache()
