Odoo Help


How to enforce a pop up window?

Gavin Yap
on 8/14/15, 3:28 AM 1,644 views

Hi All,

I've created a pop up form and wishes to enforce user to fill in the details without them to close it until it is completed.

An example use case is like a EULA agreement, they have to agree before continuing into the application.

Is there a way to do that?

Gavin Yap
On 4/17/16, 8:25 AM

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"

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>

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">
<field name="content"/>
<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>

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)
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):
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)])
eula = http.request.env['eula.eula'].search([('id', '=', 1)])
eula.agree = True
return werkzeug.utils.redirect("/")


Tarek Mohamed Ibrahim

--Tarek Mohamed Ibrahim--
| 5 3 7
Gîza, Egypt
--Tarek Mohamed Ibrahim--

I am an old VFP developer on ERP

I have moved to 2p since Nov-2014 and started developing with Python on Odoo.



Tarek Mohamed Ibrahim
On 8/14/15, 11:18 PM

Try to get this button using xpath expression from the fields_view_get of the wizard class.

Then via a loop set its invisible property to true 

check the code posted in the following two links, it would help expressing my idea



I investigate, it seems that the fields_view_get does not attribute to disable closing of the pop up form

Gavin Yap
on 8/18/15, 7:26 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/14/15, 3:28 AM
Seen: 1644 times
Last updated: 4/17/16, 8:26 AM