Skip to content

Commit b4c63da

Browse files
committed
[MIG] l10n_es_partner: Migration to 17.0
1 parent 20e14c3 commit b4c63da

File tree

8 files changed

+33
-22
lines changed

8 files changed

+33
-22
lines changed

l10n_es_partner/README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ Contributors
104104
- Ismael Calvo <[email protected]>
105105
- Carlos Dauden <[email protected]>
106106
- Manuel Regidor <[email protected]>
107+
- `APSL <https://apsl.tech>`__:
108+
109+
- Javier Antó <[email protected]>
107110

108111
Maintainers
109112
-----------

l10n_es_partner/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
{
99
"name": "Adaptación de los clientes, proveedores y bancos para España",
10-
"version": "16.0.2.1.0",
10+
"version": "17.0.1.0.0",
1111
"author": "ZikZak," "Acysos," "Tecnativa," "Odoo Community Association (OCA)",
1212
"website": "https://github.com/OCA/l10n-spain",
1313
"category": "Localisation/Europe",

l10n_es_partner/models/res_partner.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,26 @@ class ResPartner(models.Model):
1313
display_name = fields.Char(compute="_compute_display_name")
1414

1515
@api.depends("comercial")
16+
@api.depends_context("no_display_commercial")
1617
def _compute_display_name(self):
17-
return super()._compute_display_name()
18-
19-
def _get_name(self):
2018
name_pattern = (
2119
self.env["ir.config_parameter"]
2220
.sudo()
2321
.get_param("l10n_es_partner.name_pattern", default="")
2422
)
25-
origin = super()._get_name()
26-
if (
27-
self.env.context.get("no_display_commercial", False)
28-
or not name_pattern
29-
or not self.comercial
30-
):
31-
return origin
32-
return name_pattern % {"name": origin, "comercial_name": self.comercial}
23+
super()._compute_display_name()
24+
for partner in self:
25+
if (
26+
partner.env.context.get("no_display_commercial", False)
27+
or not name_pattern
28+
or not partner.comercial
29+
):
30+
partner.display_name = partner.complete_name
31+
else:
32+
partner.display_name = name_pattern % {
33+
"name": partner.display_name,
34+
"comercial_name": partner.comercial,
35+
}
3336

3437
@api.model
3538
def _commercial_fields(self):

l10n_es_partner/readme/CONTRIBUTORS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
- Ismael Calvo \<<[email protected]>\>
66
- Carlos Dauden \<<[email protected]>\>
77
- Manuel Regidor \<<[email protected]>\>
8+
- [APSL](https://apsl.tech):
9+
- Javier Antó \<<[email protected]>\>

l10n_es_partner/static/description/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,10 @@ <h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
451451
<li>Ismael Calvo &lt;<a class="reference external" href="mailto:ismael.calvo&#64;factorlibre.com">ismael.calvo&#64;factorlibre.com</a>&gt;</li>
452452
<li>Carlos Dauden &lt;<a class="reference external" href="mailto:carlos.dauden&#64;tecnativa.com">carlos.dauden&#64;tecnativa.com</a>&gt;</li>
453453
<li>Manuel Regidor &lt;<a class="reference external" href="mailto:manuel.regidor&#64;sygel.es">manuel.regidor&#64;sygel.es</a>&gt;</li>
454+
<li><a class="reference external" href="https://apsl.tech">APSL</a>:<ul>
455+
<li>Javier Antó &lt;<a class="reference external" href="mailto:janto&#64;apsl.net">janto&#64;apsl.net</a>&gt;</li>
456+
</ul>
457+
</li>
454458
</ul>
455459
</div>
456460
<div class="section" id="maintainers">

l10n_es_partner/views/res_partner_view.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<field
99
name="comercial"
1010
placeholder="Trade name"
11-
attrs="{'invisible': [('is_company','=', False)]}"
11+
invisible="not is_company"
1212
/>
1313
</field>
1414
</field>
@@ -21,7 +21,7 @@
2121
<field
2222
name="comercial"
2323
placeholder="Trade name"
24-
attrs="{'invisible': [('is_company','=', False)]}"
24+
invisible="not is_company"
2525
/>
2626
</field>
2727
</field>

l10n_es_partner/wizard/l10n_es_partner_wizard.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def import_local(self):
2424
path = os.path.join("l10n_es_partner", "wizard", "data_banks.xml")
2525
with tools.file_open(path) as fp:
2626
tools.convert_xml_import(
27-
self._cr, "l10n_es_partner", fp, {}, "init", noupdate=True
27+
self.env, "l10n_es_partner", fp, {}, "init", noupdate=True
2828
)
2929
return res
3030

@@ -36,7 +36,7 @@ def execute(self):
3636
try:
3737
response = requests.get(
3838
"https://www.bde.es/f/webbde/SGE/regis/REGBANESP_CONESTAB_A.xls",
39-
timeout=5,
39+
timeout=10,
4040
)
4141
response.raise_for_status()
4242
src_file.write(response.content)
@@ -46,6 +46,7 @@ def execute(self):
4646
requests.exceptions.HTTPError,
4747
requests.exceptions.ConnectTimeout,
4848
requests.exceptions.ReadTimeout,
49+
requests.exceptions.ConnectionError,
4950
):
5051
# BDE is forbidding on certain conditions to get the file, so we use a
5152
# local file. Latest update: 2023-10-07
@@ -56,7 +57,7 @@ def execute(self):
5657
# Generate XML and import it
5758
gen_bank_data_xml(src_file_name, dest_file.name)
5859
tools.convert_xml_import(
59-
self._cr, "l10n_es_partner", dest_file.name, {}, "init", noupdate=True
60+
self.env, "l10n_es_partner", dest_file.name, {}, "init", noupdate=True
6061
)
6162
os.remove(src_file.name)
6263
os.remove(dest_file.name)

l10n_es_partner/wizard/l10n_es_partner_wizard.xml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<attribute name="string">Import spanish bank data</attribute>
1616
</form>
1717
<separator position="replace">
18-
<group attrs="{'invisible': [('import_fail', '=', True)]}">
18+
<group invisible="import_fail==True">
1919
<p
2020
colspan="2"
2121
>This wizard will import spanish bank data. You can choose to import it from:</p>
@@ -29,7 +29,7 @@
2929
<label
3030
colspan="2"
3131
for="import_fail"
32-
attrs="{'invisible': [('import_fail', '=', False)]}"
32+
invisible="not import_fail"
3333
string="Something has failed importing data from Internet. You will need to import local data instead."
3434
/>
3535
</separator>
@@ -42,9 +42,7 @@
4242
</button>
4343
<button name="action_next" position="attributes">
4444
<attribute name="string">Import from Internet</attribute>
45-
<attribute
46-
name="attrs"
47-
>{'invisible': [('import_fail', '=', True)]}</attribute>
45+
<attribute name="invisible">import_fail</attribute>
4846
</button>
4947
</data>
5048
</field>

0 commit comments

Comments
 (0)