Skip to content

Commit

Permalink
fix template description being indented
Browse files Browse the repository at this point in the history
[FIX] Use human name and english category name for manifest

[IMP] multi line notes, unprefix names, pep8 py files

[IMP] whitespace cleanup in templates

[FIX] base models get _name, custom get _inherit

flake fix

add missing spaces

prevent crash on menus with no action

switch GPL-2 to LGPL-3

generate license headers with license name

fix pep/flake errors in generated files

add m2m and relation field options in fields
  • Loading branch information
Vincent Vinet authored and Maxime Chambreuil committed Oct 9, 2015
1 parent 4ac7556 commit 60f327b
Show file tree
Hide file tree
Showing 14 changed files with 402 additions and 150 deletions.
87 changes: 45 additions & 42 deletions module_prototyper/models/default_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,67 +21,70 @@
##############################################################################


def get_default_description(self):
"""
Extract the content of default description because the text is very huge
in module_prototyper model
"""
return """
Module name
===========
DEFAULT_DESCRIPTION = """
Module name
===========
This module was written to extend the functionality of ... to support ...
and allow you to ...
This module was written to extend the functionality of ... to support ...
and allow you to ...
Installation
============
Installation
============
To install this module, you need to:
To install this module, you need to:
* do this ...
* do this ...
Configuration
=============
Configuration
=============
To configure this module, you need to:
To configure this module, you need to:
* go to ...
* go to ...
Usage
=====
Usage
=====
To use this module, you need to:
To use this module, you need to:
* go to ...
* go to ...
For further information, please visit:
For further information, please visit:
* https://www.odoo.com/forum/help-1
* https://www.odoo.com/forum/help-1
Known issues / Roadmap
======================
Known issues / Roadmap
======================
* ...
* ...
Credits
=======
Credits
=======
Contributors
------------
Contributors
------------
* Firstname Lastname <[email protected]>
* Firsname Lastname <[email protected]>
Maintainer
----------
Maintainer
----------
.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://odoo-community.org
.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://odoo-community.org
This module is maintained by the OCA.
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit http://odoo-community.org."""

To contribute to this module, please visit http://odoo-community.org."""

def get_default_description(self):
"""
Extract the content of default description because the text is very huge
in module_prototyper model
"""
return DEFAULT_DESCRIPTION
19 changes: 19 additions & 0 deletions module_prototyper/models/ir_model_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from openerp import fields, models
from openerp.tools.translate import _


class ir_model_fields(models.Model):
Expand All @@ -28,3 +30,20 @@ class ir_model_fields(models.Model):

notes = fields.Text('Notes to developers.')
helper = fields.Text('Helper')
# TODO: Make column1 and 2 required if a model has a m2m to itself
column1 = fields.Char(
'Column1',
help=_("name of the column referring to 'these' records in the "
"relation table"),
)
column2 = fields.Char(
'Column2',
help=_("name of the column referring to 'those' records in the "
"relation table"),
)
limit = fields.Integer('Read limit', help=_("Read limit"))
context = fields.Char(
'Context',
help=_("Context to use on the client side when handling the field "
"(python dictionary)"),
)
73 changes: 73 additions & 0 deletions module_prototyper/models/licenses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# -*- encoding: utf-8 -*-
# #############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2010 - 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

BASE_GPL = """
This program is free software: you can redistribute it and/or modify
it under the terms of the {name} as
published by the Free Software Foundation{version}.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the {name}
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""


GPL3 = "GPL-3"
GPL3_L = "GPL-3 or any later version"
LGPL3 = "LGPL-3"
LGPL3_L = "LGPL-3 or any later version"
AGPL3 = "AGPL-3"
AGPL3_L = "AGPL-3 or any later version"
OSI = "Other OSI approved license"

V3 = " version 3"
V3L = """, either version 3 of the
License, or (at your option) any later version"""

GPL_LICENSES = {
GPL3: ("GNU General Public License", V3),
GPL3_L: ("GNU General Public License", V3L),
LGPL3: ("GNU Lesser General Public License", V3),
LGPL3_L: ("GNU Lesser General Public License", V3L),
AGPL3: ("GNU Affero General Public License", V3),
AGPL3_L: ("GNU Affero General Public License", V3L),
}

BASE_OSI = """
This program is free software: you should have received a copy of the
license under which it is distributed along with the program.
"""


def get_license_text(license):
""" Get the python license header for a license """
if license in GPL_LICENSES:
name, version = GPL_LICENSES[license]
return BASE_GPL.format(name=name, version=version).splitlines()
elif license == OSI:
return BASE_OSI
else:
return ""
Loading

0 comments on commit 60f327b

Please sign in to comment.