[FIX] account: invoices - missing field in tree view

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

bzr revid: ara@tinyerp.com-20110429050118-34p90naeqjj4d9cf
This commit is contained in:
ARA (OpenERP) 2011-04-29 10:31:18 +05:30
parent eb389dcdff
commit 2a0be4932f
2 changed files with 23 additions and 13 deletions

View File

@ -123,7 +123,7 @@
<field name="date_invoice"/>
<field name="number"/>
<field name="partner_id" groups="base.group_user"/>
<field name="reference" groups="base.group_user"/>
<field name="reference"/>
<field name="name"/>
<field name="journal_id" invisible="1"/>
<field name="period_id" invisible="1" groups="account.group_account_user"/>
@ -378,6 +378,10 @@
<field name="period_id" select='1' string="Period"/>
</group>
<newline/>
<group expand="0" string="Extended Filters..." name = "extended filter" >
<field name="reference" select="1" string="Invoice Reference"/>
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>

View File

@ -312,13 +312,19 @@ class account_invoice(osv.osv):
journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type)], context=context, limit=None, name_get_uid=1)
res['fields'][field]['selection'] = journal_select
if view_type == 'tree':
doc = etree.XML(res['arch'])
nodes = doc.xpath("//field[@name='partner_id']")
partner_string = _('Customer')
if context.get('type', 'out_invoice') in ('in_invoice', 'in_refund'):
if view_type == 'search':
if context.get('type', 'in_invoice') in ('out_invoice', 'out_refund'):
for node in doc.xpath("//group[@name='extended filter']"):
doc.remove(node)
if view_type == 'tree':
partner_string = _('Supplier')
for node in nodes:
if context.get('type', 'in_invoice') in ('out_invoice', 'out_refund'):
partner_string = _('Customer')
for node in doc.xpath("//field[@name='reference']"):
doc.remove(node)
for node in doc.xpath("//field[@name='partner_id']"):
node.set('string', partner_string)
res['arch'] = etree.tostring(doc)
return res