[IMP]Yaltik DSL : allow custom name on act_window

This commit is contained in:
Fabien BOURGEOIS 2025-01-16 22:43:45 +01:00
parent d15f1f1843
commit 7e015e1cad
2 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2019-2024 Fabien Bourgeois <fabien@yaltik.com> # Copyright 2019-2025 Fabien Bourgeois <fabien@yaltik.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
@ -19,7 +19,7 @@
'name': 'Yaltik Odoo DSL base module and fns', 'name': 'Yaltik Odoo DSL base module and fns',
'summary': 'Yaltik Odoo Domain Specific Language base module and functions', 'summary': 'Yaltik Odoo Domain Specific Language base module and functions',
'description': """ Yaltik Odoo Domain Specific Language base module and functions """, 'description': """ Yaltik Odoo Domain Specific Language base module and functions """,
'version': '16.0.0.5.16', 'version': '16.0.0.5.17',
'category': 'Yaltik', 'category': 'Yaltik',
'author': 'Fabien Bourgeois', 'author': 'Fabien Bourgeois',
'license': 'AGPL-3', 'license': 'AGPL-3',

View File

@ -1,4 +1,4 @@
# Copyright 2019-2024 Fabien Bourgeois <fabien@yaltik.com> # Copyright 2019-2025 Fabien Bourgeois <fabien@yaltik.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
@ -45,7 +45,10 @@ calendar = lambda *args: xmln('calendar', *args)
def act_window_model(model, attrs): def act_window_model(model, attrs):
""" Build new act_window from model and args """ """ Build new act_window from model and args """
xmlid = '%s_view_action' % (model.replace('.', '_')) xmlid = '%s_view_action' % (model.replace('.', '_'))
name = '%s Action' % ' '.join(map(lambda w: w.capitalize(), model.split('.'))) if 'name' in attrs:
name = attrs['name']
else:
name = '%s Action' % ' '.join(map(lambda w: w.capitalize(), model.split('.')))
attrs_clone = attrs.copy() # Avoid side-effect attrs_clone = attrs.copy() # Avoid side-effect
attrs_clone.update( attrs_clone.update(
{'name': name, 'res_model': model, 'type': 'ir.actions.act_window'} {'name': name, 'res_model': model, 'type': 'ir.actions.act_window'}