| 1 |
# Part of Odoo. See LICENSE file for full copyright and licensing details. |
| 2 |
from odoo import api, Command, SUPERUSER_ID |
| 3 |
|
| 4 |
|
| 5 |
def migrate(cr, version): |
| 6 |
env = api.Environment(cr, SUPERUSER_ID, {}) |
| 7 |
# Migrate wrong data tag on account cuenta102_02 |
| 8 |
debit_tag = env.ref('l10n_mx.tag_debit_balance_account') |
| 9 |
credit_tag = env.ref('l10n_mx.tag_credit_balance_account') |
| 10 |
account_102_ids = env['ir.model.data'].search([ |
| 11 |
('name', 'ilike', '%_cuenta102_02'), |
| 12 |
('model', '=', 'account.account'), |
| 13 |
]).mapped('res_id') |
| 14 |
accounts_102 = env['account.account'].browse(account_102_ids) |
| 15 |
accounts_102.tag_ids = [Command.unlink(credit_tag.id), Command.link(debit_tag.id)] |