Skip to content

Commit

Permalink
[17.0][MIG] base_multi_image: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
psugne committed Oct 9, 2024
1 parent 035cc19 commit 4a3f44c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 20 deletions.
13 changes: 7 additions & 6 deletions base_multi_image/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Multiple images base
====================

..
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
Expand All @@ -17,13 +17,13 @@ Multiple images base
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
:target: https://github.com/OCA/server-tools/tree/16.0/base_multi_image
:target: https://github.com/OCA/server-tools/tree/17.0/base_multi_image
:alt: OCA/server-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-base_multi_image
:target: https://translation.odoo-community.org/projects/server-tools-17-0/server-tools-17-0-base_multi_image
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -148,7 +148,8 @@ Contributors
* Shepilov Vladislav <[email protected]>
* `Greenice <https://www.greenice.com>`_:

* Fernando La Chica <[email protected]>
* Fernando La Chica <[email protected]>
* Ugne Sinkeviciene <[email protected]>

Other credits
~~~~~~~~~~~~~
Expand All @@ -171,6 +172,6 @@ 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.

This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/16.0/base_multi_image>`_ project on GitHub.
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/17.0/base_multi_image>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion base_multi_image/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
"name": "Multiple images base",
"summary": "Allow multiple images for database objects",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"author": "Tecnativa, "
"Antiun Ingeniería, S.L., Sodexis, "
"LasLabs, OpenFire, "
Expand Down
6 changes: 2 additions & 4 deletions base_multi_image/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ def post_init_hook_for_submodules(cr, model, field):
with cr.savepoint():
column_exists = table_has_column(cr, table, field)
if column_exists:
cr.execute(
"SELECT id FROM %(table)s WHERE %(field)s IS NOT NULL"
) # pylint: disable=sql-injection
cr.execute("SELECT id FROM %(table)s WHERE %(field)s IS NOT NULL") # pylint: disable=sql-injection
else:
cr.execute(
"""
Expand All @@ -52,7 +50,7 @@ def post_init_hook_for_submodules(cr, model, field):
{
"owner_id": record.id,
"owner_model": model,
"owner_ref_id": "%s,%s" % (model, record.id),
"owner_ref_id": f"{model},{record.id}",
"image_1920": record[field],
},
)
Expand Down
2 changes: 1 addition & 1 deletion base_multi_image/models/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _compute_owner_ref_id(self):
"""Get a reference field based on the split model and id fields."""
for s in self:
if s.owner_model:
s.owner_ref_id = "{0.owner_model},{0.owner_id}".format(s)
s.owner_ref_id = f"{s.owner_model},{s.owner_id}"

Check warning on line 72 in base_multi_image/models/image.py

View check run for this annotation

Codecov / codecov/patch

base_multi_image/models/image.py#L72

Added line #L72 was not covered by tests

@api.depends("owner_id", "owner_model")
def _compute_show_technical(self):
Expand Down
9 changes: 1 addition & 8 deletions base_multi_image/views/image_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
<form string="Image">
<sheet>
<group>
<group
string="Owner"
attrs="{
'invisible': [
('show_technical', '=', False),
],
}"
>
<group string="Owner" invisible="show_technical == False">
<field name="show_technical" invisible="True" />
<field name="owner_model" />
<field name="owner_id" />
Expand Down

0 comments on commit 4a3f44c

Please sign in to comment.