[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 6597a827de
commit efc415894b
2 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,6 @@
# -*- 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
# it under the terms of the GNU Affero General Public License as
@ -19,7 +19,7 @@
'name': 'Yaltik Odoo DSL base module and fns',
'summary': 'Yaltik Odoo Domain Specific Language base module and functions',
'description': """ Yaltik Odoo Domain Specific Language base module and functions """,
'version': '10.0.0.5.16',
'version': '10.0.0.5.17',
'category': 'Yaltik',
'author': 'Fabien Bourgeois',
'license': 'AGPL-3',

View File

@ -1,6 +1,6 @@
# -*- 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
# it under the terms of the GNU Affero General Public License as
@ -48,7 +48,10 @@ act_window = lambda *args: xmln('act_window', *args)
def act_window_model(model, attrs):
""" Build new act_window from model and args """
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.update({'id': xmlid, 'name': name, 'res_model': model})
return act_window(attrs_clone)