콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
11205 화면

Hi, I'm new to python and odoo. I made a custom dashboard view. But when I drag one of the views inside, this error comes out:

Odoo Server Error
Traceback (most recent call last):
  File "C:\Users\Administrator\odoo-13.0\odoo\http.py", line 624, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "C:\Users\Administrator\odoo-13.0\odoo\http.py", line 310, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "C:\Users\Administrator\odoo-13.0\odoo\tools\pycompat.py", line 14, in reraise
    raise value
  File "C:\Users\Administrator\odoo-13.0\odoo\http.py", line 669, in dispatch
    result = self._call_function(**self.params)
  File "C:\Users\Administrator\odoo-13.0\odoo\http.py", line 350, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "C:\Users\Administrator\odoo-13.0\odoo\service\model.py", line 93, in wrapper
    return f(dbname, *args, **kwargs)
  File "C:\Users\Administrator\odoo-13.0\odoo\http.py", line 339, in checked_call
    result = self.endpoint(*a, **kw)
  File "C:\Users\Administrator\odoo-13.0\odoo\http.py", line 915, in __call__
    return self.method(*args, **kw)
  File "C:\Users\Administrator\odoo-13.0\odoo\http.py", line 515, in response_wrap
    response = f(*args, **kw)
TypeError: edit_custom() missing 1 required positional argument: 'custom_id'

The process of making a custom dashboard is from a youtube tutorial. The tutorial experienced the same issue and provided a solution, which is to change the js code in the dashboard module in odoo.

//before
_saveDashboard: function () {
        var board = this.renderer.getBoard();
        var arch = QWeb.render('DashBoard.xml'_.extend({}, board));
        return this._rpc({
                route: '/web/view/edit_custom',
                params: {
                    custom_id: this.customViewID,
                    arch: arch,
                }
            }).then(dataManager.invalidate.bind(dataManager));
    },

//after
_saveDashboard: function () {
var board = this.renderer.getBoard();
var arch = QWeb.render('DashBoard.xml', _.extend({}, board));
return this._rpc({
route: '/web/view/edit_custom',
params: {
custom_id: this.customViewID !=null? this.customViewID: '',
arch: arch,
}
}).then(dataManager.invalidate.bind(dataManager));
},

In the tutorial, it works. But what I desperately need is to write a js file to override this _saveDashboard method inside "/addons/board/static/src/js/board_view.js". I tried to google relevant issues on forums but still cannot find a solution or explanation of this. I tried to learn js to understand the issue but still not helpful.


Can anyone show me how to override this method in my custom module?

아바타
취소

The solution for this issue is shown in this video, which illustrate the steps of creating dashboard in odoo: https://youtu.be/kfffu4Uzo10?t=924

베스트 답변

_saveDashboard: function () {
        var board = this.renderer.getBoard();
        var arch = QWeb.render('DashBoard.xml', _.extend({}, board));
        return this._rpc({
                route: '/web/view/edit_custom',
                params: {
                    custom_id: this.customViewID ? this.customViewID : "",
                    arch: arch,
                }
            }).then(dataManager.invalidate.bind(dataManager));
    },

Replace this propertie in dashboard module static js code, can help anyone who have same issue !


아바타
취소

How can we do it in our own custom module?
It works if we edit it in the source code.

베스트 답변

For a temporary solution, write the below code in your controller

@http.route('/web/view/edit_custom', type='json', auth="user")

def edit_custom(self, arch):

        return {'result': True}

Cheers!


아바타
취소
관련 게시물 답글 화면 활동
0
7월 25
409
1
7월 25
5294
0
7월 25
838
0
6월 25
847
1
6월 25
1024