Odooers论坛

欢迎!

该社区面向专业人士和我们产品和服务的爱好者。
分享和讨论最好的内容和新的营销理念,建立您的专业形象,一起成为更好的营销人员。


0

Sales and CRM relation

形象
odoo
3 注释
形象
丢弃
形象
odoo
-

which odoo version ?

形象
odoo
-

Version 15. I wrote this code but it is not working, can you help?

class CRMLeadInherit(models.Model):

_inherit = 'crm.lead'

@api.onchange('order_ids.state')
def _onchange_quotation_sate(self):
for rec in self:
if rec.order_ids.state=='sale':
rec.stage_id='WON'

形象
odoo
-

Okay 5 minutes i code it >_<

2 答案
0
形象
odoo
最佳答案

This code 

I hope I understood your need and this is the solution you want.
class SaleOrder(models.Model):
_inherit = 'sale.order'
_description = 'mark opportunity as won from sale order wen you confirm order'


def _action_confirm
(self):
opportunity_obj = self.env['crm.lead'].browse(self.opportunity_id.id)
if opportunity_obj.exists():
opportunity_obj.action_set_won_rainbowman()

return super(SaleOrder, self)._action_confirm()

Thanks

7 注释
形象
丢弃
形象
odoo
-

let me try it please

形象
odoo
-

It worked, thank you so much!

形象
odoo
-

sorry but i modified my answer check it.
i forget some things

形象
odoo
-

Yes I marked your answer as the best one. I am more into functional odoo than technical, can I have a way to get in contact with you if I face problems with technical issues? If you don't mind of course. If it is okay with you: kindly provide me with your linked in account or any other social media platform

形象
odoo
-

Sure
- Email address: abude852@gmail.com
- Linkedin : https://www.linkedin.com/in/abdallah-sabeel/
- Whatsapp: +96597618088

Welcome

形象
odoo
-

Thank you for your help!

形象
odoo
-
0
形象
odoo
最佳答案

Hello Moe,

In sale order model we have a Many2one field named "opportunity_id" to "crm.lead" model. By using this field you can access all data of crm record related to that sale order. 

I Hope this will help you. 

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

形象
丢弃