Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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?
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
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="model_id" ref="model_eula_eula"/>
<field name="code">action = self.trigger(cr, uid, None, context)</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="arch" type="xml">
<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
_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)
_logger.info("Enter Eula Trigger")
'name': 'EULA Agreement',
Finally a special route and controller to remove the eula menu if accepted.
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
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
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 8/14/15, 3:28 AM|
|Seen: 962 times|
|Last updated: 4/17/16, 8:26 AM|