L10N_CH : blank dta lines on the dta wizard are now correctly handled (i.e. ignored)

bzr revid: bch-457f125494e2b77cdf1058be88e8438a4a5dcef5
This commit is contained in:
bch 2007-01-04 12:37:34 +00:00
parent 439d7a5a90
commit 5a22519a9c
1 changed files with 17 additions and 22 deletions

View File

@ -108,10 +108,11 @@ def _get_bank(self,cr,uid,data,context):
return {} return {}
def _cleaning(self,cr,uid,data,context): # def _cleaning(self,cr,uid,data,context):
pool = pooler.get_pool(cr.dbname) # pool = pooler.get_pool(cr.dbname)
pool.get('account.dta').unlink(cr, uid, [ line[1] for line in data['form']['dta_line_ids'] ]) # print [ line[1] for line in data['form']['dta_line_ids']]
return {} # pool.get('account.dta').unlink(cr, uid, [ line[1] for line in data['form']['dta_line_ids'] ])
# return {}
def _get_dta_lines(self,cr,uid,data,context): def _get_dta_lines(self,cr,uid,data,context):
@ -246,20 +247,20 @@ def _create_dta(self,cr,uid,data,context):
th_amount_tot= 0 th_amount_tot= 0
dta_id=data['form']['dta_id'] dta_id=data['form']['dta_id']
if not dta_id :
return {'note':'No dta line'}
# write the bank account for the dta object # write the bank account for the dta object
pool.get('account.dta').write(cr,uid,[dta_id],{'bank':data['form']['bank']}) pool.get('account.dta').write(cr,uid,[dta_id],{'bank':data['form']['bank']})
count = 0 #print data['form']['dta_line_ids']
for line in data['form']['dta_line_ids']: dta_line_ids= []
if not line[1]:
del data['form']['dta_line_ids'][count]
else:
dta_line_obj.write(cr, uid, [line[1]] , line[2] )
count += 1
th_amount_tot += line[2]['amount_to_pay']
if not dta_id : for line in data['form']['dta_line_ids']:
return {'note':'No dta line'} if line[1]!=0 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] )
# creation of a bank statement : TODO ajouter le partner # creation of a bank statement : TODO ajouter le partner
@ -270,7 +271,7 @@ def _create_dta(self,cr,uid,data,context):
'state':'draft', 'state':'draft',
}) })
for dtal in dta_line_obj.browse(cr,uid,[ line[1] for line in data['form']['dta_line_ids'] ]): for dtal in dta_line_obj.browse(cr,uid,dta_line_ids):
i = dtal.name #dta_line.name = invoice's id i = dtal.name #dta_line.name = invoice's id
@ -376,13 +377,7 @@ class wizard_dta_create(wizard.interface):
'result' : {'type' : 'form', 'result' : {'type' : 'form',
'arch' : check_form, 'arch' : check_form,
'fields' : check_fields, 'fields' : check_fields,
'state' : [('clean', 'Cancel'),('creation', 'Yes') ]} 'state' : [('end', 'Cancel'),('creation', 'Yes') ]}
},
'clean':{
'actions' : [_cleaning],
'result' : {'type' : 'state',
'state' : 'end',}
}, },
'creation' : { 'creation' : {