Impacted versions:

At least 8.0

Steps to reproduce:

See https://youtu.be/kmXVzf3ApaM

Current behavior:

Currently if you validate an invoice (even with an invoice date) after the initial conversion rate has changed
(if the rate is changed between creation and validation). The tax amount and the credit/debit amount is not computed from the same rate.

This one is responsible for several production issues for tax reporting for the fiscal administration.

Expected behavior:

The tax amount and the credit/debit amount must be computed from the same rate.

Video/Screenshot link (optional):

https://youtu.be/kmXVzf3ApaM

Related issue : https://github.com/odoo/odoo/issues/13473

My proposal to fix this one : https://github.com/odoo/odoo/pull/13621

self.write({})
        for inv in self:
            self.write({'internal_number': inv.number})
            if inv.type in ('in_invoice', 'in_refund'):
                if not inv.reference:
                    ref = inv.number
                else:
                    ref = inv.reference
            else:
                ref = inv.number
            self._cr.execute(""" UPDATE account_move SET ref=%s
                           WHERE id=%s AND (ref IS NULL OR ref = '')""",
                        (ref, inv.move_id.id))
            self._cr.execute(""" UPDATE account_move_line SET ref=%s
                           WHERE move_id=%s AND (ref IS NULL OR ref = '')""",
                        (ref, inv.move_id.id))
            self._cr.execute(""" UPDATE account_analytic_line SET ref=%s
                           FROM account_move_line
                           WHERE account_move_line.move_id = %s AND
                                 account_analytic_line.move_id = account_move_line.id""",
                        (ref, inv.move_id.id))
            self.invalidate_cache()
        return True
    @api.multi
    def action_cancel(self):