Skip to Content
Menu
This question has been flagged
1 Reply
4542 Views

Hi
I'm facing issue trying to remove dependencies to filter 'type_student' in a module inherited from res.partner.
My goal is to delete this error and to correctly add 'type_student' as default filter to other views.
Even if I delete every call of type_student the error still be there.
Can anyone help me?
Thanks in advice. Here is the code of my res_partner module that inherit from res.partner.

<!-- PARTNER -->
<record id="view_partner_form" model="ir.ui.view">
<field name="name">res.partner.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">

<xpath expr="//form" position="inside">

<header>

<button name="course_withdraw" type="object" string="Withdraw" states="active" class="oe_highlight"/>
<button name="course_rejoin" type="object" string="Rejoin" states="withdrawed" class="oe_highlight"/>

<field name="state" widget="statusbar"/>
</header>
</xpath>


<xpath expr="//field[@name='category_id']" position="after">
<field name="lesson_id"/>
</xpath>

<xpath expr="//page[@name='internal_notes']" position="before">

<page string="Gest Call">
<group>
<field name="is_student"/>
<field name="is_teacher"/>
<field name="is_operator"/>
<field name="topics" position="attribute" attrs="{'invisible':[('is_teacher','=',False)]}"/>
</group>
<group>
<field name="plan_ids">
<tree string="Plan">
<field name="title" />
<field name="plan_code" />
<field name="total_lesson_hours" />
</tree>
</field>
</group>
</page>

</xpath>
</field>
</record>


<!-- Contact search for gestcalls -->
<record id="view_search_gestcall_contact_form" model="ir.ui.view">
<field name="name">res.partner.search.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_res_partner_filter"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">

<field name="lesson_id"/>
<field name="projects_ids"/>
<field name="gest_course_id"/>
<field name="plan_ids"/>
<field name="topics"/>
<field name="participation_hour"/>
<field name="tot_inserted_hours"/>
<field name="state"/>
<field name="is_student" />
<field name="is_teacher" />
<field name="is_operator" />
</xpath>
<xpath expr="//separator" position="after">
<filter string="Companies" name="type_company" domain="[('is_company','=', True)]"/>
<filter string="Operators" name="type_operator" domain="[('is_operator', '=', True)]"/>
<filter string="Teachers" name="type_teacher" domain="[('is_teacher', '=', True)]"/>
<filter string="Students" name="type_student" domain="[('is_student', '=', True)]"/>

<group expand="0" string="Group By">
<filter name="is_student" string="Students" domain="[('is_student','=',True)]" context="{'group_by' : 'state'}"/>
<filter name="is_teacher" string="Teachers" domain="[('is_teacher','=',True)]" context="{'group_by' : 'lesson_id'}"/>
<filter name="is_operator" string="Operator" domain="[('is_operator','=',True)]" context="{'group_by' : 'projects_ids'}"/>
</group>
</xpath>

</field>
</record>

<!-- Contact actions for gestcalls -->
<record id="gestcall_contact_action" model="ir.actions.act_window">
<field name="name">Contact</field>
<field name="res_model">res.partner</field>
<!-- <field name="type">ir.actions.act_window</field>-->
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>

<field name="search_view_id" ref="view_search_gestcall_contact_form"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Add Contact
</p>
</field>
</record>


<record id="gestcall_kanban_contact_action_kanban" model="ir.actions.act_window.view">
<field name="sequence" eval="1" />
<field name="view_mode">kanban</field>
<field name="view_id" ref="base.res_partner_kanban_view" />
<field name="act_window_id" ref="gestcall_contact_action" />
</record>
<record id="gestcall_kanban_contact_action_tree" model="ir.actions.act_window.view">
<field name="sequence" eval="2" />
<field name="view_mode">tree</field>
<field name="view_id" ref="base.view_partner_tree" />
<!-- <field name="context">{search_default_type_company:1}</field>-->
<field name="act_window_id" ref="gestcall_contact_action" />
</record>
<record id="gestcall_kanban_contact_action_form" model="ir.actions.act_window.view">
<field name="sequence" eval="3" />
<field name="view_mode">form</field>
<field name="view_id" ref="base.view_partner_form" />
<field name="act_window_id" ref="gestcall_contact_action" />
</record>

here is the error

Error: NameError: name 'search_default_type_student' is not defined
http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:145
Traceback:
PY_ensurepy@http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:145:65
py.evaluate@http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:261:8
py.evaluate@http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:270:156
py.eval@http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:274:284
eval_contexts/<@http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:410:110
iterator@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:14:183
createReduce/<@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:17:8
_.mixin/</_.prototype[name]@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:69:526
eval_contexts@http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:408:136
eval_contexts/<@http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:410:253
iterator@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:14:183
createReduce/<@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:17:8
_.mixin/</_.prototype[name]@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:69:526
eval_contexts@http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:408:136
pyeval@http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:427:8
_preprocessAction@http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:483:439
_preprocessAction@http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:507:127
OdooClass.extend/Class.include/</prototype[name]</<@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:3541:371
doAction/<@http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:458:130
then/</</<@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:802:681
fire@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:796:299
add@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:797:471
then/</<@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:802:649
each@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:625:767
then/<@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:802:560
Deferred@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:803:194
then@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:802:525
doAction@http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:458:33
do_action@http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:558:1326
_openMenu@http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:568:1324
on_menu_clicked/</<@http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:568:1050
exec/<@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:3751:384
then/</</<@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:802:681
fire@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:796:299
add@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:797:471
then/</<@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:802:649
each@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:625:767
then/<@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:802:560
Deferred@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:803:194
then@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:802:525
exec@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:3751:354
on_menu_clicked/<@http://0.0.0.0:8099/web/content/392-1a081a9/web.assets_backend.js:568:995
then/</</<@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:802:681
fire@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:796:299
fireWith@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:801:202
Deferred/</deferred[tuple[0]]@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:803:56
add/<@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:3750:831
fire@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:796:299
fireWith@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:801:202
then/</</<@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:802:874
fire@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:796:299
fireWith@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:801:202
then/</</<@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:802:874
fire@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:796:299
fireWith@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:801:202
Deferred/</deferred[tuple[0]]@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:803:56
genericJsonRpc/<@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:3558:10
then/</</<@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:802:681
fire@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:796:299
fireWith@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:801:202
then/</</<@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:802:874
fire@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:796:299
fireWith@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:801:202
done@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:1192:95
callback@http://0.0.0.0:8099/web/content/327-b6c9587/web.assets_common.js:1212:23
Avatar
Discard
Author Best Answer

I found the solution:

1. substitute

             <xpath expr="//separator" position="after">

with

            <xpath expr="/search/filter[1]" position="before">

2. replace

 <field name="context">{search_default_type_student:1}</field>

(even if you delete it remains in cahce and cause the error above)

with

<!--         Contact actions for gestcalls -->
<record id="gestcall_contact_action" model="ir.actions.act_window">
<field name="name">Contact</field>
<field name="res_model">res.partner</field>
<!-- <field name="type">ir.actions.act_window</field>-->
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
        <field name="context">{"search_default_type_student":1}</field>



Avatar
Discard
Related Posts Replies Views Activity
3
Sep 21
10610
0
Apr 24
459
0
Dec 21
1350
2
Jan 21
4117
2
Oct 20
3643