Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1 Responder
1022 Visualizações

I have a custom model 'customer.account' and one of the field it has is named 'username'.

username = fields.Char(

        string='Username',

        required=True,

        copy=True

    )

In sale.order, I have added a many2one field and in the view i reference it like this:

<field name="customer_account_id"

                    options="{'no_quick_create': True}"

                    context="{'default_customer_id': partner_id, 'default_is_customer_readonly': True}"

                    invisible="partner_id"/>

The problem is that I want whatever the user typed in before clicking the 'create and edit' option to be set as the username for this customer account. I tried using _rec_name = 'username' inside the customer.account model but no luck. What am i missing?

Avatar
Cancelar
Melhor resposta

Hello Daniel Bashev,

I Hope You are doing well,

​Please add that highlighted condition inside the context:
​context="{'default_customer_id': partner_id, 'default_is_customer_readonly': True, 'default_username': name}"

Hope this information helps you.

Thanks & Regards,
Kunjan Patel

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
1
jun. 25
5085
3
jul. 20
11727
4
out. 24
5280
0
nov. 16
4100
1
ago. 15
4632