Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3 Antwoorden
7712 Weergaven

i have module which has three field.name,firstname and lastname,when user save it firstname and lastname

concatenate in name field,here name field must be readonly mod.

Avatar
Annuleer
Beste antwoord

Hello Vijay,

This will help you.

name = fields.Char(compute='_compute_name', store="True")
firstname = fields.Char()
lastname = fields.Char()

@api.depends('firstname', 'lastname')
def _compute_name(self):
    for record in self:
        record.name = record.firstname + record.lastname

Avatar
Annuleer
Beste antwoord

Hello, I think you've three options.

- Overriding the create and write functions.

-Use onchange method in the firstname and lastname: but if you used onchange method to modify a readonly field this will not update the field in DB, so you need to make an invisible field, as workaround.

-Make the name field as a functional field.

Avatar
Annuleer
Auteur

how to make name as functional field any demo function?

Gerelateerde posts Antwoorden Weergaven Activiteit
1
okt. 24
6452
9
jul. 21
63542
8
nov. 19
8143
8
apr. 25
29388
3
aug. 24
16410