~ecoservice/ecoservice-openerp-addons/7.0

« back to all changes in this revision

Viewing changes to ecoservice_financeinterface/ecofi.py

  • Committer: n.rumprecht at ecoservice
  • Date: 2014-07-28 12:40:19 UTC
  • mfrom: (18.1.3 datev_new_logic)
  • Revision ID: n.rumprecht@ecoservice.de-20140728124019-ogyzhw4ehbnjo8o8
+ Aufsplitten der calculate_tax Methode
+ DatevInterface V2 Initial Commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
        texamount = 0
135
135
        if linetax:
136
136
            if 'waehrung' in context and context['waehrung']:
137
 
                taxes = self.pool.get('account.tax')._compute(cr, uid, [linetax], line.amount_currency, 1)
 
137
                amount = line.amount_currency
138
138
            else:
139
 
                taxes = self.pool.get('account.tax')._compute(cr, uid, [linetax], line.debit - line.credit, 1)
 
139
                amount = line.debit - line.credit
 
140
            return self.calc_tax(cr, uid, linetax, amount, context=context)
 
141
        else:
 
142
            if 'return_calc' in context and context['return_calc'] is True:
 
143
                return []
 
144
        return texamount
 
145
    
 
146
    def calc_tax(self, cr, uid,tax_object, amount, context=None):
 
147
        if context is None:
 
148
            context = {}
 
149
        texamount = 0
 
150
        if tax_object:
 
151
            taxes = self.pool.get('account.tax')._compute(cr, uid, [tax_object], amount, 1)
140
152
            if 'return_calc' in context and context['return_calc'] is True:
141
153
                return taxes
142
154
            for tex in taxes:
144
156
        else:
145
157
            if 'return_calc' in context and context['return_calc'] is True:
146
158
                return []
147
 
        return texamount
 
159
        return texamount            
148
160
 
149
161
    def set_main_account(self, cr, uid, move, context={}):
150
162
        """ This methods sets the main account of the corresponding account_move
262
274
        :param context: context arguments, like lang, time zone
263
275
        """
264
276
        return ecofi_csv, log
265
 
                
 
277
    
 
278
    def pre_export(self, cr, uid, account_move_ids, context={}):
 
279
        """ Method to call before the Import starts and the moves to export are going to be browsed
 
280
        
 
281
        :param cr: the current row, from the database cursor
 
282
        :param uid: the current user’s ID for security checks
 
283
        :param ecofi_csv: object for the csv file
 
284
        :param bookingdict: Dictionary that contains generated Bookinglines and Headers
 
285
        :param log: logstring wich contains error descriptions or infos
 
286
        :param context: context arguments, like lang, time zone
 
287
        """
 
288
        return True
 
289
                   
266
290
    def ecofi_buchungen(self, cr, uid, journal_ids=[], vorlauf_id=False, period=False, context={}):        
267
291
        """ Method that generates the csv export by the given parameters
268
292
        
338
362
            errorcount = 0
339
363
            warncount = 0
340
364
            bookingdict = {}
 
365
            self.pre_export(cr, uid, account_move_ids, context)
341
366
            for move in self.pool.get('account.move').browse(cr, uid, account_move_ids):
342
367
                self.pool.get('account.move').write(cr, uid, [move.id], {'vorlauf_id': vorlauf_id})  
343
368
                thismovename = ustr(move.name) + ", " + ustr(move.ref) + ": "