跳至内容
菜单
此问题已终结
2 回复
1433 查看

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
6月 25
1007
0
2月 25
1300
1
1月 25
1712
1
11月 24
155
2
4月 24
1830