[FIX] Fix the warning of account_coda and l10n_ch module
bzr revid: ara@tinyerp.com-20101008101247-7a27nmqxeh0kknwd
This commit is contained in:
parent
27834e2fa7
commit
34b5bac21a
|
@ -59,12 +59,12 @@ class account_coda_import(osv.osv_memory):
|
|||
account_period_obj = self.pool.get('account.period')
|
||||
partner_bank_obj = self.pool.get('res.partner.bank')
|
||||
bank_statement_obj = self.pool.get('account.bank.statement')
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
bank_statement_line_obj = self.pool.get('account.bank.statement.line')
|
||||
voucher_obj = self.pool.get('account.voucher')
|
||||
voucher_line_obj = self.pool.get('account.voucher.line')
|
||||
account_coda_obj = self.pool.get('account.coda')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
line_obj = self.pool.get('account.move.line')
|
||||
|
||||
if not context:
|
||||
context = {}
|
||||
|
@ -78,7 +78,6 @@ class account_coda_import(osv.osv_memory):
|
|||
def_pay_acc = data['def_payable']
|
||||
def_rec_acc = data['def_receivable']
|
||||
|
||||
str_log = ""
|
||||
err_log = "Errors:\n------\n"
|
||||
nb_err=0
|
||||
std_log=''
|
||||
|
@ -230,23 +229,23 @@ class account_coda_import(osv.osv_memory):
|
|||
}
|
||||
voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context)
|
||||
context.update({'move_line_ids': rec_id})
|
||||
|
||||
|
||||
voucher_line_dict = False
|
||||
if result['value']['line_ids']:
|
||||
for line_dict in result['value']['line_ids']:
|
||||
move_line = line_obj.browse(cr, uid, line_dict['move_line_id'], context)
|
||||
if line.move_id.id == move_line.move_id.id:
|
||||
voucher_line_dict = line_dict
|
||||
|
||||
|
||||
if voucher_line_dict:
|
||||
voucher_line_dict.update({'voucher_id':voucher_id})
|
||||
voucher_line_obj.create(cr, uid, voucher_line_dict, context=context)
|
||||
|
||||
|
||||
# reconcile_id = statement_reconcile_obj.create(cr, uid, {
|
||||
# 'line_ids': [(6, 0, rec_id)]
|
||||
# }, context=context)
|
||||
#
|
||||
|
||||
|
||||
mv = self.pool.get('account.move.line').browse(cr, uid, rec_id[0], context=context)
|
||||
if mv.partner_id:
|
||||
line['partner_id'] = mv.partner_id.id
|
||||
|
@ -257,7 +256,7 @@ class account_coda_import(osv.osv_memory):
|
|||
str_not1 = ''
|
||||
if line.has_key('contry_name') and line.has_key('cntry_number'):
|
||||
str_not1="Partner name:%s \n Partner Account Number:%s \n Communication:%s \n Value Date:%s \n Entry Date:%s \n"%(line["contry_name"], line["cntry_number"], line["free_comm"]+line['extra_note'], line["val_date"][0], line["entry_date"][0])
|
||||
id = bank_statement_line_obj.create(cr, uid, {
|
||||
bank_statement_line_obj.create(cr, uid, {
|
||||
'name':line['name'],
|
||||
'date': line['date'],
|
||||
'amount': line['amount'],
|
||||
|
@ -304,7 +303,6 @@ class account_coda_import(osv.osv_memory):
|
|||
test = ''
|
||||
test = str_log1 + std_log + err_log
|
||||
self.write(cr, uid, ids, {'note': test}, context=context)
|
||||
extraction = { 'statment_ids': bkst_list}
|
||||
context.update({ 'statment_ids': bkst_list})
|
||||
model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'account_coda_note_view')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
|
@ -324,7 +322,7 @@ class account_coda_import(osv.osv_memory):
|
|||
|
||||
def action_open_window(self, cr, uid, data, context=None):
|
||||
if not context:
|
||||
cotext = {}
|
||||
context = {}
|
||||
|
||||
return {
|
||||
'domain':"[('id','in',%s)]"%(context.get('statment_ids', False)),
|
||||
|
|
|
@ -78,8 +78,6 @@ def _import(obj, cursor, user, data, context=None):
|
|||
voucher_obj = pool.get('account.voucher')
|
||||
voucher_line_obj = pool.get('account.voucher.line')
|
||||
move_line_obj = pool.get('account.move.line')
|
||||
property_obj = pool.get('ir.property')
|
||||
model_fields_obj = pool.get('ir.model.fields')
|
||||
attachment_obj = pool.get('ir.attachment')
|
||||
file = data['form']['file']
|
||||
statement_id = data['id']
|
||||
|
@ -149,7 +147,7 @@ def _import(obj, cursor, user, data, context=None):
|
|||
account_receivable = False
|
||||
account_payable = False
|
||||
statement = statement_obj.browse(cursor, user, statement_id, context=context)
|
||||
|
||||
|
||||
for record in records:
|
||||
# Remove the 11 first char because it can be adherent number
|
||||
# TODO check if 11 is the right number
|
||||
|
@ -162,7 +160,7 @@ def _import(obj, cursor, user, data, context=None):
|
|||
'type': (record['amount'] >= 0 and 'customer') or 'supplier',
|
||||
'statement_id': statement_id,
|
||||
}
|
||||
|
||||
|
||||
line_ids = move_line_obj.search(cursor, user, [
|
||||
('ref', 'like', reference),
|
||||
('reconcile_id', '=', False),
|
||||
|
@ -171,7 +169,6 @@ def _import(obj, cursor, user, data, context=None):
|
|||
if not line_ids:
|
||||
line_ids = _reconstruct_invoice_ref(cursor, user, reference, None)
|
||||
|
||||
line2reconcile = False
|
||||
partner_id = False
|
||||
account_id = False
|
||||
for line in move_line_obj.browse(cursor, user, line_ids, context=context):
|
||||
|
@ -181,12 +178,12 @@ def _import(obj, cursor, user, data, context=None):
|
|||
move_id = line.move_id.id
|
||||
if record['amount'] >= 0:
|
||||
if round(record['amount'] - line.debit, 2) < 0.01:
|
||||
line2reconcile = line.id
|
||||
# line2reconcile = line.id
|
||||
account_id = line.account_id.id
|
||||
break
|
||||
else:
|
||||
if round(line.credit + record['amount'], 2) < 0.01:
|
||||
line2reconcile = line.id
|
||||
# line2reconcile = line.id
|
||||
account_id = line.account_id.id
|
||||
break
|
||||
result = voucher_obj.onchange_partner_id(cursor, user, [], partner_id=partner_id, journal_id=statement.journal_id.id, price=abs(record['amount']), currency_id= statement.currency.id, ttype='payment', context=context)
|
||||
|
|
Loading…
Reference in New Issue