Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
8120 Widoki

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? 
Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
cze 21
4705
2
sty 25
6715
computed fields Rozwiązane
1
kwi 24
2684
1
gru 23
4855
2
lis 22
4014