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

I am trying to figure out how "Actions" work in Odoo 10 Community, and wanted to edit a "feature": When an opportunity is at 100% and/or "Marked as won", it should set the corresponding contact-boolean "Is a Customer" to "True" and send an email.

How can I achieve that?

(Sidequestion: Shouldn't Odoo set "Is a Customer" to "True" automatically when a opportunity is won by default?)

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

There is a function '_onchange_stage_id_values' in 'crm.lead' model. You can detect the stage changes from here, i.e to when the opportunity is marked 'Won' and from there, you can set the corresponding contact-boolean "Is a Customer" to "True" and send an email.

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

Have a look into code

1    @api.onchange('stage_field')
2    def _onchange_method_name(self):
3        if self.your_stage == 'ABC':
4            self.your_boolean_field = False
5        else:            
6            self. your_boolean_field = True

Hope its helped out you....

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 10 19
7771
0
thg 1 16
4273
0
thg 3 15
4305
2
thg 8 25
644
2
thg 5 25
1539