~lepistone/openobject-italia/6.1-fix-account_invoice_entry_date_signature

« back to all changes in this revision

Viewing changes to l10n_it_vat_registries/invoice.py

  • Committer: Lorenzo Battistini
  • Date: 2012-12-11 16:29:30 UTC
  • Revision ID: lorenzo.battistini@agilebg.com-20121211162930-pobqre1b6rjfyc0j
[FIX] l10n_it_vat_registries - unused varialbes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- coding: utf-8 -*-
2
2
##############################################################################
3
 
#    
 
3
#
4
4
#    Copyright (C) 2011 Associazione OpenERP Italia
5
 
#    (<http://www.openerp-italia.org>). 
 
5
#    (<http://www.openerp-italia.org>).
6
6
#    All Rights Reserved
7
7
#
8
8
#    This program is free software: you can redistribute it and/or modify
22
22
 
23
23
import time
24
24
from report import report_sxw
25
 
from osv import osv
26
25
from tools.translate import _
27
26
from decimal import *
28
27
import netsvc
30
29
class Parser(report_sxw.rml_parse):
31
30
 
32
31
    logger = netsvc.Logger()
33
 
    
 
32
 
34
33
    def _get_partner_type(self, move_line):
35
34
        partner_type = ''
36
35
        for line in move_line.move_id.line_id:
41
40
                    raise Exception(
42
41
                        _('The move %s has different partner account type') % move_line.move_id.name)
43
42
        return partner_type
44
 
    
 
43
 
45
44
    def _move_total(self, move_line):
46
45
        partner_type = self._get_partner_type(move_line)
47
46
        total = 0.0
67
66
            return self._get_amount_with_sign(move_line.tax_amount, move_line.credit - move_line.debit)
68
67
        if self._get_partner_type(move_line) == 'payable':
69
68
            return self._get_amount_with_sign(move_line.tax_amount, move_line.debit - move_line.credit)
70
 
    
 
69
 
71
70
    # in valuta base
72
71
    def _get_invoice_amount_total(self, invoice):
73
72
        total = 0.0
75
74
            total += self._get_amount_with_sign(inv_tax.base_amount, inv_tax.base) \
76
75
                + self._get_amount_with_sign(inv_tax.tax_amount, inv_tax.amount)
77
76
        return total
78
 
    
 
77
 
79
78
    # in valuta base
80
79
    def _get_invoice_amount_untaxed(self, invoice):
81
80
        total = 0.0
95
94
        invoice_amount_total = 0.0
96
95
        invoice_amount_untaxed = 0.0
97
96
        related_invoices = []
98
 
        
 
97
 
99
98
        ''' riusciamo a essere sempre indipendenti dalle fatture?
100
99
        # se c'è l'oggetto fattura, utilizzo il calcolo su fattura
101
100
        for move_line in move.line_id:
102
101
            if move_line.invoice and move_line.invoice.id not in related_invoices:
103
102
                related_invoices.append(move_line.invoice.id)
104
103
        '''
105
 
        
 
104
 
106
105
        if related_invoices:
107
106
            for invoice_id in related_invoices:
108
107
                return self._get_tax_lines_by_invoice(inv_pool.browse(self.cr, self.uid, invoice_id))
109
 
                
 
108
 
110
109
        for move_line in move.line_id:
111
110
            tax_item = {}
112
111
            if move_line.tax_code_id and move_line.tax_code_id.tax_ids:
175
174
    def _get_tax_lines_by_invoice(self, invoice):
176
175
        res=[]
177
176
        tax_obj = self.pool.get('account.tax')
178
 
        cur_pool = self.pool.get('res.currency')
179
177
        # index è usato per non ripetere la stampa dei dati fattura quando ci sono più codici IVA
180
178
        index=0
181
179
        totale_iva = 0.0
182
180
        totale_iva_inded = 0.0
183
181
        invoice_amount_total = 0.0
184
182
        invoice_amount_untaxed = 0.0
185
 
        precision = self.pool.get('decimal.precision').precision_get(self.cr, self.uid, 'Account')
186
183
        for inv_tax in invoice.tax_line:
187
184
            tax_item = {}
188
185
            if inv_tax.base_code_id and inv_tax.tax_code_id:
286
283
        self.localcontext.update({
287
284
            'time': time,
288
285
            'tax_lines': self._get_tax_lines,
289
 
            'totali': {                
 
286
            'totali': {
290
287
                'totale_operazioni': 0.0,
291
288
                'totale_imponibili': 0.0,
292
289
                'totale_variazioni': 0.0,
296
293
            'tax_codes': {},
297
294
        })
298
295
 
299
 
        
 
296
 
300
297
report_sxw.report_sxw('report.registro_iva_vendite',
301
 
                       'registro_iva_vendite', 
 
298
                       'registro_iva_vendite',
302
299
                       'addons/l10n_it_vat_registries/templates/registro_iva_vendite.mako',
303
300
                       parser=Parser)
304
301
report_sxw.report_sxw('report.registro_iva_acquisti',
305
 
                       'registro_iva_acquisti', 
 
302
                       'registro_iva_acquisti',
306
303
                       'addons/l10n_it_vat_registries/templates/registro_iva_acquisti.mako',
307
304
                       parser=Parser)
308
305
report_sxw.report_sxw('report.registro_iva_corrispettivi',
309
 
                       'registro_iva_corrispettivi', 
 
306
                       'registro_iva_corrispettivi',
310
307
                       'addons/l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako',
311
308
                       parser=Parser)