[MIG] l10n_multilang : Migrated to new API.
This commit is contained in:
committed by
Yannick Tivisse
parent
e4daa3df40
commit
db682bfe74
@@ -12,9 +12,5 @@
|
||||
- Copy translations for COA, Tax, Tax Code and Fiscal Position from
|
||||
templates to target objects.
|
||||
""",
|
||||
'depends' : ['account'],
|
||||
'data': [],
|
||||
'demo': [],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
'depends': ['account'],
|
||||
}
|
||||
|
||||
@@ -2,73 +2,64 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
|
||||
from openerp.osv import fields, osv
|
||||
from openerp.tools.translate import _
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
#in this file, we mostly add the tag translate=True on existing fields that we now want to be translated
|
||||
|
||||
class account_account_template(osv.osv):
|
||||
|
||||
class AccountAccountTemplate(models.Model):
|
||||
_inherit = 'account.account.template'
|
||||
_columns = {
|
||||
'name': fields.char('Name', required=True, select=True, translate=True),
|
||||
}
|
||||
|
||||
class account_account(osv.osv):
|
||||
name = fields.Char(required=True, index=True, translate=True)
|
||||
|
||||
|
||||
class AccountAccount(models.Model):
|
||||
_inherit = 'account.account'
|
||||
_columns = {
|
||||
'name': fields.char('Name', required=True, select=True, translate=True),
|
||||
}
|
||||
|
||||
class account_tax(osv.osv):
|
||||
name = fields.Char(required=True, index=True, translate=True)
|
||||
|
||||
|
||||
class AccountTax(models.Model):
|
||||
_inherit = 'account.tax'
|
||||
_columns = {
|
||||
'name': fields.char('Tax Name', required=True, select=True, translate=True),
|
||||
}
|
||||
|
||||
name = fields.Char(string='Tax Name', required=True, index=True, translate=True)
|
||||
|
||||
|
||||
class account_tax_template(osv.osv):
|
||||
class AccountTaxTemplate(models.Model):
|
||||
_inherit = 'account.tax.template'
|
||||
_columns = {
|
||||
'name': fields.char('Tax Name', required=True, select=True, translate=True),
|
||||
}
|
||||
|
||||
name = fields.Char(string='Tax Name', required=True, index=True, translate=True)
|
||||
|
||||
|
||||
class account_chart_template(osv.osv):
|
||||
class AccountChartTemplate(models.Model):
|
||||
_inherit = 'account.chart.template'
|
||||
_columns={
|
||||
'name': fields.char('Name', required=True, translate=True),
|
||||
'spoken_languages': fields.char('Spoken Languages', help="State here the languages for which the translations of templates could be loaded at the time of installation of this localization module and copied in the final object when generating them from templates. You must provide the language codes separated by ';'"),
|
||||
}
|
||||
_order = 'name'
|
||||
|
||||
name = fields.Char(required=True, translate=True)
|
||||
spoken_languages = fields.Char(string='Spoken Languages', help="State here the languages for which the translations of templates could be loaded at the time of installation of this localization module and copied in the final object when generating them from templates. You must provide the language codes separated by ';'")
|
||||
|
||||
class account_fiscal_position(osv.osv):
|
||||
|
||||
class AccountFiscalPosition(models.Model):
|
||||
_inherit = 'account.fiscal.position'
|
||||
_columns = {
|
||||
'name': fields.char('Fiscal Position', required=True, translate=True),
|
||||
'note': fields.text('Notes', translate=True),
|
||||
}
|
||||
|
||||
name = fields.Char(string='Fiscal Position', required=True, translate=True)
|
||||
note = fields.Text(string='Notes', translate=True)
|
||||
|
||||
|
||||
class account_fiscal_position_template(osv.osv):
|
||||
class AccountFiscalPositionTemplate(models.Model):
|
||||
_inherit = 'account.fiscal.position.template'
|
||||
_columns = {
|
||||
'name': fields.char('Fiscal Position Template', required=True, translate=True),
|
||||
'note': fields.text('Notes', translate=True),
|
||||
}
|
||||
|
||||
name = fields.Char(string='Fiscal Position Template', required=True, translate=True)
|
||||
note = fields.Text(string='Notes', translate=True)
|
||||
|
||||
|
||||
class account_journal(osv.osv):
|
||||
class AccountJournal(models.Model):
|
||||
_inherit = 'account.journal'
|
||||
_columns = {
|
||||
'name': fields.char('Journal Name', required=True, translate=True),
|
||||
}
|
||||
|
||||
name = fields.Char(string='Journal Name', required=True, translate=True)
|
||||
|
||||
|
||||
class account_analytic_account(osv.osv):
|
||||
class AccountAnalyticAccount(models.Model):
|
||||
_inherit = 'account.analytic.account'
|
||||
_columns = {
|
||||
'name': fields.char('Account Name', required=True, translate=True),
|
||||
}
|
||||
|
||||
name = fields.Char(string='Account Name', required=True, translate=True)
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from openerp import api, models, SUPERUSER_ID
|
||||
import logging
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AccountChartTemplate(models.Model):
|
||||
_inherit = 'account.chart.template'
|
||||
|
||||
@@ -38,7 +41,7 @@ class AccountChartTemplate(models.Model):
|
||||
'value': value[element.id],
|
||||
})
|
||||
else:
|
||||
_logger.info('Language: %s. Translation from template: there is no translation available for %s!' %(lang, element.name))
|
||||
_logger.info('Language: %s. Translation from template: there is no translation available for %s!' % (lang, element.name))
|
||||
counter += 1
|
||||
return True
|
||||
|
||||
@@ -85,16 +88,15 @@ class AccountChartTemplate(models.Model):
|
||||
return self.process_translations(langs, field, in_ids, out_ids)
|
||||
|
||||
|
||||
class base_language_install(models.TransientModel):
|
||||
class BaseLanguageInstall(models.TransientModel):
|
||||
""" Install Language"""
|
||||
|
||||
_inherit = "base.language.install"
|
||||
|
||||
@api.multi
|
||||
def lang_install(self):
|
||||
self.ensure_one()
|
||||
already_installed = self.env['res.lang'].search_count([('code', '=', self.lang)])
|
||||
res = super(base_language_install, self).lang_install()
|
||||
res = super(BaseLanguageInstall, self).lang_install()
|
||||
if already_installed:
|
||||
# update of translations instead of new installation
|
||||
# skip to avoid duplicating the translations
|
||||
|
||||
Reference in New Issue
Block a user