Skip to content

Commit

Permalink
💣 trying to add refresh button
Browse files Browse the repository at this point in the history
Signed-off-by: Vildan Safin <[email protected]>
  • Loading branch information
Enigma228322 committed Feb 29, 2020
1 parent e3b5afa commit 55a9b8a
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 11 deletions.
1 change: 1 addition & 0 deletions saas_apps/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"demo": [
],
"qweb": [
'views/refresh.xml'
],

"post_load": None,
Expand Down
6 changes: 1 addition & 5 deletions saas_apps/models/saas_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,12 @@ def add_new_module(self, name):
})
return True

def create(self, cr, user, vals, context=None):
import wdb
wdb.set_trace()
new_id = super(product_test, self).create(cr, user, vals, context)
def refresh(self):
irmodules = self.env["ir.module.module"].search([])
if len(irmodules) > len(self.search([])):
for irmodule in irmodules:
if len(self.search([('module_name', '=', irmodule.name)])) == 0:
self.create({'module_name': irmodule.name})
return new_id


class SAASDependence(models.Model):
Expand Down
14 changes: 14 additions & 0 deletions saas_apps/static/src/js/refresh_button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
odoo.define('whatever.filter_button', function (require) {
"use strict";

instance.web.ListView.include({
load_list: function(data) {
if (this.$buttons) {
this.$buttons.find('.oe_new_button').click(this.proxy('do_new_button')) ;
}
},
do_new_button: function () {
//implement your clic logic here
}
});
});
5 changes: 5 additions & 0 deletions saas_apps/views/assets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@
<script type="text/javascript" src="/saas_apps/static/src/js/apps.js"></script>
</xpath>
</template>
<template id="assets_backend" name="saas_lines assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/saas_apps/static/src/js/refresh_button.js"></script>
</xpath>
</template>
</odoo>
6 changes: 0 additions & 6 deletions saas_apps/views/manage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,4 @@
parent="website.menu_website_global_configuration"
sequence="40"
/>

<t t-extend="ListView.buttons">
<t t-jquery="button.oe_list_add" t-operation="after">
<button class="oe_button oe_new_button oe_highlight" type="button">New Button</button>
</t>
</t>
</odoo>
19 changes: 19 additions & 0 deletions saas_apps/views/refresh.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>

<template xml:space="preserve">

<t t-extend="ListView.buttons">

<t t-jquery="button.o_list_button_add" t-operation="after">

<button t-if="widget.modelName == 'saas.lines'" type="button" class="btn btn-primary btn-sm oe_filter_button" accesskey="f">

2283221337

</button>

</t>

</t>

</template>

0 comments on commit 55a9b8a

Please sign in to comment.