Add default database language code
review200001
This commit is contained in:
1 parent
590f7de673
commit
3bf0effd14
3 files changed
+19
-19
No files matched your search
+9
-11
@@ -10,6 +10,7 @@ from trytond.tools import reduce_ids
|
||||
from trytond.pyson import Eval, PYSONEncoder, Date
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond.config import CONFIG
|
||||
|
||||
|
||||
class TypeTemplate(ModelSQL, ModelView):
|
||||
@@ -114,7 +115,7 @@ class TypeTemplate(ModelSQL, ModelView):
|
||||
|
||||
new_id = type_obj.create(vals)
|
||||
|
||||
prev_lang = template._context.get('language') or 'en_US'
|
||||
prev_lang = template._context.get('language') or CONFIG['language']
|
||||
prev_data = {}
|
||||
for field_name, field in template._columns.iteritems():
|
||||
if getattr(field, 'translate', False):
|
||||
@@ -279,7 +280,7 @@ class Type(ModelSQL, ModelView):
|
||||
if vals:
|
||||
self.write(type.id, vals)
|
||||
|
||||
prev_lang = type._context.get('language') or 'en_US'
|
||||
prev_lang = type._context.get('language') or CONFIG['language']
|
||||
prev_data = {}
|
||||
for field_name, field in type.template._columns.iteritems():
|
||||
if getattr(field, 'translate', False):
|
||||
@@ -440,7 +441,7 @@ class AccountTemplate(ModelSQL, ModelView):
|
||||
|
||||
new_id = account_obj.create(vals)
|
||||
|
||||
prev_lang = template._context.get('language') or 'en_US'
|
||||
prev_lang = template._context.get('language') or CONFIG['language']
|
||||
prev_data = {}
|
||||
for field_name, field in template._columns.iteritems():
|
||||
if getattr(field, 'translate', False):
|
||||
@@ -914,7 +915,7 @@ class Account(ModelSQL, ModelView):
|
||||
if vals:
|
||||
self.write(account.id, vals)
|
||||
|
||||
prev_lang = account._context.get('language') or 'en_US'
|
||||
prev_lang = account._context.get('language') or CONFIG['language']
|
||||
prev_data = {}
|
||||
for field_name, field in account.template._columns.iteritems():
|
||||
if getattr(field, 'translate', False):
|
||||
@@ -1488,13 +1489,10 @@ class OpenBalanceSheet(Wizard):
|
||||
lang_obj = pool.get('ir.lang')
|
||||
|
||||
company = session.start.company
|
||||
for code in [Transaction().language, 'en_US']:
|
||||
lang_ids = lang_obj.search([
|
||||
('code', '=', code),
|
||||
lang_id, = lang_obj.search([
|
||||
('code', '=', Transaction().language),
|
||||
])
|
||||
if lang_ids:
|
||||
break
|
||||
lang = lang_obj.browse(lang_ids[0])
|
||||
lang = lang_obj.browse(lang_id)
|
||||
|
||||
date = lang_obj.strftime(session.start.date, lang.code, lang.date)
|
||||
|
||||
@@ -1686,7 +1684,7 @@ class CreateChart(Wizard):
|
||||
tax_rule_line_template_obj = \
|
||||
pool.get('account.tax.rule.line.template')
|
||||
|
||||
with Transaction().set_context(language='en_US'):
|
||||
with Transaction().set_context(language=CONFIG['language']):
|
||||
account_template = session.account.account_template
|
||||
|
||||
# Create account types
|
||||
|
||||
@@ -16,6 +16,7 @@ from trytond.backend import TableHandler, FIELDS
|
||||
from trytond.pyson import Eval, PYSONEncoder
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond.config import CONFIG
|
||||
|
||||
_MOVE_STATES = {
|
||||
'readonly': Eval('state') == 'posted',
|
||||
@@ -1250,10 +1251,10 @@ class Line(ModelSQL, ModelView):
|
||||
account = line.account
|
||||
amount = currency_obj.round(account.currency, amount)
|
||||
period_id = period_obj.find(account.company.id, date=date)
|
||||
lang_code = 'en_US'
|
||||
lang_code = CONFIG['language']
|
||||
if account.company.lang:
|
||||
lang_code = account.company.lang.code
|
||||
writeoff = translation_obj._get_source(
|
||||
writeoff = translation_obj.get_source(
|
||||
'account.move.reconcile_lines.writeoff', 'view', lang_code,
|
||||
'Write-Off') or 'Write-Off'
|
||||
move_id = move_obj.create({
|
||||
|
||||
@@ -8,6 +8,7 @@ from trytond.pyson import Eval, If, Bool, PYSONEncoder
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.cache import Cache
|
||||
from trytond.pool import Pool
|
||||
from trytond.config import CONFIG
|
||||
|
||||
|
||||
class Group(ModelSQL, ModelView):
|
||||
@@ -104,7 +105,7 @@ class CodeTemplate(ModelSQL, ModelView):
|
||||
|
||||
new_id = tax_code_obj.create(vals)
|
||||
|
||||
prev_lang = template._context.get('language') or 'en_US'
|
||||
prev_lang = template._context.get('language') or CONFIG['language']
|
||||
prev_data = {}
|
||||
for field_name, field in template._columns.iteritems():
|
||||
if getattr(field, 'translate', False):
|
||||
@@ -274,7 +275,7 @@ class Code(ModelSQL, ModelView):
|
||||
if vals:
|
||||
self.write(code.id, vals)
|
||||
|
||||
prev_lang = code._context.get('language') or 'en_US'
|
||||
prev_lang = code._context.get('language') or CONFIG['language']
|
||||
prev_data = {}
|
||||
for field_name, field in code.template._columns.iteritems():
|
||||
if getattr(field, 'translate', False):
|
||||
@@ -510,7 +511,7 @@ class TaxTemplate(ModelSQL, ModelView):
|
||||
|
||||
new_id = tax_obj.create(vals)
|
||||
|
||||
prev_lang = template._context.get('language') or 'en_US'
|
||||
prev_lang = template._context.get('language') or CONFIG['language']
|
||||
prev_data = {}
|
||||
for field_name, field in template._columns.iteritems():
|
||||
if getattr(field, 'translate', False):
|
||||
@@ -858,7 +859,7 @@ class Tax(ModelSQL, ModelView):
|
||||
if vals:
|
||||
self.write(tax.id, vals)
|
||||
|
||||
prev_lang = tax._context.get('language') or 'en_US'
|
||||
prev_lang = tax._context.get('language') or CONFIG['language']
|
||||
prev_data = {}
|
||||
for field_name, field in tax.template._columns.iteritems():
|
||||
if getattr(field, 'translate', False):
|
||||
@@ -975,7 +976,7 @@ class RuleTemplate(ModelSQL, ModelView):
|
||||
vals['company'] = company_id
|
||||
new_id = rule_obj.create(vals)
|
||||
|
||||
prev_lang = template._context.get('language') or 'en_US'
|
||||
prev_lang = template._context.get('language') or CONFIG['language']
|
||||
prev_data = {}
|
||||
for field_name, field in template._columns.iteritems():
|
||||
if getattr(field, 'translate', False):
|
||||
@@ -1065,7 +1066,7 @@ class Rule(ModelSQL, ModelView):
|
||||
if vals:
|
||||
self.write(rule.id, vals)
|
||||
|
||||
prev_lang = rule._context.get('language') or 'en_US'
|
||||
prev_lang = rule._context.get('language') or CONFIG['language']
|
||||
prev_data = {}
|
||||
for field_name, field in rule.template._columns.iteritems():
|
||||
if getattr(field, 'translate', False):
|
||||
|
||||
Reference in new issue
Block a user