3993a5df0666d6146808113e5d8768bfdff4e7ee
[odoo/odoo.git] / addons / crm_partner_assign / wizard / crm_merge_opportunity.py
1 # -*- coding: utf-8 -*-
2 ##############################################################################
3 #
4 #    OpenERP, Open Source Management Solution
5 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
6 #
7 #    This program is free software: you can redistribute it and/or modify
8 #    it under the terms of the GNU Affero General Public License as
9 #    published by the Free Software Foundation, either version 3 of the
10 #    License, or (at your option) any later version.
11 #
12 #    This program is distributed in the hope that it will be useful,
13 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 #    GNU Affero General Public License for more details.
16 #
17 #    You should have received a copy of the GNU Affero General Public License
18 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 #
20 ##############################################################################
21 from osv import osv, fields
22 from tools.translate import _
23
24
25 class crm_merge_opportunity_assign_partner(osv.osv_memory):
26     """Merge two Opportunities"""
27
28     _inherit = 'crm.merge.opportunity'
29     
30     def _update_data(self, op_ids, oldest_opp):
31                 data = super(crm_merge_opportunity_assign_partner, self)._update_data(op_ids, oldest_opp)
32                         
33                 new_data = {
34                         'partner_latitude': self._get_first_not_null('partner_latitude', op_ids, oldest_opp),
35                         'partner_longitude': self._get_first_not_null('partner_longitude', op_ids, oldest_opp),
36                         'partner_assigned_id': self._get_first_not_null_id('partner_assigned_id', op_ids, oldest_opp), 
37                         'date_assign' : self._get_first_not_null('date_assign', op_ids, oldest_opp),
38                 }
39                 data.update(new_data)
40                 return data
41
42 crm_merge_opportunity_assign_partner()