| 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() |