コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
2789 ビュー

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

アバター
破棄
最善の回答

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

アバター
破棄
最善の回答

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

アバター
破棄
著作者

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

関連投稿 返信 ビュー 活動
1
5月 25
743
1
3月 18
4293
0
9月 22
1853
2
3月 22
2966
0
12月 19
1805