~inddiana/sisb/edgar_presupuesto_documento_imputacion

« back to all changes in this revision

Viewing changes to l10n_ve_presupuesto/model/l10n_ve_accion_presupuestaria.py


[IMP] Se agrega estado a las acciones especificas para poder cerrarlas.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
        'type': fields.selection([
30
30
            ('proyecto','Proyecto'),
31
31
            ('centralizada','Accion Central'),
32
 
            ]),
 
32
            ], 'Tipo'),
33
33
        'ejecutado_central_ids': fields.one2many('presupuesto.ejecutado.central','accion_central_id', 'Detalle Presupuestario'),
34
34
    }
35
35
    
82
82
        'imp_lines_ids': fields.one2many('presupuesto.imputacion.linea', 'accion_especifica_id', 'Lineas de Imputacion'),
83
83
        'ejercicio_id': fields.many2one('ejercicio.presupuestario', 'Ejercicio Presupuestario'),
84
84
        'ejecutado_id': fields.one2many('presupuesto.ejecutado', 'accion_especifica_id', 'Detalle Presupuestario'),
85
 
    }
 
85
        'state': fields.selection([
 
86
            ('draft','Abierta'),
 
87
            ('close','Cerrada'),
 
88
            ], 'Estado'),
 
89
    }
 
90
    
 
91
    
 
92
    _defaults = {
 
93
        'state' : 'draft',
 
94
    }
 
95
    
 
96
    
 
97
    def button_close(self, cr, uid, ids, context=None):
 
98
        if context is None:
 
99
            context = {}
 
100
        
 
101
        for acc in self.browse(cr, uid, ids, context=context):
 
102
            if acc.state == 'draft':
 
103
                self.write(cr, uid, acc.id, {'state': 'close'}, context=context)
 
104
        
 
105
        return True
 
106
        
 
107
        
 
108
    def button_draft(self, cr, uid, ids, context=None):
 
109
        if context is None:
 
110
            context = {}
 
111
        
 
112
        
 
113
        for acc in self.browse(cr, uid, ids, context=context):
 
114
            if acc.state == 'close':
 
115
                self.write(cr, uid, acc.id, {'state': 'draft'}, context=context)
 
116
        
 
117
        return True
 
118
    
86
119
    
87
120
accion_especifica()
88
121