Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
2893 Widoki

How can I change the default contact type [Contact, Invoice Address, Delivery Address, Other Address, Private Address] when creating new Contacts?

Awatar
Odrzuć
Najlepsza odpowiedź

If the contacts are created via the contact module?

Then it should work via the "Context Value" in the action.

f.e.: {'default_is_company': False, 'default_type': 'other'}

Awatar
Odrzuć
Autor

It's not via the contact module, when the customer registers himself, I can't change the address type.

Najlepsza odpowiedź

Hello Fojja Bilel,

You can use default_get method below is one of the example of the default_get method you can overwrite it based on your need and use it.

    @api.model
    def default_get(self, fields):
        vals = super(AccountBankStmtCashWizard, self).default_get(fields)
        balance = self.env.context.get('balance')
        statement_id = self.env.context.get('statement_id')
        if statement_id:
            vals['start_bank_stmt_ids'] = statement_id.id
        return vals


Hope it will work for you.
Thanks

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
maj 25
907
1
mar 18
4433
0
wrz 22
1925
2
mar 22
3054
0
gru 19
1805