[FIX]account: account bank statement - usability

lp bug: https://launchpad.net/bugs/696914 fixed

bzr revid: ara@tinyerp.com-20110104124045-7iyc6opd22ufqtww
This commit is contained in:
ARA (OpenERP) 2011-01-04 18:10:45 +05:30
parent 3427d3a4c2
commit d172534a08
2 changed files with 16 additions and 1 deletions

View File

@ -405,6 +405,19 @@ account_bank_statement()
class account_bank_statement_line(osv.osv):
def onchange_partner_id(self, cr, uid, partner_id, type, context={}):
part = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
if not part.supplier and not part.customer :
type = 'general'
elif part.supplier == True and part.customer == True :
type = 'general'
else:
if part.supplier == True :
type = 'supplier'
if part.customer == True :
type = 'customer'
return type
def onchange_type(self, cr, uid, line_id, partner_id, type, context=None):
res = {'value': {}}
obj_partner = self.pool.get('res.partner')
@ -414,6 +427,8 @@ class account_bank_statement_line(osv.osv):
return res
account_id = False
line = self.browse(cr, uid, line_id, context=context)
type=self.onchange_partner_id(cr, uid, partner_id=partner_id, type=type)
res.update({'value': {'type':type}})
if not line or (line and not line[0].account_id):
part = obj_partner.browse(cr, uid, partner_id, context=context)
if type == 'supplier':

View File

@ -574,8 +574,8 @@
<form string="Statement lines">
<field name="date"/>
<field name="name"/>
<field name="type" on_change="onchange_type(partner_id, type)"/>
<field name="partner_id" on_change="onchange_type(partner_id, type)"/>
<field name="type" on_change="onchange_type(partner_id, type)"/>
<field domain="[('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>
<field name="amount"/>