Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
3330 Представления

I'm creating a new model based on muk_dms_file

class TestModel(models.Model):
_name = 'testmodule.testmodel'
_inherit = 'muk_dms.file'

testfield = fields.Boolean()


No view defined so it uses the default treeview, formview etc.

Upload and Everything seems to works fine except that I can't download the files. The Download button gives me an empty file and if I try the download link: i.e. localhost:8069/dms/file/download/2 it gives me "Not Found" page. Somehow in the database the record exists in the table testmodule_testmodel but when you try downloading it searches in the original muk_dms_file  and for sure it doesn't exist

Аватар
Отменить
Автор Лучший ответ

Solved. It took redefining the download function in controllers.py

class Main(http.Controller):
       
    @http.route('/testmodule/file/download', auth="user", type='http')
    def file_download(self, id, **kw):
        return self._get_file(request.env['testmodule.file'].search([('id', '=', id)]))
Аватар
Отменить
Related Posts Ответы Просмотры Активность
4
февр. 25
2528
1
авг. 24
2117
2
нояб. 24
3281
3
окт. 23
14804
2
февр. 23
2453