~vauxoo/addons-vauxoo/7.0-changes-in-openerp-alan

241 by Miguel Delgado
1
# -*- encoding: utf-8 -*-
2
##############################################################################
3
#
542.1.58 by Julio Serna
[AUTOPEP8]
4
#    OpenERP, Open Source Management Solution
241 by Miguel Delgado
5
#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6
#    nhomar.hernandez@netquatro.com
7
#
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.
12
#
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.
17
#
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/>.
20
#
21
##############################################################################
542.1.59 by Julio Serna
[V7-MIGRATION]
22
from openerp.osv import fields, osv
23
from openerp.tools.translate import _
24
241 by Miguel Delgado
25
from tools import config
26
import decimal_precision as dp
27
542.1.58 by Julio Serna
[AUTOPEP8]
28
542.1.59 by Julio Serna
[V7-MIGRATION]
29
class baremo_book(osv.Model):
241 by Miguel Delgado
30
    _name = 'baremo.book'
542.1.58 by Julio Serna
[AUTOPEP8]
31
241 by Miguel Delgado
32
    _columns = {
542.1.58 by Julio Serna
[AUTOPEP8]
33
        'name': fields.char('Baremo', size=64, required=True, readonly=False),
34
        'notes': fields.text('Notas', required=True, readonly=False),
543.2.49 by Julio Serna
[AUTOPEP8]
35
        'bar_ids': fields.one2many('baremo', 'bar_id', 'Dias de Emision',
36
                                   required=False),
241 by Miguel Delgado
37
    }
38
    _defaults = {
543.2.49 by Julio Serna
[AUTOPEP8]
39
        'name': lambda *a: 'DEBE ESCRIBIR UNA NOTA REFERENTE A ESTE BAREMO \
40
            PARA SER USADO EN EL REPORTE DE COMISIONES, COMO POR EJEMPLO, LOS\
41
            DESCUENTOS NEGATIVOS REPRESENTAN LOS SOBRE PRECIOS REALIZADOS A\
42
            LOS PRODUCTOS PARA COMPENSAR EN PAGO RETARDADO POR PARTE DEL\
43
            CLIENTE',
241 by Miguel Delgado
44
    }
542.1.59 by Julio Serna
[V7-MIGRATION]
45
46
47
class baremo(osv.Model):
241 by Miguel Delgado
48
    """
49
    OpenERP Model : baremo
50
    """
542.1.58 by Julio Serna
[AUTOPEP8]
51
241 by Miguel Delgado
52
    _name = 'baremo'
53
    _order = "number asc"
54
55
    _columns = {
543.2.49 by Julio Serna
[AUTOPEP8]
56
        'name': fields.char('Nombre', size=64, required=True,
57
                    readonly=False, help="Nombre del termino de Vencimiento"),
58
        'number': fields.integer('Dias',
59
                    help="Dias desde emision de la factura", required=True),
60
        'disc_ids': fields.one2many('baremo.discount',
61
                                    'disc_id', 'Comision x Dscto.',
62
                    required=False, help="Comision x Dscto x Dia"),
542.1.58 by Julio Serna
[AUTOPEP8]
63
        'bar_id': fields.many2one('baremo.book', 'Padre', required=False),
241 by Miguel Delgado
64
    }
65
    _defaults = {
66
        'name': lambda *a: None,
67
    }
542.1.59 by Julio Serna
[V7-MIGRATION]
68
69
70
class baremo_discount(osv.Model):
241 by Miguel Delgado
71
    """
72
    OpenERP Model : baremo_discount
73
    """
542.1.58 by Julio Serna
[AUTOPEP8]
74
241 by Miguel Delgado
75
    _name = 'baremo.discount'
76
    _order = "porc_disc asc"
77
    _columns = {
543.2.49 by Julio Serna
[AUTOPEP8]
78
        'name': fields.char('Nombre', size=64, required=False, readonly=False,
79
                    help="No Usado"),
80
        'porc_disc': fields.float('% Dcto',
81
                  digits_compute=dp.get_precision(
82
                      'Commission'),
83
                  help="% de Descuento por producto", required=True),
84
        'porc_com': fields.float('% Com.',
85
                 digits_compute=dp.get_precision('Commission'),
86
                 help="% de Comision @ porcentaje Descuento", required=True),
542.1.58 by Julio Serna
[AUTOPEP8]
87
        'disc_id': fields.many2one('baremo', 'Baremo', required=False),
241 by Miguel Delgado
88
    }
89
    _defaults = {
90
        'name': lambda *a: None,
91
    }