web mailing list archives

web@odoo-community.org

Avatar

How-to close a Formview ?

by
DEC, Yann Papouin
- 14/07/2020 18:41:31
Hello everyone,

I'm looking for a way to close a form opened after clicking on a line of a list/tree from a many2many field from Odoo 12.

In that purchase.order.line form, I added two buttons to delete (unlink) this line but I'm doing specific actions before this, like canceling attached moves.

Since this line will not exist anymore in the database after clicking the button, I'm returning an 'ir.actions.act_view_reload' to refresh the purchase.order but I'm still trying to close the current opened form.

I tried to add data-dismiss="modal" to my button to use the bootstrap-like behaviour. But it works only if there is no confirm dialog and the button is not in header or footer.

I also tried to return 'ir.actions.act_window_close' but it is not doing anything for Formviews.

I know that I could extend Formview from a custom js module but I know nothing about the js-part of the odoo framework and I'm not a javascript developer. I tried to find a reference about the currently opened Formview in ActionManager to close it manually but I didn't find anything.

Maybe one of you could guide me to the right direction ?

Cordialement,
Yann Papouin.

PAPOUIN Yann
Ingénieur R&D
y.papouin@dec-industrie.com

https://www.dec-groupe.fr
https://www.dec-industrie.com
ZAC du Monné
3 r Champ du Verger

72700 ALLONNES

02 43 21 65 50
02 43 39 30 78