跳至內容
選單
此問題已被標幟
1 回覆
4714 瀏覽次數

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

頭像
捨棄
最佳答案

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

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
4月 18
13528
0
3月 23
1868
0
5月 19
3503
1
8月 16
8959
0
7月 15
5577