'Convert the HTML fragment ``value`` to XML if necessary, and write
it as the value of translation ``self``.'

@api.multi
def save_html(self, value):

    assert ((len(self) == 1) and (self.type == 'model'))
    (mname, fname) = self.name.split(',')
    field = self.env[mname]._fields[fname]
    if (field.translate == xml_translate):
        div = ('<div>%s</div>' % encode(value))
        root = etree.fromstring(div, etree.HTMLParser(encoding='utf-8'))
        value = etree.tostring(root[0][0], encoding='utf-8')[5:(-6)]
    elif (field.translate == html_translate):
        div = ('<div>%s</div>' % encode(value))
        root = etree.fromstring(div, etree.HTMLParser(encoding='utf-8'))
        value = etree.tostring(root[0][0], encoding='utf-8', method='html')[5:(-6)]
    return self.write({'value': value})
