~camptocamp/sale-reports/translation_v7_sale_order_webkit

« back to all changes in this revision

Viewing changes to sale_order_webkit/report/sale_order.py

  • Committer: nicolas.bessi at camptocamp
  • Date: 2013-01-24 10:39:40 UTC
  • Revision ID: nicolas.bessi@camptocamp.com-20130124103940-s4dzkb8odj6f5geb
[IMP] port of sale_order.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
##############################################################################
3
3
#
4
4
#   Copyright (c) 2011 Camptocamp SA (http://www.camptocamp.com)
5
 
#   @author Guewen Baconnier
6
 
#
7
 
# WARNING: This program as such is intended to be used by professional
8
 
# programmers who take the whole responsability of assessing all potential
9
 
# consequences resulting from its eventual inadequacies and bugs
10
 
# End users who are looking for a ready-to-use solution with commercial
11
 
# garantees and support are strongly adviced to contract a Free Software
12
 
# Service Company
13
 
#
14
 
# This program is Free Software; you can redistribute it and/or
15
 
# modify it under the terms of the GNU General Public License
16
 
# as published by the Free Software Foundation; either version 2
17
 
# of the License, or (at your option) any later version.
18
 
#
19
 
# This program is distributed in the hope that it will be useful,
20
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 
# GNU General Public License for more details.
23
 
#
24
 
# You should have received a copy of the GNU General Public License
25
 
# along with this program; if not, write to the Free Software
26
 
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
5
#   @author Nicolas Bessi, Vincent Renaville, Guewen Baconnier
 
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/>.
27
19
#
28
20
##############################################################################
29
 
 
30
21
import time
31
 
from report import report_sxw
32
 
 
33
 
class sale_report_webkit(report_sxw.rml_parse):
 
22
 
 
23
from openerp.report import report_sxw
 
24
from openerp import pooler
 
25
 
 
26
 
 
27
class SaleOrderReport(report_sxw.rml_parse):
34
28
    def __init__(self, cr, uid, name, context):
35
 
        super(sale_report_webkit, self).__init__(cr, uid, name, context=context)
36
 
        self.localcontext.update({
37
 
            'time': time,
38
 
            'cr':cr,
39
 
            'uid': uid,
40
 
        })
 
29
        super(SaleOrderReport, self).__init__(cr, uid, name, context=context)
 
30
        self.localcontext.update({'time': time,
 
31
                                  'company_vat': self._get_company_vat})
 
32
 
 
33
    def _get_company_vat(self):
 
34
        res_users_obj = pooler.get_pool(self.cr.dbname).get('res.users')
 
35
        company_vat = res_users_obj.browse(self.cr, self.uid, self.uid).company_id.partner_id.vat
 
36
        if company_vat:
 
37
            return company_vat
 
38
        else:
 
39
            return False
41
40
 
42
41
report_sxw.report_sxw('report.sale.order.webkit',
43
 
                       'sale.order',
44
 
                       'addons/sale_report_webkit/report/sale_order.mako',
45
 
                       parser=sale_report_webkit)
 
42
                      'sale.order',
 
43
                      'addons/sale_report_webkit/report/sale_order.mako',
 
44
                      parser=SaleOrderReport)