Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
7521 Переглядів

 I'm trying to create a button in Odoo sass-14 that simply saves the record. I don't want the button to do anything else, just save the record. If I implement the button this way:


    <button string="Save" class="btn-primary"/>


This record saves, but I get an error in the UI that says:


    https://my-server.odoo.com/web/content/513-eca963c/web.assets_backend.js:2303

    Traceback:

    TypeError: Cannot read property 'fail' of undefined

        at Class.on_confirmed (https://my-server.odoo.com/web/content/513-eca963c/web.assets_backend.js:2303:919)

        at exec_action (https://my-server.odoo.com/web/content/513-eca963c/web.assets_backend.js:2303:522)

        at https://my-server.odoo.com/web/content/490-ff226a6/web.assets_common.js:547:681

        at fire (https://my-server.odoo.com/web/content/490-ff226a6/web.assets_common.js:541:299)

        at Object.fireWith [as resolveWith] (https://my-server.odoo.com/web/content/490-ff226a6/web.assets_common.js:546:198)

        at https://my-server.odoo.com/web/content/490-ff226a6/web.assets_common.js:547:874

        at fire (https://my-server.odoo.com/web/content/490-ff226a6/web.assets_common.js:541:299)

        at Object.fireWith [as resolveWith] (https://my-server.odoo.com/web/content/490-ff226a6/web.assets_common.js:546:198)

        at deferred.(anonymous function) (https://my-server.odoo.com/web/content/490-ff226a6/web.assets_common.js:548:56)

        at fire (https://my-server.odoo.com/web/content/490-ff226a6/web.assets_common.js:541:299)


Is it possible to create a button that simply saves the record?

Аватар
Відмінити
Найкраща відповідь

I would think that the button is still going to have call a python function (even if that function does nothing) or an action (even if the action might just open the current view).


To do the function option:

1. Add the following attributes to the button; type='object' name='python_function'

2. In python create the following:

def python_function(self):
    return False
Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
Open View from Button Вирішено
2
груд. 23
18294
1
лип. 17
4281
3
черв. 21
9348
1
груд. 18
5581
2
лист. 18
7881