'Set Show in Website for Template Item if True for its Variant'

def update_template_item(self):

    if (self.variant_of and self.show_in_website):
        self.show_variant_in_website = 1
        self.show_in_website = 0
    if self.show_variant_in_website:
        template_item = frappe.get_doc(u'Item', self.variant_of)
        if (not template_item.show_in_website):
            template_item.show_in_website = 1
            template_item.flags.ignore_permissions = True
            template_item.save()
