Hi!
i have altered the account.analytic.account to this:
class account_analytic_account(osv.osv):
_inherit='account.analytic.account'
_columns = {
'tipo_dim':fields.selection([('uo', u'Orgânica'), ('ce', u'Económica'),
('cf', u'Funcional'), ('cc', u'Centro de Custo')],
u'Dimensão', required=True, select=2,
),
'parent_id':fields.many2one('account.analytic.account',"Parent Analytic Account", domain="[('tipo_dim','=',tipo_dim),('type','=','view')]"),
'code':fields.char("Reference",required=True),
}
i have defined a tree view:
<record model="ir.ui.view" id="account_multidim_tree">
<field name="name">account.analytic.multidim.tree</field>
<field name="model">account.analytic.account</field>
<field name="inherit_id" ref="account.view_account_analytic_account_tree"/>
<field name="arch" type="xml">
<data>
<field name='complete_name' position="before">
<field name="tipo_dim" groups="account.group_account_user"/>
</field>
<field name="parent_id" position="replace">
<field name="parent_id"/>
</field>
<field name="code" position="replace">
<field name="code"/>
</field>
</data>
</field>
</record>
and form view:
<record model="ir.ui.view" id="account_multidim_form">
<field name="name">account.analytic.multidim</field>
<field name="model">account.analytic.account</field>
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
<field name="arch" type="xml">
<data>
<field name='name' position="after">
<h4><label string="Tipo de Dimensão" attrs="{'invisible':[('tipo_dim','in',['cc','ce','uo','cf'])]}"/></h4>
<field name="tipo_dim" attrs="{'invisible':[('tipo_dim','in',['cc','ce','uo','cf'])]}"
groups="account.group_account_user"/>
<separator colspan="4"/>
</field>
<field name="parent_id" position="replace">
<field name="parent_id"/>
</field>
<field name="code" position="replace">
<field name="code"/>
</field>
</data>
</field>
</record>
and search view:
<record model="ir.ui.view" id="account_multidim_search">
<field name="name">account.analytic.multidim.search</field>
<field name="model">account.analytic.account</field>
<field name="arch" type="xml">
<search string="Analytic Account">
<field name="name" filter_domain="['|', ('name','ilike',self), ('code','ilike',self)]" string="Analytic Account"/>
<field name="date"/>
<field name="tipo_dim" domain="[]"/>
<field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
<field name="manager_id"/>
<field name="parent_id"/>
<field name="user_id"/>
<filter string="Orgánica" domain="[('tipo_dim','=','uo')]" help="CCC"/>
<filter string="Económica" domain="[('tipo_dim','=','ce')]" help="CCC"/>
<filter string="Funcional" domain="[('tipo_dim','=','cf')]" help="CCC"/>
<filter string="Open" domain="[('state','=','open')]" help="Current Accounts"/>
<filter string="Pending" domain="[('state','=','pending')]" help="Pending Accounts"/>
<group expand="0" string="Group By...">
<filter string="BBB" domain="[]" context="{'group_by':'type'}"/>
<filter string="Associated Partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Type" domain="[]" context="{'group_by':'type'}"/>
<filter string="Template" domain="[]" context="{'group_by':'template_id'}"/>
<filter string="Parent Account" domain="[]" context="{'group_by':'parent_id'}"/>
<filter string="Status" domain="[]" context="{'group_by':'state'}" groups="base.group_no_one"/>
</group>
</search>
</field>
</record>
all the filters work fine, but when i try to type smth in the search field the next client error appears:
Uncaught Error: NameError: name 'tipo_dim' is not defined
Whar did i missed???