user2379186
user2379186

Reputation: 431

Odoo 10 - ParseError:

Odoo 10 - I am trying to create an attendance module for partners rather than employees. I am copying code from the Attendance Module included in Odoo but am stuck and getting ParseError. The problem seems to be the action="base.res_partner_kanban_view"/>

The error is below

ParseError: "ir.actions.view" while parsing /opt/odoo/odoo10/odoo-10.0/customaddons/gym_attendance/views/gym_attendance_view.xml:93, near

<menuitem id="menu_gym_attendance_view_members_kanban" name="Members" parent="menu_gym_attendance_manage_attendances" sequence="15" action="base.res_partner_kanban_view

Below is my XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>

    <!-- views -->

    <record id="view_attendance_tree" model="ir.ui.view">
        <field name="name">gym.attendance.tree</field>
        <field name="model">gym.attendance</field>
        <field name="arch" type="xml">
            <tree string="Member attendances">
                <field name="partner_id"/>
                <field name="check_in"/>
                <field name="check_out"/>
            </tree>
        </field>
    </record>

    <record id="gym_attendance_view_form" model="ir.ui.view">
        <field name="name">gym.attendance.form</field>
        <field name="model">gym.attendance</field>
        <field name="arch" type="xml">
            <form string="Member attendances">
                <sheet>
                    <group>
                        <field name="partner_id"/>
                        <field name="check_in"/>
                        <field name="check_out"/>
                    </group>
                </sheet>
            </form>
        </field>
    </record>

    <record id="gym_attendance_view_filter" model="ir.ui.view">
        <field name="name">gym_attendance_view_filter</field>
        <field name="model">gym.attendance</field>
        <field name="arch" type="xml">
            <search string="Gym Attendance Search">
                <field name="partner_id"/>
                <!-- <field name="department_id"/> -->
                <filter name="today" string="Today" domain="[('check_in', '&gt;=', datetime.datetime.now().replace(hour=0, minute=0, second=0)),('check_in', '&lt;=', datetime.datetime.now().replace(hour=23, minute=59, second=59))]" />
                <filter string="Current Month" domain="[('check_in', '&gt;=', datetime.datetime.now().strftime('%Y-%m-01'))]" />
                <separator/>
                <filter string="No Check Out" domain="[('check_out', '=', False)]" />
                <separator/>
                <filter string="My Attendances" domain="[('employee_id.user_id.id', '=', uid)]" />
                <group expand="0" string="Group By">
                    <filter name="member" string="Member" context="{'group_by':'partner_id'}"/>
                    <separator/>
                    <filter name="groupby_name" string="Month" context="{'group_by':'check_in'}"/>
                </group>
            </search>
        </field>
    </record>

    <record id="gym_attendance_action_my_attendances" model="ir.actions.client">
        <field name="name">Attendance</field>
        <field name="tag">gym_attendance_my_attendances</field>
        <field name="target">main</field>
    </record>

    <!-- actions -->

    <record id="gym_attendance_action" model="ir.actions.act_window">
        <field name="name">Attendances</field>
        <field name="res_model">gym.attendance</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="context">{"search_default_today":1}</field>
        <field name="search_view_id" ref="gym_attendance_view_filter" />
        <field name="help" type="html">
            <p>The attendance records of your members will be displayed here.</p>
            <p>Please make sure you're using the correct filter if you expected to see any.</p>
        </field>
    </record>

    <record id="gym_attendance_action_my_attendances" model="ir.actions.client">
        <field name="name">Gym Attendance</field>
        <field name="tag">gym_attendance_my_attendances</field>
        <field name="target">main</field>
    </record>



    <menuitem id="menu_gym_attendance_root" name="Attendances" sequence="90"  web_icon="gym_attendance,static/description/icon.png"/>

    <menuitem id="menu_gym_attendance_my_attendances" name="Gym Attendances" parent="menu_gym_attendance_root" sequence="10" action="gym_attendance_action_my_attendances"/>

    <menuitem id="menu_gym_attendance_manage_attendances" name="Manage Attendances" parent="menu_gym_attendance_root" sequence="20"/>

    <menuitem id="menu_gym_attendance_view_attendances" name="Attendances" parent="menu_gym_attendance_manage_attendances" sequence="10"  action="gym_attendance_action"/>

    <menuitem id="menu_gym_attendance_view_members_kanban" name="Members" parent="menu_gym_attendance_manage_attendances" sequence="15" action="base.res_partner_kanban_view"/>



</odoo>

Upvotes: 0

Views: 735

Answers (2)

Vicoozero7
Vicoozero7

Reputation: 1

Try with : gym_attendance_action,

you need to specify the action to your menu-item and this action will call your view.

Your action:

<field name="search_view_id" ref="gym_attendance_view_filter" />

Your menu-item:

<menuitem id="id_menu_item" name="NameOfYourView" parent="model.model"
          action="turnover_filtered_view_action..." />

Upvotes: 0

KbiR
KbiR

Reputation: 4174

I think you trying to call id of kanban view of res.partner instead of the id of action. Either you have to find out the correct id for the action or create a new one and use.

Here is the example id for Customer base.action_partner_form which available in base/res/res_partner.xml

I hope it will help you.

Upvotes: 1

Related Questions