İçereği Atla
Menü
Bu soru işaretlendi
3 Cevaplar
8105 Görünümler

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
Vazgeç
En İyi Yanıt

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
Vazgeç
En İyi Yanıt

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

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Haz 21
4683
2
Oca 25
6695
computed fields Çözüldü
1
Nis 24
2662
1
Ara 23
4839
2
Kas 22
4000