@classmethod
def update_rule_line(cls, company_id, template2tax, template2rule,
    template2rule_line=None):
    """
        Update tax rule line based on template.
        template2tax is a dictionary with tax template id as key and tax id as
        value, used to convert template id into tax.
        template2rule is a dictionary with tax rule template id as key and tax
        rule id as value, used to convert template id into tax rule.
        template2rule_line is a dictionary with tax rule line template id as
        key and tax rule line id as value, used to convert template id into tax
        rule line. The dictionary is filled with new tax rule lines.
        """
    if template2rule_line is None:
        template2rule_line = {}
    values = []
    lines = cls.search([('rule.company', '=', company_id)])
    for line in lines:
        if line.template:
            template2rule_line[line.template.id] = line.id
            if line.template_override:
                continue
            vals = line.template._get_tax_rule_line_value(rule_line=line)
            if line.rule.id != template2rule[line.template.rule.id]:
                vals['rule'] = template2rule[line.template.rule.id]
            if line.origin_tax:
                if line.template.origin_tax:
                    if line.origin_tax.id != template2tax[line.template.
                        origin_tax.id]:
                        vals['origin_tax'] = template2tax[line.template.
                            origin_tax.id]
                else:
                    vals['origin_tax'] = None
            elif line.template.origin_tax:
                vals['origin_tax'] = template2tax[line.template.origin_tax.id]
            if line.tax:
                if line.template.tax:
                    if line.tax.id != template2tax[line.template.tax.id]:
                        vals['tax'] = template2tax[line.template.tax.id]
                else:
                    vals['tax'] = None
            elif line.template.tax:
                vals['tax'] = template2tax[line.template.tax.id]
            if vals:
                values.append([line])
                values.append(vals)
    if values:
        cls.write(*values)
