Migration from 4.6 to 4.8

Must

  • [SQL] Add exceptional parent language (must be run before update):

    ALTER TABLE ir_lang ADD parent VARCHAR;
    
  • [MANUAL] Assign rules linked to users to a group (must be done before update).

  • [MANUAL] Check taxes and tax codes definitions (inactivate old children taxes and add them to the right codes)

  • [SQL] Update tax line sign (must be done after update):

    UPDATE account_tax_line SET amount = -amount WHERE id IN (SELECT tl.id FROM  account_tax_line AS tl JOIN account_move_line AS ml ON tl.move_line = ml.id JOIN account_move AS m ON ml.move = m.id JOIN account_invoice AS i ON i.id = CAST(SUBSTRING(m.origin, 17) AS INTEGER) AND m.origin like 'account.invoice,%' WHERE tl.amount > 0 AND ml.credit > 0 AND i.type = 'in');
    UPDATE account_tax_line SET amount = -amount WHERE id IN (SELECT tl.id FROM  account_tax_line AS tl JOIN account_move_line AS ml ON tl.move_line = ml.id JOIN account_move AS m ON ml.move = m.id JOIN account_invoice AS i ON i.id = CAST(SUBSTRING(m.origin, 17) AS INTEGER) AND m.origin like 'account.invoice,%' WHERE tl.amount > 0 AND ml.debit > 0 AND i.type = 'out');
    
  • [SQL] Update tax lines of inactive tax to their parent (must be done after update):

    UPDATE account_tax_line as l SET tax = (SELECT parent FROM account_tax WHERE account_tax.id = tax) FROM account_tax as t WHERE l.tax = t.id AND t.active = false;
    
  • [SQL] Delete duplicate tax lines (run multiple times until no record are deleted) (must be done after update):

     DELETE FROM account_tax_line WHERE id IN (SELECT MAX(id) FROM account_tax_line GROUP BY tax, amount, type, move_line HAVING count(*) > 1);
    

:arrow_forward: Migration from 4.8 to 5.0

You should add this:

  • [MANUAL] Update your chart of accounts from its template so that the new “tax code lines” used to compute the tax reports are created.