mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[IMP] account_chart_update: Include field selection
With this option, you can select which fields do you want to compare for updating. Use case: you have specific accounts in taxes, and you don't want to lose them, but you want to update their groups through the wizard. Before this, the update was all or nothing. Now, you have total control!
This commit is contained in:
committed by
Luis J. Salvatierra
parent
e206a37bdd
commit
9e63f90527
20
account_chart_update/models/ir_model_fields.py
Normal file
20
account_chart_update/models/ir_model_fields.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2018 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class IrModelFields(models.Model):
|
||||
_inherit = 'ir.model.fields'
|
||||
|
||||
def name_get(self):
|
||||
"""Return special label when showing fields in chart update wizard."""
|
||||
if self.env.context.get('account_chart_update'):
|
||||
res = []
|
||||
for record in self:
|
||||
res.append((record.id, "%s (%s)" % (
|
||||
record.field_description, record.name,
|
||||
)))
|
||||
return res
|
||||
return super(IrModelFields, self).name_get()
|
||||
Reference in New Issue
Block a user