1
# -*- encoding: utf-8 -*-
2
##############################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation, either version 3 of the License, or
11
# (at your option) any later version.
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
##############################################################################
27
form_pagar = """<?xml version="1.0"?>
28
<form string="Pagar Anticipos">
29
<field name="anticipos_ids" height="320" width="780" domain="[('state','=','confirmado')]"/>
32
form_confirmar = """<?xml version="1.0"?>
33
<form string="Confirmar Anticipos">
34
<field name="anticipos_ids" height="320" width="780" domain="[('state','=','borrador')]"/>
38
'anticipos_ids': {'string': 'Anticipos', 'type': 'many2many', 'relation': 'hr.anticipo', 'required': True},
41
class wizard_pagar_anticipo(wizard.interface):
42
def _get_defaults(self, cr, uid, data, context={}):
43
if data['model'] == 'hr.anticipo':
44
data['form']['anticipos_ids'] = data['ids']
47
def _pagar_anticipos(self, cr, uid, data, context):
48
pool = pooler.get_pool(cr.dbname)
49
for ant_id in data['form']['anticipos_ids'][0][2]:
50
anticipo = pool.get('hr.anticipo').browse(cr, uid, ant_id)
51
anticipo.pagar_anticipo(self, cr, uid, ant_id)
55
'actions': [_get_defaults],
56
'result': {'type':'form', 'arch':form_pagar, 'fields':fields, 'state':[('end','Cancelar','gtk-no'),('pagar_anticipos','Pagar','gtk-yes')]}
60
'result': {'type':'action', 'action':_pagar_anticipos, 'state':'end'}
63
wizard_pagar_anticipo('wizard_pagar_anticipos')
66
class wizard_confirmar_anticipo(wizard.interface):
67
def _get_defaults(self, cr, uid, data, context={}):
68
if data['model'] == 'hr.anticipo':
69
data['form']['anticipos_ids'] = data['ids']
72
def _confirmar_anticipos(self, cr, uid, data, context):
73
pool = pooler.get_pool(cr.dbname)
74
for ant_id in data['form']['anticipos_ids'][0][2]:
75
anticipo = pool.get('hr.anticipo').browse(cr, uid, ant_id)
76
anticipo.confirmar_anticipo(self, cr, uid, ant_id)
80
'actions': [_get_defaults],
81
'result': {'type':'form', 'arch':form_confirmar, 'fields':fields, 'state':[('end','Cancelar','gtk-no'),('confirmar_anticipos','confirmar','gtk-yes')]}
83
'confirmar_anticipos': {
85
'result': {'type':'action', 'action':_confirmar_anticipos, 'state':'end'}
88
wizard_confirmar_anticipo('wizard_confirmar_anticipos')