My solution to my problem is to create a menu "eula" with sequence 0, that would trigger a server action. Whenever a user logins, it will go to the first item of the menu item. Thus by doing this, it will alway trigger the eula form I intend to display
<menuitem id="main_eula_menu"
name="EULA"
sequence="0"
action="ir_actions_server_eula_trigger"
/>
the menu would then trigger the server action below upon login.
<record id="ir_actions_server_eula_trigger" model="ir.actions.server">
<field name="sequence" eval="5"/>
<field name="state">code</field>
<field name="type">ir.actions.server</field>
<field name="model_id" ref="model_eula_eula"/>
<field name="code">action = self.trigger(cr, uid, None, context)</field>
<field name="condition">True</field>
<field name="name">EULA Agreement</field>
</record>
the form below is used to allow user's to agree or disagree the eula.
<record id="view_form_eula" model="ir.ui.view">
<field name="name">view_form_eula</field>
<field name="model">eula.eula</field>
<field name="arch" type="xml">
<form>
<div>
<field name="content"/>
</div>
<footer>
<a href="/eula/agree" class="oe_button">I agree</a>
<a href="/web/session/logout?redirect=/web" class="oe_button oe_highlight">I disagree</a>
</footer>
</form>
</field>
</record>
the Eula model which has a trigger method to be called by the server action
class Eula(models.Model):
_name = 'eula.eula'
name = fields.Char()
content = fields.Html(readonly=True)
agree = fields.Boolean(string="Agree", help="By checking this, you agree to the EULA.", default=False)
@api.multi
def trigger(self):
_logger.info("Enter Eula Trigger")
return {
'name': 'EULA Agreement',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'eula.eula',
'res_id': 1,
'type': 'ir.actions.act_window',
'target': 'new'
}
Finally a special route and controller to remove the eula menu if accepted.
class Eula(http.Controller):
@http.route('/eula/agree/', auth='user')
def index(self, **kw):
_logger.info(self);
model_datas = http.request.env['ir.model.data'].search([('module', '=', 'eula'), ('model', '=', 'ir.ui.menu')])
for model_data in model_datas:
model_name = model_data.model
model_id = model_data.res_id
model = http.request.env[model_name].search([('id', '=', model_id)])
model.sudo().unlink()
model_data.sudo().unlink()
eula = http.request.env['eula.eula'].search([('id', '=', 1)])
eula.agree = True
return werkzeug.utils.redirect("/")