'If shopping cart is enabled and no tax rule exists for shopping cart, enable this one'

def validate_use_for_shopping_cart(self):

    if ((not self.use_for_shopping_cart) and cint(frappe.db.get_single_value(u'Shopping    Cart    Settings', u'enabled')) and (not frappe.db.get_value(u'Tax    Rule', {u'use_for_shopping_cart': 1, u'name': [u'!=', self.name]}))):
        self.use_for_shopping_cart = 1
        frappe.msgprint(_(u"Enabling    'Use    for    Shopping    Cart',    as    Shopping    Cart    is    enabled    and    there    should    be    at    least    one    Tax    Rule    for    Shopping    Cart"))
