Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
5 Risposte
9115 Visualizzazioni

I want to make normal new menu, but is show as wizard. I want it show as usual menu.

this is the .xml

<record id="view_change_shift_tree" model="ir.ui.view">
<field
name="name">resource.calendar.change.tree</field>
<field
name="model">resource.calendar.change</field>
<field
name="arch" type="xml">
<tree
string="Change Shift">
<field
name="working_hours" />
<field
name="date_start"/>
</tree>
</field>
</record>

<record
id="action_change_shift" model="ir.actions.act_window">
<field
name="name">Change Shift</field>
<field
name="res_model">resource.calendar.change</field>
<field
name="view_type">tree</field>
<field
name="view_mode">tree</field>
</record>

<menuitem
id="menu_change_shift" name="Change Work Hours" action="action_change_shift" parent="hr.menu_hr_main" sequence="50" />

this is the .py

class change_shift(osv.osv):
_name = "resource.calendar.change"
_description = 'Change Shift'
_columns = {
'working_hours': fields.many2one('resource.calendar', 'Working Hours'),
'date_start': fields.date('Date From'),
    }

the menu show as wizard not as usual menu 

Avatar
Abbandona
Autore Risposta migliore

I've tried all the answers but still became wizard.
Then I make new xml, and it work. I must use new ID. if the ID still using the old ID, it still became wizard.

but still dont know why it became wizard in the first place.

Avatar
Abbandona
Risposta migliore
You can try the following code.

<record id="view_change_shift_tree" model="ir.ui.view">
<field name="name">resource.calendar.change.tree</field>
<field name="model">resource.calendar.change</field>
<field name="arch" type="xml">
<tree string="Change Shift">
<field name="working_hours" />
<field name="date_start"/>
</tree>
</field>
</record>
<record id="view_change_shift_form" model="ir.ui.view">
<field name="name">resource.calendar.change.form</field>
<field name="model">resource.calendar.change</field>
<field name="arch" type="xml">
<form string="Change Shift">
<field name="working_hours" />
<field name="date_start"/>
</form>
</field>
</record>

<record id="action_change_shift" model="ir.actions.act_window">
<field name="name">Change Shift</field>
<field name="res_model">resource.calendar.change</field>
<field name="view_type">tree</field>
    <field name="view_type">form</field>
   
  <field name="view_id" ref="view_change_shift_tree"/>
    <field name="target">current</field>
</record>

<menuitem id="menu_change_shift" name="Change Work Hours" action="action_change_shift" parent="hr.menu_hr_main" sequence="50" />
Avatar
Abbandona
Risposta migliore

Create action menu in odoo: http://learnopenerp.blogspot.com/2016/03/odoo-action-menu-tree-view-form-view.html

Avatar
Abbandona
Risposta migliore

Hello Niyuzuku,


Try below code :-

<record id="view_change_shift_tree" model="ir.ui.view">
    <field name="name">resource.calendar.change.tree</field>
    <field name="model">resource.calendar.change</field>
    <field name="arch" type="xml">
        <tree string="Change Shift" editable="top">
            <field name="working_hours" />
            <field name="date_start"/>
       </tree>
    </field>
</record>

<record id="action_change_shift" model="ir.actions.act_window">
    <field name="name">Change Shift</field>
    <field name="res_model">resource.calendar.change</field>
    <field name="view_mode">tree</field>
    <field name="view_type">form</field>
    <field name="view_id" ref="view_change_shift_tree"/>

</record>

<menuitem id="menu_change_shift" name="Change Work Hours" action="action_change_shift" parent="hr.menu_hr_main" sequence="50" />


Hope it will helps you.

Thanks,

Avatar
Abbandona
Risposta migliore

hello,

in your code add target like below code.

<record id="action_change_shift" model="ir.actions.act_window">
<field name="name">Change Shift</field>
<field name="res_model">resource.calendar.change</field>
<field name="view_type">tree</field>
<field name="view_mode">tree</field>
<field name="target">current</field>
</record>
Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
nov 22
3422
0
giu 21
5970
2
mag 21
7299
0
mar 21
2788
1
mag 20
7175