~mikel-martin/openerp-spain/6.1-imp-paypal-tpvvirtual

« back to all changes in this revision

Viewing changes to l10n_es_prev_tesoreria/prev_tesoreria_plantilla.py

  • Committer: Mikel
  • Date: 2012-09-08 16:13:08 UTC
  • mfrom: (303.1.6 6.1)
  • Revision ID: mikel.martin@gmail.com-20120908161308-koeyiukn7lmw7p7k
[MERGE] 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- encoding: utf-8 -*-
 
2
##############################################################################
 
3
#
 
4
#    Avanzosc - Avanced Open Source Consulting
 
5
#    Copyright (C) 2010 - 2011 Avanzosc <http://www.avanzosc.com>
 
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
 
 
22
import time
 
23
import decimal_precision as dp
 
24
 
 
25
from osv import osv
 
26
from osv import fields
 
27
 
 
28
class l10n_es_tesoreria_plantilla(osv.osv):
 
29
    _name = 'l10n.es.tesoreria.plantilla'
 
30
    _description = 'Plantilla Predicción de tesorería'
 
31
 
 
32
    _columns = {
 
33
        'name': fields.char('Descripción', size=64),
 
34
        'pagos_period': fields.one2many('l10n.es.tesoreria.pagos.period.plan', 'plan_tesoreria_id', 'Pagos Periodicos'),
 
35
        'pagos_var': fields.one2many('l10n.es.tesoreria.pagos.var.plan', 'plan_tesoreria_id', 'Pagos Variables'),
 
36
    }
 
37
        
 
38
l10n_es_tesoreria_plantilla()
 
39
 
 
40
class l10n_es_tesoreria_pagos_period_plan(osv.osv):
 
41
    _name = 'l10n.es.tesoreria.pagos.period.plan'
 
42
    _description = 'Plantilla Pagos Periodicos para la tesorería'
 
43
    
 
44
    _columns = {
 
45
        'name': fields.char('Descripción', size=64),
 
46
        'fecha': fields.date('Fecha'),
 
47
        'partner_id': fields.many2one('res.partner', 'Empresa'),
 
48
        'diario': fields.many2one('account.journal', 'Diario', domain=[('type', '=', 'purchase')]),
 
49
        'factura_id': fields.many2one('account.invoice', 'Factura', domain=[('type', '=', 'in_invoice')]),
 
50
        'importe': fields.float('Importe', digits_compute=dp.get_precision('Account')),
 
51
        'pagado': fields.boolean('Facturado/Pagado'),
 
52
        'plan_tesoreria_id': fields.many2one('l10n.es.tesoreria.plantilla', 'Plantilla Tesorería'),
 
53
    } 
 
54
    
 
55
    def onchange_factura(self, cr, uid, ids, factura_id, context=None):
 
56
        values = {}
 
57
        invoice_obj = self.pool.get('account.invoice')
 
58
        if factura_id:
 
59
            invoice = invoice_obj.browse(cr, uid, factura_id)
 
60
            values = {
 
61
                'diario': invoice.journal_id.id
 
62
            }
 
63
        return {'value': values}
 
64
    
 
65
l10n_es_tesoreria_pagos_period_plan()
 
66
 
 
67
class l10n_es_tesoreria_pagos_var_plan(osv.osv):
 
68
    _name = 'l10n.es.tesoreria.pagos.var.plan'
 
69
    _description = 'Plantilla Pagos Variables para la tesorería'
 
70
    
 
71
    _columns = {
 
72
        'name': fields.char('Descripción', size=64),
 
73
        'partner_id': fields.many2one('res.partner', 'Empresa'),
 
74
        'fecha': fields.date('Fecha'),
 
75
        'diario': fields.many2one('account.journal', 'Diario', domain=[('type', '=', 'purchase')]),
 
76
        'factura_id': fields.many2one('account.invoice', 'Factura', domain=[('type', '=', 'in_invoice')]),
 
77
        'importe': fields.float('Importe', digits_compute=dp.get_precision('Account')),
 
78
        'pagado': fields.boolean('Pagado'),
 
79
        'plan_tesoreria_id': fields.many2one('l10n.es.tesoreria.plantilla', 'Plantilla Tesorería'),
 
80
    }
 
81
    
 
82
    def onchange_factura(self, cr, uid, ids, factura_id, context=None):
 
83
        values = {}
 
84
        invoice_obj = self.pool.get('account.invoice')
 
85
        if factura_id:
 
86
            invoice = invoice_obj.browse(cr, uid, factura_id)
 
87
            values = {
 
88
                'diario': invoice.journal_id.id
 
89
            }
 
90
        return {'value': values}
 
91
    
 
92
l10n_es_tesoreria_pagos_var_plan()
 
 
b'\\ No newline at end of file'