L10N_CH : V11 : forgot one file
bzr revid: bch-da783c0e677f20329489fe22bbcac65e8d7adac1
This commit is contained in:
parent
2dea59f722
commit
bee476d5f9
|
@ -253,11 +253,9 @@ def _create_dta(self,cr,uid,data,context):
|
|||
# write the bank account for the dta object
|
||||
pool.get('account.dta').write(cr,uid,[dta_id],{'bank':data['form']['bank']})
|
||||
|
||||
#print data['form']['dta_line_ids']
|
||||
dta_line_ids= []
|
||||
|
||||
for line in data['form']['dta_line_ids']:
|
||||
if line[1]!=0 and line[2]['partner_id']:
|
||||
if line[1]!=0 and line[2] and line[2]['partner_id']:
|
||||
dta_line_ids.append(line[1])
|
||||
th_amount_tot += line[2]['amount_to_pay']
|
||||
dta_line_obj.write(cr, uid, [line[1]] , line[2] )
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from osv import osv,fields
|
||||
|
||||
class account_v11(osv.osv):
|
||||
_name = "account.v11"
|
||||
_description = "V11 History"
|
||||
_columns = {
|
||||
'name': fields.binary('V11 file', readonly=True),
|
||||
'move_ids': fields.one2many('account.move','id','Generated Moves', readonly=True),
|
||||
'note': fields.text('Import log', readonly=True),
|
||||
'journal_id': fields.many2one('account.journal','Bank Journal', readonly=True,select=True),
|
||||
'date': fields.date('Import Date', readonly=True,select=True),
|
||||
'user_id': fields.many2one('res.users','User', readonly=True, select=True),
|
||||
}
|
||||
account_v11()
|
||||
|
|
@ -90,7 +90,7 @@ res_fields = {
|
|||
def _v11_parsing(self, cr, uid, data, context):
|
||||
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
v11 = data['form']['v11']
|
||||
v11file = data['form']['v11']
|
||||
|
||||
line=""
|
||||
lnb=1
|
||||
|
@ -103,7 +103,7 @@ def _v11_parsing(self, cr, uid, data, context):
|
|||
nb_err=0
|
||||
|
||||
# v11 parsing :
|
||||
for char in b64decode(v11):
|
||||
for char in b64decode(v11file):
|
||||
|
||||
if not char == '\n':
|
||||
line += char
|
||||
|
@ -162,7 +162,7 @@ def _v11_parsing(self, cr, uid, data, context):
|
|||
if not acc2:
|
||||
return {'note': 'No debit account specified for this journal, import aborted.' }
|
||||
|
||||
|
||||
move_list=[]
|
||||
|
||||
for rec in rec_list:
|
||||
|
||||
|
@ -219,19 +219,16 @@ def _v11_parsing(self, cr, uid, data, context):
|
|||
account_move_lines.append(line_id )
|
||||
|
||||
# TODO accpeter les reconciliation qui ne marche pas.
|
||||
pool.get('account.move.line').reconcile(cr,uid,account_move_lines,
|
||||
writeoff_acc_id=0,
|
||||
writeoff_journal_id=0,
|
||||
writeoff_period_id= 0,
|
||||
)
|
||||
# pool.get('account.move.line').reconcile(cr,uid,account_move_lines,
|
||||
# writeoff_acc_id=0,
|
||||
# writeoff_journal_id=0,
|
||||
# writeoff_period_id= 0,
|
||||
# )
|
||||
cr.commit()
|
||||
|
||||
std_log = std_log + """
|
||||
--
|
||||
Invoice : %s
|
||||
Date Due : %s
|
||||
Amount received : %.2f
|
||||
"""%(i.name, i.date_due or 'undefined', float(rec['montant']))
|
||||
std_log = std_log + " Invoice : %s, Date Due : %s, Amount received : %.2f."\
|
||||
%(i.name, i.date_due or 'undefined', float(rec['montant']))
|
||||
|
||||
if i.payment_term and i.payment_term.cash_discount_ids and i.payment_term.cash_discount_ids[0]:
|
||||
if discount and rec['date_remise'] <= discount.date :
|
||||
amount_to_pay = i.amount_total*(1-discount.discount)
|
||||
|
@ -265,8 +262,19 @@ def _v11_parsing(self, cr, uid, data, context):
|
|||
err_log= err_log +'\n * Line '+rec['line_number'] +', invoice '+rec['invoice_ref'].lstrip('0')+' : Reconciliation Error.'
|
||||
#raise
|
||||
|
||||
move_list.append(move_id)
|
||||
|
||||
err_log= err_log + '\n\n --' +'\nNumber of parsed lines : '+ str(len(rec_list)) +'\nNumber of error : '+ str(nb_err)
|
||||
|
||||
pool.get('account.v11').create(cr, uid,{
|
||||
'name':v11file,
|
||||
'move_ids':[(6,0,move_list)],
|
||||
'note':err_log+ std_log,
|
||||
'journal_id':data['form']['journal_id'],
|
||||
'date':time.strftime("%Y-%m-%d"),
|
||||
'user_id':uid,
|
||||
})
|
||||
|
||||
return {'note':err_log+ std_log,'journal_id': data['form']['journal_id'], 'v11': data['form']['v11']}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue