İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
5045 Görünümler

I want to change the stage at the pipeline, for example when i create a quotation, i see the field quotation_count, then when it changes it can be the action. How i can change the state Proposition?


model:


class customlead(models.Model):

  _inherit='crm.lead'

  @api.onchage('quotation_count')

  def onchangecountq(self):

       if self.quotation_count >0:

            self.stageid=???

Avatar
Vazgeç
En İyi Yanıt

Hi,

You have to find the next stage from the crm.stage model and get its id and then set the stage_id field in the crm.lead model.

Suppose if you need to move it the stage with name "Qualified", you can get the id of stage Qualified as follow,

stage_id = self.env['crm.stage'].search([('name', '=', 'Qualified')], limit=1)

Then,

def onchangecountq(self):

if self.quotation_count >0:

stage_id = self.env['crm.stage'].search([('name', '=', 'Qualified')], limit=1)
self.stage_id= stage_id.id

Thanks

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
5
Ağu 23
21698
1
Tem 15
4880
1
Ağu 25
427
1
Tem 25
2646
2
Tem 25
607