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 a85061b commit aa50830
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 31 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
17 changes: 6 additions & 11 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 Expand Up @@ -111,13 +109,10 @@ def save_directly_to_table(cr, Model, field, Field, main_images):
if field and not Field.attachment:
fields.append(field + " = " + "%(image)s")
query = """
UPDATE %(table)s
SET %(fields)s
WHERE id = %%(id)s
""" % {
"table": Model._table,
"fields": ", ".join(fields),
}
UPDATE {table}
SET {fields}
WHERE id = %(id)s
""".format(table=Model._table, fields=", ".join(fields))
for main_image in main_images:
params = {"id": main_image.owner_id}
if field and not Field.attachment:
Expand Down
6 changes: 3 additions & 3 deletions base_multi_image/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-06 02:24+0000\n"
"PO-Revision-Date: 2024-09-09 10:06+0000\n"
"PO-Revision-Date: 2024-09-11 09:06+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n"
"Language: it\n"
Expand Down Expand Up @@ -150,12 +150,12 @@ msgstr "Ultima modifica il"
#. module: base_multi_image
#: model:ir.model.fields,field_description:base_multi_image.field_base_multi_image_image__write_uid
msgid "Last Updated by"
msgstr "Last Updated by"
msgstr "Ultimo aggiornamento di"

#. module: base_multi_image
#: model:ir.model.fields,field_description:base_multi_image.field_base_multi_image_image__write_date
msgid "Last Updated on"
msgstr "Last Updated on"
msgstr "Ultimo aggiornamento il"

#. module: base_multi_image
#: model:ir.model.fields,field_description:base_multi_image.field_base_multi_image_image__load_from
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
3 changes: 2 additions & 1 deletion base_multi_image/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
* Shepilov Vladislav <[email protected]>
* `Greenice <https://www.greenice.com>`_:

* Fernando La Chica <[email protected]>
* Fernando La Chica <[email protected]>
* Ugne Sinkeviciene <[email protected]>
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 aa50830

Please sign in to comment.