Skip to Content
मेन्यू
This question has been flagged
2 Replies
2886 Views

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

Avatar
Discard
Best Answer

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
Discard
Author

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

Best Answer

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
Discard
Related Posts Replies Views Activity
1
मई 25
898
1
मार्च 18
4427
0
सित॰ 22
1923
2
मार्च 22
3044
0
दिस॰ 19
1805