This question has been flagged
1 Reply
3624 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