Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
2810 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 25
765
1
thg 3 18
4323
0
thg 9 22
1859
2
thg 3 22
2971
0
thg 12 19
1805