Skip to content

Commit 55a9b8a

Browse files
committed
💣 trying to add refresh button
Signed-off-by: Vildan Safin <safin@it-projects.info>
1 parent e3b5afa commit 55a9b8a

File tree

6 files changed

+40
-11
lines changed

6 files changed

+40
-11
lines changed

saas_apps/__manifest__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"demo": [
2929
],
3030
"qweb": [
31+
'views/refresh.xml'
3132
],
3233

3334
"post_load": None,

saas_apps/models/saas_apps.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,12 @@ def add_new_module(self, name):
4747
})
4848
return True
4949

50-
def create(self, cr, user, vals, context=None):
51-
import wdb
52-
wdb.set_trace()
53-
new_id = super(product_test, self).create(cr, user, vals, context)
50+
def refresh(self):
5451
irmodules = self.env["ir.module.module"].search([])
5552
if len(irmodules) > len(self.search([])):
5653
for irmodule in irmodules:
5754
if len(self.search([('module_name', '=', irmodule.name)])) == 0:
5855
self.create({'module_name': irmodule.name})
59-
return new_id
6056

6157

6258
class SAASDependence(models.Model):
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
odoo.define('whatever.filter_button', function (require) {
2+
"use strict";
3+
4+
instance.web.ListView.include({
5+
load_list: function(data) {
6+
if (this.$buttons) {
7+
this.$buttons.find('.oe_new_button').click(this.proxy('do_new_button')) ;
8+
}
9+
},
10+
do_new_button: function () {
11+
//implement your clic logic here
12+
}
13+
});
14+
});

saas_apps/views/assets.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,9 @@
88
<script type="text/javascript" src="/saas_apps/static/src/js/apps.js"></script>
99
</xpath>
1010
</template>
11+
<template id="assets_backend" name="saas_lines assets" inherit_id="web.assets_backend">
12+
<xpath expr="." position="inside">
13+
<script type="text/javascript" src="/saas_apps/static/src/js/refresh_button.js"></script>
14+
</xpath>
15+
</template>
1116
</odoo>

saas_apps/views/manage.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,4 @@
6262
parent="website.menu_website_global_configuration"
6363
sequence="40"
6464
/>
65-
66-
<t t-extend="ListView.buttons">
67-
<t t-jquery="button.oe_list_add" t-operation="after">
68-
<button class="oe_button oe_new_button oe_highlight" type="button">New Button</button>
69-
</t>
70-
</t>
7165
</odoo>

saas_apps/views/refresh.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<template xml:space="preserve">
4+
5+
<t t-extend="ListView.buttons">
6+
7+
<t t-jquery="button.o_list_button_add" t-operation="after">
8+
9+
<button t-if="widget.modelName == 'saas.lines'" type="button" class="btn btn-primary btn-sm oe_filter_button" accesskey="f">
10+
11+
2283221337
12+
13+
</button>
14+
15+
</t>
16+
17+
</t>
18+
19+
</template>

0 commit comments

Comments
 (0)