diff --git a/CHANGELOG b/CHANGELOG index 3f98124cb3..7710cfeca4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Make Chart of Account not translatable * Add Journal Cash reporting Version 3.6.0 - 2015-04-20 diff --git a/account.py b/account.py index 55a07927c8..1579da86f3 100644 --- a/account.py +++ b/account.py @@ -43,7 +43,7 @@ def inactive_records(func): class TypeTemplate(ModelSQL, ModelView): 'Account Type Template' __name__ = 'account.account.type.template' - name = fields.Char('Name', required=True, translate=True) + name = fields.Char('Name', required=True) parent = fields.Many2One('account.account.type.template', 'Parent', ondelete="RESTRICT") childs = fields.One2Many('account.account.type.template', 'parent', @@ -129,8 +129,6 @@ class TypeTemplate(ModelSQL, ModelView): ''' pool = Pool() Type = pool.get('account.account.type') - Lang = pool.get('ir.lang') - Config = pool.get('ir.configuration') if template2type is None: template2type = {} @@ -142,24 +140,6 @@ class TypeTemplate(ModelSQL, ModelView): new_type, = Type.create([vals]) - prev_lang = self._context.get('language') or Config.get_language() - prev_data = {} - for field_name, field in self._fields.iteritems(): - if getattr(field, 'translate', False): - prev_data[field_name] = getattr(self, field_name) - for lang in Lang.get_translatable_languages(): - if lang == prev_lang: - continue - with Transaction().set_context(language=lang): - template = self.__class__(self.id) - data = {} - for field_name, field in template._fields.iteritems(): - if (getattr(field, 'translate', False) - and (getattr(template, field_name) != - prev_data[field_name])): - data[field_name] = getattr(template, field_name) - if data: - Type.write([new_type], data) template2type[self.id] = new_type.id new_id = template2type[self.id] @@ -173,7 +153,7 @@ class TypeTemplate(ModelSQL, ModelView): class Type(ModelSQL, ModelView): 'Account Type' __name__ = 'account.account.type' - name = fields.Char('Name', size=None, required=True, translate=True) + name = fields.Char('Name', size=None, required=True) parent = fields.Many2One('account.account.type', 'Parent', ondelete="RESTRICT", domain=[ ('company', '=', Eval('company')), @@ -294,9 +274,6 @@ class Type(ModelSQL, ModelView): value, used to convert template id into type. The dictionary is filled with new types ''' - pool = Pool() - Lang = pool.get('ir.lang') - Config = pool.get('ir.configuration') if template2type is None: template2type = {} @@ -306,26 +283,6 @@ class Type(ModelSQL, ModelView): if vals: self.write([self], vals) - prev_lang = self._context.get('language') or Config.get_language() - prev_data = {} - for field_name, field in self.template._fields.iteritems(): - if getattr(field, 'translate', False): - prev_data[field_name] = getattr(self.template, field_name) - for lang in Lang.get_translatable_languages(): - if lang == prev_lang: - continue - with Transaction().set_context(language=lang): - type_ = self.__class__(self.id) - data = {} - for field_name, field in ( - type_.template._fields.iteritems()): - if (getattr(field, 'translate', False) - and (getattr(type_.template, field_name) != - prev_data[field_name])): - data[field_name] = getattr(type_.template, - field_name) - if data: - self.write([type_], data) template2type[self.template.id] = self.id for child in self.childs: @@ -354,8 +311,7 @@ class OpenType(Wizard): class AccountTemplate(ModelSQL, ModelView): 'Account Template' __name__ = 'account.account.template' - name = fields.Char('Name', size=None, required=True, translate=True, - select=True) + name = fields.Char('Name', size=None, required=True, select=True) code = fields.Char('Code', size=None, select=True) type = fields.Many2One('account.account.type.template', 'Type', ondelete="RESTRICT", @@ -480,8 +436,6 @@ class AccountTemplate(ModelSQL, ModelView): ''' pool = Pool() Account = pool.get('account.account') - Lang = pool.get('ir.lang') - Config = pool.get('ir.configuration') if template2account is None: template2account = {} @@ -498,24 +452,6 @@ class AccountTemplate(ModelSQL, ModelView): new_account, = Account.create([vals]) - prev_lang = self._context.get('language') or Config.get_language() - prev_data = {} - for field_name, field in self._fields.iteritems(): - if getattr(field, 'translate', False): - prev_data[field_name] = getattr(self, field_name) - for lang in Lang.get_translatable_languages(): - if lang == prev_lang: - continue - with Transaction().set_context(language=lang): - template = self.__class__(self.id) - data = {} - for field_name, field in self._fields.iteritems(): - if (getattr(field, 'translate', False) - and (getattr(template, field_name) != - prev_data[field_name])): - data[field_name] = getattr(template, field_name) - if data: - Account.write([new_account], data) template2account[self.id] = new_account.id new_id = template2account[self.id] @@ -562,8 +498,7 @@ class AccountTemplate(ModelSQL, ModelView): class Account(ModelSQL, ModelView): 'Account' __name__ = 'account.account' - name = fields.Char('Name', size=None, required=True, translate=True, - select=True) + name = fields.Char('Name', size=None, required=True, select=True) code = fields.Char('Code', size=None, select=True) active = fields.Boolean('Active', select=True) company = fields.Many2One('company.company', 'Company', required=True, @@ -918,9 +853,6 @@ class Account(ModelSQL, ModelView): template2type is a dictionary with type template id as key and type id as value, used to convert type template id into type. ''' - pool = Pool() - Lang = pool.get('ir.lang') - Config = pool.get('ir.configuration') if template2account is None: template2account = {} @@ -938,26 +870,6 @@ class Account(ModelSQL, ModelView): if vals: self.write([self], vals) - prev_lang = self._context.get('language') or Config.get_language() - prev_data = {} - for field_name, field in self.template._fields.iteritems(): - if getattr(field, 'translate', False): - prev_data[field_name] = getattr(self.template, field_name) - for lang in Lang.get_translatable_languages(): - if lang == prev_lang: - continue - with Transaction().set_context(language=lang): - account = self.__class__(self.id) - data = {} - for field_name, field in ( - account.template._fields.iteritems()): - if (getattr(field, 'translate', False) - and (getattr(account.template, field_name) != - prev_data[field_name])): - data[field_name] = getattr(account.template, - field_name) - if data: - self.write([account], data) template2account[self.template.id] = self.id for child in self.childs: diff --git a/account.xml b/account.xml index 2e5c132cf0..d830c8c067 100644 --- a/account.xml +++ b/account.xml @@ -101,108 +101,6 @@ this repository contains the full copyright notices and license terms. --> action="act_account_type_template_tree" id="menu_account_type_template_tree"/> - - Minimal Account Type Chart - - - - Asset - - - - - - Current - - - - - Cash - - - - - Receivable - - - - - Long-term - - - - - Liability - - - - - - Current - - - - - Payable - - - - - Tax - - - - - Long-term - - - - - Equity - - - - - - Income - - - - credit-debit - - - Revenue - - - credit-debit - - - Expense - - - credit-debit - - - Off-Balance - - - account.account.type @@ -317,56 +215,6 @@ this repository contains the full copyright notices and license terms. --> - - Minimal Account Chart - - - - Main Receivable - - - - - - receivable - - - Main Payable - - - - - - payable - - - Main Revenue - - - - revenue - - - Main Expense - - - - expense - - - Main Cash - - - - other - - - Main Tax - - - - other - account.account.deferral diff --git a/localize.xsl b/localize.xsl new file mode 100644 index 0000000000..73a1146b8c --- /dev/null +++ b/localize.xsl @@ -0,0 +1,34 @@ + + + + + + + _ + + + + + + + + + + _ + + + + + + + + + + + + + + + + + diff --git a/minimal_chart.xml b/minimal_chart.xml new file mode 100644 index 0000000000..842b24f0a3 --- /dev/null +++ b/minimal_chart.xml @@ -0,0 +1,344 @@ + + + + + + Minimal Account Type Chart + Минимален сметкоплан + Pla de tipus de compte mínim + Minimaler Kontentypenplan + Tipo de cuenta de plan mínimo + Plan de type de compte minimal + Basaal rekeningschematype + Минимальная схема типов счетов + Minimalni kontni načrt + + + + Asset + Притежание + Actiu + Aktiva + Activo + Actif + Activa + Активы + Sredstvo + + + + + + Current + Текущ + Banc + Umlaufvermögen + Banco + Courant + Actueel + Текущие + Kratkoročno + + + + + Cash + В брой + Banc + Barvermögen + Efectivo + Cash + Kas + Наличные + Denar + + + + + Receivable + В брой + Banc + Barvermögen + Efectivo + Cash + Kas + Наличные + Denar + + + + + Long-term + Дългосрочен + A llarg termini + Anlagevermögen + A largo plazo + Long terme + Langlopend + Долгосрочные + Dolgoročno + + + + + Receivable + Дълг + Passiu + Verbindlichkeiten + Pasivo + Passif + Verplichting + Пассивы + Obveznosti + + + + + + Current + Текущ + Banc + Umlaufvermögen + Banco + Courant + Actueel + Текущие + Kratkoročno + + + + + Payable + Разходен + A pagar + Verbindlichkeiten + A pagar + À payer + Te betalen + Подлежащие уплате + Obveznosti + + + + + Tax + Данък + Impost + Steuer + Impuesto + Taxe + Belasting + Налоги + Davek + + + + + Long-term + Дългосрочен + A llarg termini + Anlagevermögen + A largo plazo + Long terme + Langlopend + Долгосрочные + Dolgoročno + + + + + Equity + Капитал + Patrimoni + Kapital + Patrimonio + Capitaux propres + Eigen vermogen + Собственные средства + Kapital + + + + + + Income + Приход + Benefici + Erträge + Beneficio + Revenu + Inkomsten + Поступления + Prihodki + + + + credit-debit + + + Revenue + Приход + Ingressos + Ertrag + Ingresos + Produit + Opbrengst + Доходы + Prihodki + + + credit-debit + + + Expense + Разход + Despesa + Aufwand + Gastos + Charge + Kosten + Расходы + Odhodki + + + credit-debit + + + Off-Balance + Неутрално салдо + Fora de balanç + Bilanzneutral + Fuera de balance + Hors bilan + Buiten balans + Внебалансовые + Zunaj bilance + + + + + + Minimal Account Chart + Минимална графика на сметката + Pla de comptes mínim + Minimaler Kontenplan + Plan de cuentas mínimo + Plan comptable minimal + Basaal rekeningschema + Минимальная схема счетов + Minimalni kontni načrt + + + + Main Receivable + Основна приходна сметка + A cobrar principal + Forderungen + A cobrar principal + Compte client + Basisrekening ontvangen + Основной Подлежащий получению + Glavne terjatve + + + + + + receivable + + + Main Payable + Основна разходна сметка + A pagar principal + Verbindlichkeiten + A pagar principal + Compte fournisseur + Basisrekening betalen + Основной Подлежащий уплате + Glavne obveznosti + + + + + + payable + + + Main Revenue + Основна приходи + Ingrés principal + Ertrag + Ingresos principal + Compte de produits + Basis opbrengstrekening + Основной Доходы + Glavni prihodki + + + + revenue + + + Main Expense + Основена разходи + Despesa principal + Aufwand + Gastos principal + Compte de charges + Basis kostenrekening + Основной Расходы + Glavni odhodki + + + + expense + + + Main Cash + Основна наличност + Efectiu principal + Barvermögen + Efectivo principal + Compte de liquidité + Basis kasrekening + Основной Наличные + Glavna denarna sredstva + + + + other + + + Main Tax + Основна данъци + Impost principal + Steuern + Impuestos principal + Compte de taxes + Basis belastingrekening + Основной Налоги + Glavni davki + + + + other + + + diff --git a/minimal_chart_bg.xml b/minimal_chart_bg.xml new file mode 100644 index 0000000000..eb9fc61ba5 --- /dev/null +++ b/minimal_chart_bg.xml @@ -0,0 +1,328 @@ + + + + + + + Минимален сметкоплан + + + + + + + + + + + + Притежание + + + + + + + + + + + + + + Текущ + + + + + + + + + + + + + В брой + + + + + + + + + + + + + В брой + + + + + + + + + + + + + Дългосрочен + + + + + + + + + + + + + Дълг + + + + + + + + + + + + + + Текущ + + + + + + + + + + + + + Разходен + + + + + + + + + + + + + Данък + + + + + + + + + + + + + Дългосрочен + + + + + + + + + + + + + Капитал + + + + + + + + + + + + + + Приход + + + + + + + + + + + credit-debit + + + + Приход + + + + + + + + + + credit-debit + + + + Разход + + + + + + + + + + credit-debit + + + + Неутрално салдо + + + + + + + + + + + + + + Минимална графика на сметката + + + + + + + + + + + + Основна приходна сметка + + + + + + + + + + + + + receivable + + + + Основна разходна сметка + + + + + + + + + + + + + payable + + + + Основна приходи + + + + + + + + + + + revenue + + + + Основена разходи + + + + + + + + + + + expense + + + + Основна наличност + + + + + + + + + + + other + + + + Основна данъци + + + + + + + + + + + other + + + diff --git a/minimal_chart_ca.xml b/minimal_chart_ca.xml new file mode 100644 index 0000000000..3bd1e90bed --- /dev/null +++ b/minimal_chart_ca.xml @@ -0,0 +1,328 @@ + + + + + + + + Pla de tipus de compte mínim + + + + + + + + + + + + Actiu + + + + + + + + + + + + + + Banc + + + + + + + + + + + + + Banc + + + + + + + + + + + + + Banc + + + + + + + + + + + + + A llarg termini + + + + + + + + + + + + + Passiu + + + + + + + + + + + + + + Banc + + + + + + + + + + + + + A pagar + + + + + + + + + + + + + Impost + + + + + + + + + + + + + A llarg termini + + + + + + + + + + + + + Patrimoni + + + + + + + + + + + + + + Benefici + + + + + + + + + + credit-debit + + + + + Ingressos + + + + + + + + + credit-debit + + + + + Despesa + + + + + + + + + credit-debit + + + + + Fora de balanç + + + + + + + + + + + + + + Pla de comptes mínim + + + + + + + + + + + + A cobrar principal + + + + + + + + + + + + receivable + + + + + A pagar principal + + + + + + + + + + + + payable + + + + + Ingrés principal + + + + + + + + + + revenue + + + + + Despesa principal + + + + + + + + + + expense + + + + + Efectiu principal + + + + + + + + + + other + + + + + Impost principal + + + + + + + + + + other + + + diff --git a/minimal_chart_de.xml b/minimal_chart_de.xml new file mode 100644 index 0000000000..455536034f --- /dev/null +++ b/minimal_chart_de.xml @@ -0,0 +1,328 @@ + + + + + + + + + Minimaler Kontentypenplan + + + + + + + + + + + + Aktiva + + + + + + + + + + + + + + Umlaufvermögen + + + + + + + + + + + + + Barvermögen + + + + + + + + + + + + + Barvermögen + + + + + + + + + + + + + Anlagevermögen + + + + + + + + + + + + + Verbindlichkeiten + + + + + + + + + + + + + + Umlaufvermögen + + + + + + + + + + + + + Verbindlichkeiten + + + + + + + + + + + + + Steuer + + + + + + + + + + + + + Anlagevermögen + + + + + + + + + + + + + Kapital + + + + + + + + + + + + + + Erträge + + + + + + + + + credit-debit + + + + + + Ertrag + + + + + + + + credit-debit + + + + + + Aufwand + + + + + + + + credit-debit + + + + + + Bilanzneutral + + + + + + + + + + + + + + Minimaler Kontenplan + + + + + + + + + + + + Forderungen + + + + + + + + + + + receivable + + + + + + Verbindlichkeiten + + + + + + + + + + + payable + + + + + + Ertrag + + + + + + + + + revenue + + + + + + Aufwand + + + + + + + + + expense + + + + + + Barvermögen + + + + + + + + + other + + + + + + Steuern + + + + + + + + + other + + + diff --git a/minimal_chart_en.xml b/minimal_chart_en.xml new file mode 100644 index 0000000000..90870dcd2a --- /dev/null +++ b/minimal_chart_en.xml @@ -0,0 +1,328 @@ + + + + + + Minimal Account Type Chart + + + + + + + + + + + + Asset + + + + + + + + + + + + + + Current + + + + + + + + + + + + + Cash + + + + + + + + + + + + + Receivable + + + + + + + + + + + + + Long-term + + + + + + + + + + + + + Receivable + + + + + + + + + + + + + + Current + + + + + + + + + + + + + Payable + + + + + + + + + + + + + Tax + + + + + + + + + + + + + Long-term + + + + + + + + + + + + + Equity + + + + + + + + + + + + + + Income + + + + + + + + + + + + credit-debit + + + Revenue + + + + + + + + + + + credit-debit + + + Expense + + + + + + + + + + + credit-debit + + + Off-Balance + + + + + + + + + + + + + + Minimal Account Chart + + + + + + + + + + + + Main Receivable + + + + + + + + + + + + + + receivable + + + Main Payable + + + + + + + + + + + + + + payable + + + Main Revenue + + + + + + + + + + + + revenue + + + Main Expense + + + + + + + + + + + + expense + + + Main Cash + + + + + + + + + + + + other + + + Main Tax + + + + + + + + + + + + other + + + diff --git a/minimal_chart_es.xml b/minimal_chart_es.xml new file mode 100644 index 0000000000..91ab6e7e6b --- /dev/null +++ b/minimal_chart_es.xml @@ -0,0 +1,328 @@ + + + + + + + + + + Tipo de cuenta de plan mínimo + + + + + + + + + + + + Activo + + + + + + + + + + + + + + Banco + + + + + + + + + + + + + Efectivo + + + + + + + + + + + + + Efectivo + + + + + + + + + + + + + A largo plazo + + + + + + + + + + + + + Pasivo + + + + + + + + + + + + + + Banco + + + + + + + + + + + + + A pagar + + + + + + + + + + + + + Impuesto + + + + + + + + + + + + + A largo plazo + + + + + + + + + + + + + Patrimonio + + + + + + + + + + + + + + Beneficio + + + + + + + + credit-debit + + + + + + + Ingresos + + + + + + + credit-debit + + + + + + + Gastos + + + + + + + credit-debit + + + + + + + Fuera de balance + + + + + + + + + + + + + + Plan de cuentas mínimo + + + + + + + + + + + + A cobrar principal + + + + + + + + + + receivable + + + + + + + A pagar principal + + + + + + + + + + payable + + + + + + + Ingresos principal + + + + + + + + revenue + + + + + + + Gastos principal + + + + + + + + expense + + + + + + + Efectivo principal + + + + + + + + other + + + + + + + Impuestos principal + + + + + + + + other + + + diff --git a/minimal_chart_fr.xml b/minimal_chart_fr.xml new file mode 100644 index 0000000000..1aa6b2e15f --- /dev/null +++ b/minimal_chart_fr.xml @@ -0,0 +1,328 @@ + + + + + + + + + + + Plan de type de compte minimal + + + + + + + + + + + + Actif + + + + + + + + + + + + + + Courant + + + + + + + + + + + + + Cash + + + + + + + + + + + + + Cash + + + + + + + + + + + + + Long terme + + + + + + + + + + + + + Passif + + + + + + + + + + + + + + Courant + + + + + + + + + + + + + À payer + + + + + + + + + + + + + Taxe + + + + + + + + + + + + + Long terme + + + + + + + + + + + + + Capitaux propres + + + + + + + + + + + + + + Revenu + + + + + + + credit-debit + + + + + + + + Produit + + + + + + credit-debit + + + + + + + + Charge + + + + + + credit-debit + + + + + + + + Hors bilan + + + + + + + + + + + + + + Plan comptable minimal + + + + + + + + + + + + Compte client + + + + + + + + + receivable + + + + + + + + Compte fournisseur + + + + + + + + + payable + + + + + + + + Compte de produits + + + + + + + revenue + + + + + + + + Compte de charges + + + + + + + expense + + + + + + + + Compte de liquidité + + + + + + + other + + + + + + + + Compte de taxes + + + + + + + other + + + diff --git a/minimal_chart_nl.xml b/minimal_chart_nl.xml new file mode 100644 index 0000000000..1466e1d117 --- /dev/null +++ b/minimal_chart_nl.xml @@ -0,0 +1,328 @@ + + + + + + + + + + + + Basaal rekeningschematype + + + + + + + + + + + + Activa + + + + + + + + + + + + + + Actueel + + + + + + + + + + + + + Kas + + + + + + + + + + + + + Kas + + + + + + + + + + + + + Langlopend + + + + + + + + + + + + + Verplichting + + + + + + + + + + + + + + Actueel + + + + + + + + + + + + + Te betalen + + + + + + + + + + + + + Belasting + + + + + + + + + + + + + Langlopend + + + + + + + + + + + + + Eigen vermogen + + + + + + + + + + + + + + Inkomsten + + + + + + credit-debit + + + + + + + + + Opbrengst + + + + + credit-debit + + + + + + + + + Kosten + + + + + credit-debit + + + + + + + + + Buiten balans + + + + + + + + + + + + + + Basaal rekeningschema + + + + + + + + + + + + Basisrekening ontvangen + + + + + + + + receivable + + + + + + + + + Basisrekening betalen + + + + + + + + payable + + + + + + + + + Basis opbrengstrekening + + + + + + revenue + + + + + + + + + Basis kostenrekening + + + + + + expense + + + + + + + + + Basis kasrekening + + + + + + other + + + + + + + + + Basis belastingrekening + + + + + + other + + + diff --git a/minimal_chart_ru.xml b/minimal_chart_ru.xml new file mode 100644 index 0000000000..73b2676335 --- /dev/null +++ b/minimal_chart_ru.xml @@ -0,0 +1,328 @@ + + + + + + + + + + + + + Минимальная схема типов счетов + + + + + + + + + + + + Активы + + + + + + + + + + + + + + Текущие + + + + + + + + + + + + + Наличные + + + + + + + + + + + + + Наличные + + + + + + + + + + + + + Долгосрочные + + + + + + + + + + + + + Пассивы + + + + + + + + + + + + + + Текущие + + + + + + + + + + + + + Подлежащие уплате + + + + + + + + + + + + + Налоги + + + + + + + + + + + + + Долгосрочные + + + + + + + + + + + + + Собственные средства + + + + + + + + + + + + + + Поступления + + + + + credit-debit + + + + + + + + + + Доходы + + + + credit-debit + + + + + + + + + + Расходы + + + + credit-debit + + + + + + + + + + Внебалансовые + + + + + + + + + + + + + + Минимальная схема счетов + + + + + + + + + + + + Основной Подлежащий получению + + + + + + + receivable + + + + + + + + + + Основной Подлежащий уплате + + + + + + + payable + + + + + + + + + + Основной Доходы + + + + + revenue + + + + + + + + + + Основной Расходы + + + + + expense + + + + + + + + + + Основной Наличные + + + + + other + + + + + + + + + + Основной Налоги + + + + + other + + + diff --git a/minimal_chart_sl.xml b/minimal_chart_sl.xml new file mode 100644 index 0000000000..b860d840a3 --- /dev/null +++ b/minimal_chart_sl.xml @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + Minimalni kontni načrt + + + + + + + + + + + + Sredstvo + + + + + + + + + + + + + + Kratkoročno + + + + + + + + + + + + + Denar + + + + + + + + + + + + + Denar + + + + + + + + + + + + + Dolgoročno + + + + + + + + + + + + + Obveznosti + + + + + + + + + + + + + + Kratkoročno + + + + + + + + + + + + + Obveznosti + + + + + + + + + + + + + Davek + + + + + + + + + + + + + Dolgoročno + + + + + + + + + + + + + Kapital + + + + + + + + + + + + + + Prihodki + + + + credit-debit + + + + + + + + + + + Prihodki + + + credit-debit + + + + + + + + + + + Odhodki + + + credit-debit + + + + + + + + + + + Zunaj bilance + + + + + + + + + + + + + + Minimalni kontni načrt + + + + + + + + + + + + Glavne terjatve + + + + + + receivable + + + + + + + + + + + Glavne obveznosti + + + + + + payable + + + + + + + + + + + Glavni prihodki + + + + revenue + + + + + + + + + + + Glavni odhodki + + + + expense + + + + + + + + + + + Glavna denarna sredstva + + + + other + + + + + + + + + + + Glavni davki + + + + other + + + diff --git a/tax.py b/tax.py index 825859e4cd..848a2ea5e2 100644 --- a/tax.py +++ b/tax.py @@ -34,7 +34,7 @@ KINDS = [ class TaxGroup(ModelSQL, ModelView): 'Tax Group' __name__ = 'account.tax.group' - name = fields.Char('Name', size=None, required=True, translate=True) + name = fields.Char('Name', size=None, required=True) code = fields.Char('Code', size=None, required=True) kind = fields.Selection(KINDS, 'Kind', required=True) @@ -56,13 +56,13 @@ class TaxGroup(ModelSQL, ModelView): class TaxCodeTemplate(ModelSQL, ModelView): 'Tax Code Template' __name__ = 'account.tax.code.template' - name = fields.Char('Name', required=True, translate=True) + name = fields.Char('Name', required=True) code = fields.Char('Code') parent = fields.Many2One('account.tax.code.template', 'Parent') childs = fields.One2Many('account.tax.code.template', 'parent', 'Children') account = fields.Many2One('account.account.template', 'Account Template', domain=[('parent', '=', None)], required=True) - description = fields.Text('Description', translate=True) + description = fields.Text('Description') @classmethod def __setup__(cls): @@ -101,8 +101,6 @@ class TaxCodeTemplate(ModelSQL, ModelView): ''' pool = Pool() TaxCode = pool.get('account.tax.code') - Lang = pool.get('ir.lang') - Config = pool.get('ir.configuration') if template2tax_code is None: template2tax_code = {} @@ -114,24 +112,9 @@ class TaxCodeTemplate(ModelSQL, ModelView): new_tax_code, = TaxCode.create([vals]) - prev_lang = self._context.get('language') or Config.get_language() prev_data = {} for field_name, field in self._fields.iteritems(): - if getattr(field, 'translate', False): - prev_data[field_name] = getattr(self, field_name) - for lang in Lang.get_translatable_languages(): - if lang == prev_lang: - continue - with Transaction().set_context(language=lang): - template = self.__class__(self.id) - data = {} - for field_name, field in template._fields.iteritems(): - if (getattr(field, 'translate', False) - and (getattr(template, field_name) != - prev_data[field_name])): - data[field_name] = getattr(template, field_name) - if data: - TaxCode.write([new_tax_code], data) + prev_data[field_name] = getattr(self, field_name) template2tax_code[self.id] = new_tax_code.id new_id = template2tax_code[self.id] @@ -145,8 +128,7 @@ class TaxCodeTemplate(ModelSQL, ModelView): class TaxCode(ModelSQL, ModelView): 'Tax Code' __name__ = 'account.tax.code' - name = fields.Char('Name', size=None, required=True, select=True, - translate=True) + name = fields.Char('Name', size=None, required=True, select=True) code = fields.Char('Code', size=None, select=True) active = fields.Boolean('Active', select=True) company = fields.Many2One('company.company', 'Company', required=True, @@ -161,7 +143,7 @@ class TaxCode(ModelSQL, ModelView): digits=(16, Eval('currency_digits', 2)), depends=['currency_digits']), 'get_sum') template = fields.Many2One('account.tax.code.template', 'Template') - description = fields.Text('Description', translate=True) + description = fields.Text('Description') @classmethod def __setup__(cls): @@ -259,9 +241,6 @@ class TaxCode(ModelSQL, ModelView): tax code id as value, used to convert template id into tax code. The dictionary is filled with new tax codes ''' - pool = Pool() - Lang = pool.get('ir.lang') - Config = pool.get('ir.configuration') if template2tax_code is None: template2tax_code = {} @@ -270,26 +249,6 @@ class TaxCode(ModelSQL, ModelView): vals = self.template._get_tax_code_value(code=self) if vals: self.write([self], vals) - - prev_lang = self._context.get('language') or Config.get_language() - prev_data = {} - for field_name, field in self.template._fields.iteritems(): - if getattr(field, 'translate', False): - prev_data[field_name] = getattr(self.template, field_name) - for lang in Lang.get_translatable_languages(): - if lang == prev_lang: - continue - with Transaction().set_context(language=lang): - code = self.__class__(self.id) - data = {} - for field_name, field in code.template._fields.iteritems(): - if (getattr(field, 'translate', False) - and (getattr(code.template, field_name) != - prev_data[field_name])): - data[field_name] = getattr(code.template, - field_name) - if data: - self.write([code], data) template2tax_code[self.template.id] = self.id for child in self.childs: @@ -353,8 +312,8 @@ class OpenChartTaxCode(Wizard): class TaxTemplate(ModelSQL, ModelView): 'Account Tax Template' __name__ = 'account.tax.template' - name = fields.Char('Name', required=True, translate=True) - description = fields.Char('Description', required=True, translate=True) + name = fields.Char('Name', required=True) + description = fields.Char('Description', required=True) group = fields.Many2One('account.tax.group', 'Group') sequence = fields.Integer('Sequence') start_date = fields.Date('Starting Date') @@ -514,8 +473,6 @@ class TaxTemplate(ModelSQL, ModelView): ''' pool = Pool() Tax = pool.get('account.tax') - Lang = pool.get('ir.lang') - Config = pool.get('ir.configuration') if template2tax is None: template2tax = {} @@ -557,24 +514,6 @@ class TaxTemplate(ModelSQL, ModelView): new_tax, = Tax.create([vals]) - prev_lang = self._context.get('language') or Config.get_language() - prev_data = {} - for field_name, field in self._fields.iteritems(): - if getattr(field, 'translate', False): - prev_data[field_name] = getattr(self, field_name) - for lang in Lang.get_translatable_languages(): - if lang == prev_lang: - continue - with Transaction().set_context(language=lang): - template = self.__class__(self.id) - data = {} - for field_name, field in template._fields.iteritems(): - if (getattr(field, 'translate', False) - and (getattr(template, field_name) - != prev_data[field_name])): - data[field_name] = getattr(template, field_name) - if data: - Tax.write([new_tax], data) template2tax[self.id] = new_tax.id new_id = template2tax[self.id] @@ -596,8 +535,8 @@ class Tax(ModelSQL, ModelView): none: tax = none ''' __name__ = 'account.tax' - name = fields.Char('Name', required=True, translate=True) - description = fields.Char('Description', required=True, translate=True, + name = fields.Char('Name', required=True) + description = fields.Char('Description', required=True, help="The name that will be used in reports") group = fields.Many2One('account.tax.group', 'Group', states={ @@ -945,9 +884,6 @@ class Tax(ModelSQL, ModelView): value, used to convert template id into tax. The dictionary is filled with new taxes. ''' - pool = Pool() - Lang = pool.get('ir.lang') - Config = pool.get('ir.configuration') if template2tax is None: template2tax = {} @@ -1018,25 +954,6 @@ class Tax(ModelSQL, ModelView): if vals: self.write([self], vals) - prev_lang = self._context.get('language') or Config.get_language() - prev_data = {} - for field_name, field in self.template._fields.iteritems(): - if getattr(field, 'translate', False): - prev_data[field_name] = getattr(self.template, field_name) - for lang in Lang.get_translatable_languages(): - if lang == prev_lang: - continue - with Transaction().set_context(language=lang): - tax = self.__class__(self.id) - data = {} - for field_name, field in tax.template._fields.iteritems(): - if (getattr(field, 'translate', False) - and (getattr(tax.template, field_name) - != prev_data[field_name])): - data[field_name] = getattr(tax.template, - field_name) - if data: - self.write([tax], data) template2tax[self.template.id] = self.id for child in self.childs: @@ -1195,7 +1112,7 @@ class TaxLine(ModelSQL, ModelView): class TaxRuleTemplate(ModelSQL, ModelView): 'Tax Rule Template' __name__ = 'account.tax.rule.template' - name = fields.Char('Name', required=True, translate=True) + name = fields.Char('Name', required=True) kind = fields.Selection(KINDS, 'Kind', required=True) lines = fields.One2Many('account.tax.rule.line.template', 'rule', 'Lines') account = fields.Many2One('account.account.template', 'Account Template', @@ -1228,8 +1145,6 @@ class TaxRuleTemplate(ModelSQL, ModelView): ''' pool = Pool() Rule = pool.get('account.tax.rule') - Lang = pool.get('ir.lang') - Config = pool.get('ir.configuration') if template2rule is None: template2rule = {} @@ -1239,24 +1154,6 @@ class TaxRuleTemplate(ModelSQL, ModelView): vals['company'] = company_id new_rule, = Rule.create([vals]) - prev_lang = self._context.get('language') or Config.get_language() - prev_data = {} - for field_name, field in self._fields.iteritems(): - if getattr(field, 'translate', False): - prev_data[field_name] = getattr(self, field_name) - for lang in Lang.get_translatable_languages(): - if lang == prev_lang: - continue - with Transaction().set_context(language=lang): - template = self.__class__(self.id) - data = {} - for field_name, field in template._fields.iteritems(): - if (getattr(field, 'translate', False) - and (getattr(self, field_name) - != prev_data[field_name])): - data[field_name] = getattr(self, field_name) - if data: - Rule.write([new_rule], data) template2rule[self.id] = new_rule.id return template2rule[self.id] @@ -1264,7 +1161,7 @@ class TaxRuleTemplate(ModelSQL, ModelView): class TaxRule(ModelSQL, ModelView): 'Tax Rule' __name__ = 'account.tax.rule' - name = fields.Char('Name', required=True, translate=True) + name = fields.Char('Name', required=True) kind = fields.Selection(KINDS, 'Kind', required=True) company = fields.Many2One('company.company', 'Company', required=True, select=True, domain=[ @@ -1305,9 +1202,6 @@ class TaxRule(ModelSQL, ModelView): rule id as value, used to convert template id into tax rule. The dictionary is filled with new tax rules. ''' - pool = Pool() - Lang = pool.get('ir.lang') - Config = pool.get('ir.configuration') if template2rule is None: template2rule = {} @@ -1317,25 +1211,6 @@ class TaxRule(ModelSQL, ModelView): if vals: self.write([self], vals) - prev_lang = self._context.get('language') or Config.get_language() - prev_data = {} - for field_name, field in self.template._fields.iteritems(): - if getattr(field, 'translate', False): - prev_data[field_name] = getattr(self.template, field_name) - for lang in Lang.get_translatable_languages(): - if lang == prev_lang: - continue - with Transaction().set_context(language=lang): - rule = self.__class__(self.id) - data = {} - for field_name, field in rule.template._fields.iteritems(): - if (getattr(field, 'translate', False) - and (getattr(rule.template, field_name) - != prev_data[field_name])): - data[field_name] = getattr(rule.template, - field_name) - if data: - self.write([rule], data) template2rule[self.template.id] = self.id diff --git a/tests/test_account.py b/tests/test_account.py index f2ccb86ed8..2055cac00d 100644 --- a/tests/test_account.py +++ b/tests/test_account.py @@ -37,17 +37,16 @@ class AccountTestCase(ModuleTestCase): 'account.fiscalyear.balance_non_deferral', type='wizard') self.tax = POOL.get('account.tax') self.party = POOL.get('party.party') + self.model_data = POOL.get('ir.model.data') def test0010account_chart(self): 'Test creation of minimal chart of accounts' with Transaction().start(DB_NAME, USER, context=CONTEXT) as transaction: - account_template, = self.account_template.search([ - ('parent', '=', None), - ]) - tax_account, = self.account_template.search([ - ('name', '=', 'Main Tax'), - ]) + account_template = self.account_template(self.model_data.get_id( + 'account', 'account_template_root_en')) + tax_account = self.account_template(self.model_data.get_id( + 'account', 'account_template_tax_en')) with Transaction().set_user(0): tax_code = self.tax_code_template() tax_code.name = 'Tax Code' diff --git a/tests/tools.py b/tests/tools.py index 381fa9541b..429acbbe37 100644 --- a/tests/tools.py +++ b/tests/tools.py @@ -38,11 +38,16 @@ def create_fiscalyear(company=None, today=None, config=None): def create_chart(company=None, config=None): "Create chart of accounts" AccountTemplate = Model.get('account.account.template', config=config) + ModelData = Model.get('ir.model.data') if not company: company = get_company() + data, = ModelData.find([ + ('module', '=', 'account'), + ('fs_id', '=', 'account_template_root_en'), + ], limit=1) - account_template, = AccountTemplate.find([('parent', '=', None)]) + account_template = AccountTemplate(data.db_id) create_chart = Wizard('account.create_chart') create_chart.execute('account') diff --git a/tryton.cfg b/tryton.cfg index ab1045e2f9..fe5d4e5ac1 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -16,3 +16,12 @@ xml: move_template.xml tax.xml party.xml + minimal_chart_bg.xml + minimal_chart_ca.xml + minimal_chart_de.xml + minimal_chart_en.xml + minimal_chart_es.xml + minimal_chart_fr.xml + minimal_chart_nl.xml + minimal_chart_ru.xml + minimal_chart_sl.xml