Skip to Content
Menú
This question has been flagged
3 Respostes
8109 Vistes

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
Best Answer

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
Best Answer

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

Avatar
Descartar
Related Posts Respostes Vistes Activitat
0
de juny 21
4688
2
de gen. 25
6700
1
d’abr. 24
2664
1
de des. 23
4841
2
de nov. 22
4001