res_users_views.xml 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <record id="res_users_view_form" model="ir.ui.view">
  4. <field name="name">res.users.form.inherit</field>
  5. <field name="model">res.users</field>
  6. <field name="inherit_id" ref="base.view_users_form"/>
  7. <field name="arch" type="xml">
  8. <!-- add state field in header -->
  9. <xpath expr="//header" position="inside">
  10. <button string="Send Password Reset Instructions"
  11. type="object" name="action_reset_password"
  12. attrs="{'invisible': [('state', '!=', 'active')]}"/>
  13. <button string="Send an Invitation Email"
  14. type="object" name="action_reset_password" context="{'create_user': 1}"
  15. attrs="{'invisible': [('state', '!=', 'new')]}"/>
  16. <field name="state" widget="statusbar"/>
  17. </xpath>
  18. <xpath expr="//sheet" position="before">
  19. <div class="alert alert-success text-center o_form_header alert-dismissible" attrs="{'invisible': [('signup_valid', '!=', True)]}" role="status">
  20. <button class="btn-close" data-bs-dismiss="alert" aria-label="Close"/>
  21. <div attrs="{'invisible': [('state', '!=', 'active')]}">
  22. <strong>A password reset has been requested for this user. An email containing the following link has been sent:</strong>
  23. </div>
  24. <div attrs="{'invisible': [('state', '!=', 'new')]}">
  25. <strong>An invitation email containing the following subscription link has been sent:</strong>
  26. </div>
  27. <div><field name="signup_url" widget="url"/></div>
  28. <field name="signup_valid" invisible="1"/>
  29. </div>
  30. </xpath>
  31. </field>
  32. </record>
  33. <record id="view_users_state_tree" model="ir.ui.view">
  34. <field name="name">res.users.tree.inherit</field>
  35. <field name="model">res.users</field>
  36. <field name="inherit_id" ref="base.view_users_tree"/>
  37. <field name="arch" type="xml">
  38. <xpath expr="//field[@name='company_id']" position="after">
  39. <field name="state" widget="badge"
  40. decoration-info="state == 'new'" decoration-success="state == 'active'"/>
  41. </xpath>
  42. </field>
  43. </record>
  44. <record id="action_send_password_reset_instructions" model="ir.actions.server">
  45. <field name="name">Send Password Reset Instructions</field>
  46. <field name="model_id" ref="base.model_res_users"/>
  47. <field name="groups_id" eval="[(4, ref('base.group_erp_manager'))]"/>
  48. <field name="binding_model_id" ref="base.model_res_users" />
  49. <field name="state">code</field>
  50. <field name="code">records.action_reset_password()</field>
  51. </record>
  52. </odoo>