Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(101)

Unified Diff: opportunity.py

Issue 2736043: Parties associated to open Leads and Opprtunities
Patch Set: Created 15 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | opportunity.xml » ('j') | opportunity.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: opportunity.py
===================================================================
--- a/opportunity.py
+++ b/opportunity.py
@@ -850,3 +850,51 @@
return res
SaleOpportunityEmployeeMonthly()
+
+
+class OpenLeadOpportunity(Wizard):
+ 'Open Leads and Opportunities'
+ _name = 'sale_opportunity.open_lead_opportunity'
+ states = {
+ 'init': {
+ 'result': {
+ 'type': 'action',
+ 'action': '_action_open',
+ 'state': 'end',
+ },
+ },
+ }
+
+ def _action_open(self, cursor, user, datas, context=None):
+ """
+ Select distinct parties from the
ced 2010/11/11 17:09:03 missing ending comment
+ """
+ model_data_obj = self.pool.get('ir.model.data')
+ act_window_obj = self.pool.get('ir.action.act_window')
+ wizard_obj = self.pool.get('ir.action.wizard')
+ sale_opportunity_obj = self.pool.get('sale.opportunity')
+ act_window_id = model_data_obj.get_id(cursor, user, 'party',
+ 'act_party_form', context=context)
+ res = act_window_obj.read(cursor, user, act_window_id, context=context)
+ query = (
+ 'SELECT DISTINCT("party") FROM "%s" WHERE "state" IN ' +
ced 2010/11/11 17:09:03 No need of "+" Could you reindent this way: SELEC
+ "('lead', 'opportunity')") % sale_opportunity_obj._table
+ cursor.execute(query)
+ opportunity_ids = [line[0] for line in cursor.fetchall()]
+ res['pyson_domain'] = PYSONEncoder().encode(
+ [('id', 'in', opportunity_ids)])
+
+ model_data_ids = model_data_obj.search(cursor, user, [
+ ('fs_id', '=', 'act_open_lead_opportunity'),
+ ('module', '=', 'sale_opportunity'),
+ ('inherit', '=', False),
+ ], limit=1, context=context)
+ model_data = model_data_obj.browse(cursor, user, model_data_ids[0],
+ context=context)
+ wizard = wizard_obj.browse(cursor, user, model_data.db_id,
+ context=context)
+
+ res['name'] = wizard.name
+ return res
+
+OpenLeadOpportunity()
« no previous file with comments | « no previous file | opportunity.xml » ('j') | opportunity.xml » ('J')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b