Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
5111 Zobrazení

Hi all!

 I’m a new guy in odoo & Python and actually need only to add integration with our system through Automated Actions in Odoo

Now, just as a proof-of-concept, in CRM module, I want to have action to register changes in Opportunity

There I specified trigger condition=“On Creation or Update”, Before Update Domain=“Match all records”, Action=”Python code”

 As model I selected Lead/Opportunity and want to have this action triggered when opportunity changed.

 The question: how to get Opportunity record in Python code?

 record.name there equals crm.lead and I can’t understand how to get instance or Opportunity record.

 Could you help me how to do that in Python in context of automated action?
Thank you in advance

Avatar
Zrušit
Autor Nejlepší odpověď

Should I use syntax like this?

opportunity = env['crm.opportunity.report'].search([('id', '=', record.id)])
value = opportunity.expected_revenue

Could you suggest the best place to easily find model field behind visual elements?

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
3
čvc 20
9094
1
dub 20
13451
3
dub 24
1671
1
zář 23
1581
0
kvě 21
4001