تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
1753 أدوات العرض

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.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
أغسطس 25
352
2
أغسطس 25
1390
0
فبراير 25
1487
1
يناير 25
2102
1
نوفمبر 24
155