Browse Source

Add readme fragments + code review

pull/1590/head
Andrea 6 years ago
committed by Holger Brunn
parent
commit
7499ef6b0f
  1. 4
      base_directory_file_download/__manifest__.py
  2. 6
      base_directory_file_download/models/ir_filesystem_directory.py
  3. 4
      base_directory_file_download/models/ir_filesystem_file.py
  4. 3
      base_directory_file_download/readme/CONFIGURE.rst
  5. 1
      base_directory_file_download/readme/CONTRIBUTORS.rst
  6. 8
      base_directory_file_download/readme/DESCRIPTION.rst
  7. 7
      base_directory_file_download/readme/USAGE.rst
  8. 2
      base_directory_file_download/tests/test_directory_files_download.py
  9. 2
      base_directory_file_download/views/ir_filesystem_directory.xml

4
base_directory_file_download/__manifest__.py

@ -1,12 +1,12 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2017-2018 Onestein (<http://www.onestein.eu>)
# Copyright 2017-2018 Onestein (<https://www.onestein.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{ {
'name': 'Directory Files Download', 'name': 'Directory Files Download',
'summary': 'Download all files of a directory on server', 'summary': 'Download all files of a directory on server',
'author': 'Onestein, Odoo Community Association (OCA)', 'author': 'Onestein, Odoo Community Association (OCA)',
'website': 'http://www.onestein.eu',
'website': 'https://github.com/OCA/server-tools',
'category': 'Tools', 'category': 'Tools',
'version': '10.0.1.0.0', 'version': '10.0.1.0.0',
'license': 'AGPL-3', 'license': 'AGPL-3',

6
base_directory_file_download/models/ir_filesystem_directory.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2017-2018 Onestein (<http://www.onestein.eu>)
# Copyright 2017-2018 Onestein (<https://www.onestein.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import logging import logging
@ -21,11 +21,11 @@ class IrFilesystemDirectory(models.Model):
file_ids = fields.One2many( file_ids = fields.One2many(
'ir.filesystem.file', 'ir.filesystem.file',
compute='_compute_file_ids', compute='_compute_file_ids',
string='Files'
string='Files',
) )
file_count = fields.Integer( file_count = fields.Integer(
compute='_compute_file_count', compute='_compute_file_count',
string="# Files"
string="# Files",
) )
@api.multi @api.multi

4
base_directory_file_download/models/ir_filesystem_file.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2017-2018 Onestein (<http://www.onestein.eu>)
# Copyright 2017-2018 Onestein (<https://www.onestein.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import logging import logging
@ -21,7 +21,7 @@ class IrFilesystemDirectoryLine(models.TransientModel):
stored_filename = fields.Char() stored_filename = fields.Char()
directory_id = fields.Many2one( directory_id = fields.Many2one(
'ir.filesystem.directory', 'ir.filesystem.directory',
string='Directory'
string='Directory',
) )
@api.multi @api.multi

3
base_directory_file_download/readme/CONFIGURE.rst

@ -0,0 +1,3 @@
To configure this module, you need to:
#. Set the group "Download files of directory" for the users who need this functionality.

1
base_directory_file_download/readme/CONTRIBUTORS.rst

@ -0,0 +1 @@
* Andrea Stirpe <a.stirpe@onestein.nl>

8
base_directory_file_download/readme/DESCRIPTION.rst

@ -0,0 +1,8 @@
View and download the files contained in a directory on the server.
This functionality can have impacts on the security of your system,
since it allows to download the content of a directory.
Be careful when choosing the directory!
Notice that, for security reasons, files like symbolic links
and up-level references are ignored.

7
base_directory_file_download/readme/USAGE.rst

@ -0,0 +1,7 @@
To use this module, you need to:
#. Go to Settings -> Downloads -> Directory Content
#. Create a record specifying Name and Directory of the server
#. Save; a list of files contained in the selected directory is displayed
#. Download the file you need
#. In case the content of the directory is modified, refresh the list by clicking the button on the top-right of the form

2
base_directory_file_download/tests/test_directory_files_download.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2017-2018 Onestein (<http://www.onestein.eu>)
# Copyright 2017-2018 Onestein (<https://www.onestein.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import os import os

2
base_directory_file_download/views/ir_filesystem_directory.xml

@ -49,7 +49,7 @@
<record id="ir_filesystem_directory_tree" model="ir.ui.view"> <record id="ir_filesystem_directory_tree" model="ir.ui.view">
<field name="model">ir.filesystem.directory</field> <field name="model">ir.filesystem.directory</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Directory">
<tree>
<field name="name" /> <field name="name" />
<field name="directory" /> <field name="directory" />
</tree> </tree>

Loading…
Cancel
Save