Skip to content

[15.0][IMP] template_content_swapper: allow manual editing of the name#1305

Open
smorita7749 wants to merge 1 commit into
OCA:15.0from
qrtl:15.0-imp-template_content_swapper
Open

[15.0][IMP] template_content_swapper: allow manual editing of the name#1305
smorita7749 wants to merge 1 commit into
OCA:15.0from
qrtl:15.0-imp-template_content_swapper

Conversation

@smorita7749

@smorita7749 smorita7749 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

This change allows users to edit the mapping name manually.
@qrtl QT6819

@OCA-git-bot OCA-git-bot added series:15.0 mod:template_content_swapper Module template_content_swapper labels Jun 25, 2026
return self.env["res.lang"].get_installed()

name = fields.Char(compute="_compute_name", store=True, readonly=True)
name = fields.Char()

@AungKoKoLin1997 AungKoKoLin1997 Jun 25, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it possible just by changing readonly to False?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to add name before inserting content values? Is that the reason?

return self.env["res.lang"].get_installed()

name = fields.Char(compute="_compute_name", store=True, readonly=True)
name = fields.Char()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name = fields.Char()
name = fields.Char(required=True)

Comment on lines +40 to +44
@api.onchange("content_from", "content_to", "name")
def _onchange_content(self):
"""Auto-fill the name from the contents while empty; keep manual names."""
if not self.name and self.content_from and self.content_to:
self.name = f"{self.content_from} -> {self.content_to}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep it simple, as names currently tend to look cluttered.

Suggested change
@api.onchange("content_from", "content_to", "name")
def _onchange_content(self):
"""Auto-fill the name from the contents while empty; keep manual names."""
if not self.name and self.content_from and self.content_to:
self.name = f"{self.content_from} -> {self.content_to}"
@api.onchange("content_from")
def _onchange_content(self):
"""Auto-fill the name from the contents while empty; keep manual names."""
if not self.name and self.content_from:
self.name = self.content_from

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:template_content_swapper Module template_content_swapper series:15.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants