Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
1875 มุมมอง

I need to create an automation so that no one can close an opportunity until and unless a quotation is made against it.

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Thank you, I think 2nd option suits us better. Can you guide how it can be done. Apologies I am new to Odoo


อวตาร
ละทิ้ง

First, create a custom module that inherits from the crm.lead model and include the following code:

from odoo import models, fields, api, _
from odoo.exceptions import UserError

class CustomCrmLead(models.Model):
_inherit = 'crm.lead'

def action_set_won_rainbowman(self):
if not self.quotation_count:
raise UserError(_("This opportunity cannot be marked as 'Won' until a quotation has been created."))
return super(CustomCrmLead, self).action_set_won_rainbowman()

คำตอบที่ดีที่สุด

I think you want to ensure that a lead can only be moved to the "Won" stage if an order has been created from it.

Here are two possible approaches:

  1. Hide the "Won" button unless an order is associated with the lead.
  2. Display a user error when the "Won" button is clicked without an associated order, prompting the user to create an order first.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ส.ค. 25
489
2
ส.ค. 25
1508
0
ก.พ. 25
1614
1
ส.ค. 25
2223
1
พ.ย. 24
155