2
# -*- encoding: utf-8 -*-
3
###########################################################################
4
# Module Writen to OpenERP, Open Source Management Solution
5
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
7
###############Credits######################################################
8
# Coded by: Yanina Aular <yanina.aular@vauxoo.com>
9
# Planified by: Humberto Arocha
10
# Audited by: Vauxoo C.A.
11
#############################################################################
12
# This program is free software: you can redistribute it and/or modify
13
# it under the terms of the GNU Affero General Public License as published by
14
# the Free Software Foundation, either version 3 of the License, or
15
# (at your option) any later version.
17
# This program is distributed in the hope that it will be useful,
18
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
# GNU Affero General Public License for more details.
22
# You should have received a copy of the GNU Affero General Public License
23
# along with this program. If not, see <http://www.gnu.org/licenses/>.
24
################################################################################
27
from osv import fields
28
from tools.translate import _
30
class wiz_updatename(osv.osv_memory):
31
_name = 'wiz.updatename'
32
_description = "Wizard that changes the partner name"
34
def set_name(self, cr, uid, ids, context):
35
data = self.pool.get('wiz.updatename').read(cr, uid, ids)[0]
38
raise osv.except_osv(_("Error!"), _("Please confirm that you want to do this by checking the option"))
40
partner_obj = self.pool.get('res.partner')
41
name_partner = data['name']
43
partner_obj.write(cr, uid, context['active_id'], {'name': name_partner}, context=context)
47
'name': fields.char('Name', 256, required=True),
48
'sure': fields.boolean('Are you sure?'),
51
def _get_name(self, cr, uid, context=None):
54
partner_obj = self.pool.get('res.partner')
55
partner = partner_obj.search(cr, uid, [('id', '=', context['active_id'])])
56
partner_o = partner_obj.browse(cr, uid, partner[0])
57
return partner_o and partner_o.name or False