Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
2741 Zobrazení

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

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Nejlepší odpověď

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'}

Avatar
Zrušit
Autor

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

Related Posts Odpovědi Zobrazení Aktivita
1
kvě 25
699
1
bře 18
4256
0
zář 22
1838
2
bře 22
2935
0
pro 19
1805