~vauxoo/addons-vauxoo/6.0-trunk

« back to all changes in this revision

Viewing changes to m321_reports/report/amd_computer_shop_report.py

  • Committer: nhomar at vauxoo
  • Date: 2011-06-11 22:55:27 UTC
  • Revision ID: nhomar@vauxoo.com-20110611225527-v2mlv4fbx38j0gg3
[SHELDON ] commiting ortografy

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- encoding: utf-8 -*-
2
 
############################################################################
3
 
#    Module Writen to OpenERP, Open Source Management Solution             #
4
 
#    Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).            #
5
 
#    All Rights Reserved                                                   #
6
 
# Credits######################################################
7
 
#    Coded by: Maria Gabriela Quilarque  <gabrielaquilarque97@gmail.com>   #
8
 
#    Planified by: Nhomar Hernandez                                        #
9
 
#    Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve            #
10
 
#    Audited by: Humberto Arocha humberto@openerp.com.ve                   #
11
 
############################################################################
12
 
#    This program is free software: you can redistribute it and/or modify  #
13
 
#    it under the terms of the GNU 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.                                   #
16
 
#                                                                          #
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 General Public License for more details.                          #
21
 
#                                                                          #
22
 
#    You should have received a copy of the GNU General Public License     #
23
 
#    along with this program.  If not, see <http://www.gnu.org/licenses/>. #
24
 
############################################################################
25
 
import time
26
 
import pooler
27
 
from report import report_sxw
28
 
from openerp.tools.translate import _
29
 
 
30
 
 
31
 
class m321_cs_report(report_sxw.rml_parse):
32
 
 
33
 
    def __init__(self, cr, uid, name, context=None):
34
 
        if context is None:
35
 
            context = {}
36
 
        super(m321_cs_report, self).__init__(cr, uid, name, context=context)
37
 
        self.localcontext.update({
38
 
            'get_date': self._get_date,
39
 
            'get_wh': self._get_wh,
40
 
        })
41
 
 
42
 
    def _get_date(self, obj, aux):
43
 
        aux2 = obj.date_invoice
44
 
        DMY = str(aux2)
45
 
        res = DMY.split('/')
46
 
        if aux == 0:
47
 
            return res[0]
48
 
        if aux == 1:
49
 
            return res[1]
50
 
        if aux == 2:
51
 
            return res[2][0:4]
52
 
 
53
 
    def _get_wh(self, obj):
54
 
        wh_ids = obj.tax_line
55
 
        aux = []
56
 
        for wh in wh_ids:
57
 
            aux.append(wh.tax_id.amount*100)
58
 
        return aux[0]
59
 
 
60
 
report_sxw.report_sxw(
61
 
    'report.m321_reports.m321_cs_report',
62
 
    'account.invoice',
63
 
    'addons/m321_reports/report/amd_computer_shop_report.rml',
64
 
    parser=m321_cs_report
65
 
)
66
 
  # 1 addons/nombre del modulo/carpeta(report)/nombre del archivo rml
67
 
  # 2 A modo didactico vamos a poner que el modulo al que le vamos a poner el reporte es a res.partner
68
 
  #   pero podria ser cualquier modulo.
69
 
  # 3 report."modulo"."clase"