Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pattern_import_export/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from . import models
from . import wizard
from .hooks import pre_init_hook
1 change: 1 addition & 0 deletions pattern_import_export/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@
],
"demo": ["demo/demo.xml"],
"installable": True,
"pre_init_hook": "pre_init_hook",
}
27 changes: 27 additions & 0 deletions pattern_import_export/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (C) 2025 Akretion (<http://www.akretion.com>).
# @author Kévin Roche <kevin.roche@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import SUPERUSER_ID, api


def pre_init_hook(cr):
env = api.Environment(cr, SUPERUSER_ID, {})
all_export_lines = env["ir.exports.line"].search([])
line_to_process = all_export_lines.filtered(lambda x: ".id" in x.name)
line_to_delete = env["ir.exports.line"]
for line in line_to_process:
new_name = line.name.replace(".id", "id")
lines_from_export = env["ir.exports.line"].search(
[("export_id", "=", line.export_id.id)]
)
if not any(
[
new_name in line_from_export.name
for line_from_export in lines_from_export
]
):
line.write({"name": new_name})
else:
line_to_delete += line
line_to_delete.unlink()
7 changes: 4 additions & 3 deletions pattern_import_export/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z 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.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* 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 }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down