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: Vauxoo C.A.
9
# Planified by: Nhomar Hernandez
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
################################################################################
26
from osv import fields, osv
28
from tools.translate import _
29
from tools import config
31
import decimal_precision as dp
35
class change_number(osv.osv_memory):
38
_name = 'change.number'
40
'number':fields.char('New Number',20,help="Enter the new number of the invoice"),
41
'sure':fields.boolean('Are sure?',help="Select to number change"),
45
def change_number(self,cr,uid,ids,context=None):
48
invo_obj = self.pool.get('account.invoice')
49
move_obj = self.pool.get('account.move')
50
if context.get('active_id'):
51
wzr_brw = self.browse(cr,uid,ids,context=context)[0]
53
invo_brw = invo_obj.browse(cr,uid,context.get('active_id'),context=context)
54
invo_brw.move_id and move_obj.write(cr,uid,[invo_brw.move_id.id],{'name':wzr_brw.number},context=context)
55
invo_obj.write(cr,uid,[invo_brw.id],{'internal_number':wzr_brw.number},context=context)
57
raise osv.except_osv(_('Invalid action !'),_("Must be sure the operation"))
58
return {'type': 'ir.actions.act_window_close'}