mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[FIX] account_chart_update_multilang: hide default language in wizard and ditch decorators as mentioned in code review
This commit is contained in:
@@ -783,8 +783,6 @@ class WizardUpdateChartsAccounts(models.TransientModel):
|
||||
} | specials_mapping.get(name, set())
|
||||
return set(models.MAGIC_COLUMNS) | specials
|
||||
|
||||
@api.model
|
||||
@tools.ormcache("name")
|
||||
def fields_to_include(self, name):
|
||||
"""Get fields that will be used when checking differences.
|
||||
|
||||
|
||||
@@ -17,4 +17,7 @@
|
||||
"account_chart_update",
|
||||
"l10n_multilang",
|
||||
],
|
||||
"data": [
|
||||
"wizards/wizard_chart_update_views.xml",
|
||||
],
|
||||
}
|
||||
|
||||
@@ -8,11 +8,10 @@
|
||||
|
||||
/*
|
||||
:Author: David Goodger (goodger@python.org)
|
||||
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
|
||||
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
Despite the name, some widely supported CSS2 features are used.
|
||||
|
||||
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
@@ -275,7 +274,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
pre.code .ln { color: gray; } /* line numbers */
|
||||
pre.code .ln { color: grey; } /* line numbers */
|
||||
pre.code, code { background-color: #eeeeee }
|
||||
pre.code .comment, code .comment { color: #5C6576 }
|
||||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||
@@ -301,7 +300,7 @@ span.option {
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic, pre.problematic {
|
||||
span.problematic {
|
||||
color: red }
|
||||
|
||||
span.section-subtitle {
|
||||
@@ -435,9 +434,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||
<div class="section" id="maintainers">
|
||||
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
|
||||
<p>This module is maintained by the OCA.</p>
|
||||
<a class="reference external image-reference" href="https://odoo-community.org">
|
||||
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
|
||||
</a>
|
||||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.</p>
|
||||
|
||||
@@ -24,7 +24,9 @@ class WizardUpdateChartsAccount(models.TransientModel):
|
||||
template = self.env.ref(tpl_xmlid)
|
||||
module, xmlid = tpl_xmlid.split(".", 1)
|
||||
rec_xmlid = f"{module}.{self.company_id.id}_{xmlid}"
|
||||
rec = self.env.ref(rec_xmlid)
|
||||
rec = self.env.ref(rec_xmlid, False)
|
||||
if not rec:
|
||||
continue
|
||||
translations = {}
|
||||
for key in self._diff_translate_fields(template, rec):
|
||||
for lang in self._other_langs():
|
||||
@@ -45,12 +47,12 @@ class WizardUpdateChartsAccount(models.TransientModel):
|
||||
"""Find differences by comparing the translations of the fields."""
|
||||
res = {}
|
||||
to_include = self.fields_to_include(template._name)
|
||||
for key in template._fields:
|
||||
if not template._fields[key].translate or key not in to_include:
|
||||
for key in to_include:
|
||||
if not (template._fields.get(key) and template._fields[key].translate):
|
||||
continue
|
||||
for lang in self._other_langs():
|
||||
template_trans = getattr(template.with_context(lang=lang), key)
|
||||
real_trans = getattr(real.with_context(lang=lang), key)
|
||||
template_trans = template.with_context(lang=lang)[key]
|
||||
real_trans = real.with_context(lang=lang)[key]
|
||||
if template_trans != real_trans:
|
||||
res[key] = template[key]
|
||||
return res
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_update_multi_chart_inherit" model="ir.ui.view">
|
||||
<field name="model">wizard.update.charts.accounts</field>
|
||||
<field name="inherit_id" ref="account_chart_update.view_update_multi_chart" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="lang" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user