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

Task: 

Every employee can create a resignation request, but only one per employee

I have menuitem by clicking witch employee must see his own resignation form

The next code show new form everytime I click menuitem, but i need to show the same form employee created early

<record id="action_resignation"
model="ir.actions.act_window">
<field name="name">My resignation</field>
<field name="type">ir.actions.act_window</field>
  <field name="res_model">hr.resignation</field>
  <field name="view_type">form</field>
  <field name="view_mode">form</field>
  <field name="domain">['user_id','=',uid]</field>
</record>
<record model="ir.actions.act_window.view" id="action_resignation_form">
  <field name="sequence" eval="1"/>
  <field name="view_mode">form</field>
  <field name="res_id">uid</field>
  <field name="view_id" ref="my_resignation_form"/>
  <field name="act_window_id" ref="action_resignation"/>
</record>

<menuitem id="resignation"

name="Resignations"

action="action_resignation"

groups="group_employee_resignation"

parent="hr.menu_hr_root"

class Resignation(models.Model):
	_name = 'hr.resignation'
	...
	user_id = fields.Many2one('res.users', string='user id', default=lambda self: self.env.user.id, readonly=True)
	...


rtrt

Avatar
Discard
Best Answer

Hello  Andrey,

view_mode is not proper in the above code.

Set this,

<field name="view_mode">tree,form</field>

Hope this helps,

Thank You

Avatar
Discard
Related Posts Replies Views Activity
1
Apr 18
11834
0
Mar 23
846
0
May 19
2341
1
Aug 16
7539
0
Jul 15
4398