Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4647 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
kwi 18
13463
0
mar 23
1824
0
maj 19
3401
1
sie 16
8840
0
lip 15
5535