Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
8106 Vistas

Since, the content of my form is small and the default width of the modal is always set to 'modal-lg', i wanna know if there is a way that i can set a button call to use 'modal-md' to perfectly fit the content of the form?

I like to do it in this button call.

<button class="btn btn-md btn-secondary" name="add_teacher_comment" type="object" attrs="{'invisible':[('id', '=', False)]}">Add</button>
@api.multi    
def add_teacher_comment(self):
return {
            'type': 'ir.actions.act_window',            
            'name': _('Add Teacher Comment'),            
            'res_model': 'teacher.comment',            
            'target': 'new',            
            'views': [[False, 'form']],            
            'nodestroy' : True,            
         }
Any input please? 
Avatar
Descartar
Mejor respuesta

Hi,​

I think there is no such feature to add window size from python code

you can change window size by extending Dialog widget:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets" inherit_id="web.assets_common">
<xpath expr="." position="inside">
<script type="text/javascript" src="/custom_module/static/src/js/dialog.js"/>
</xpath>
</template>
</odoo>

dialog.js :-

odoo.define('custom_module.small_dialog', function (require) {
"use strict";
var Dialog = require('web.Dialog');

Dialog.include({
willStart: function () {
var self = this;
if(this.title === 'Create new interest note'){
this.size = 'small';
}
return this._super.apply(this, arguments);
}
});

});

You can also use 

this.size = 'medium'; 

by adding necessary changes in the code.


Thanks

Avatar
Descartar
Mejor respuesta

You should be able to do this by customizing the view which contains the button.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
jun 21
4688
2
ene 25
6697
1
abr 24
2662
1
dic 23
4841
2
nov 22
4001