diff --git a/base_optional_quick_create/README.rst b/base_optional_quick_create/README.rst index fb2fbe3..1779d65 100644 --- a/base_optional_quick_create/README.rst +++ b/base_optional_quick_create/README.rst @@ -1,10 +1,29 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg +===================== +Optional quick create +===================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 - -========================== -Base Optional Quick Create -========================== +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github + :target: https://github.com/OCA/server-ux/tree/12.0/base_optional_quick_create + :alt: OCA/server-ux +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/server-ux-12-0/server-ux-12-0-base_optional_quick_create + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/149/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| This module allows to avoid to *quick create* new records, through many2one fields, for a specific model. @@ -14,6 +33,11 @@ form. Got the idea from https://twitter.com/nbessi/status/337869826028605441 +**Table of contents** + +.. contents:: + :local: + Usage ===== @@ -23,37 +47,51 @@ To use this module, you need to: * select the model for which you want to disable the quick create option, * enable the option *Avoid quick create*. -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/149/10.0 - Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. +Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback. +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= +Authors +~~~~~~~ + +* Agile Business Group + Contributors ------------- +~~~~~~~~~~~~ + +* Jonathan Nemry jonathan.nemry@acsone.eu +* Lorenzo Battistini lorenzo.battistini@agilebg.com +* Alexis de Lattre alexis.delattre@akretion.com +* Gilles Meyomesse gilles.meyomesse@acsone.eu (https://acsone.eu) + +Other credits +~~~~~~~~~~~~~ -* Jonathan Nemry -* Lorenzo Battistini -* Alexis de Lattre +This module is maintained by: +* Odoo Community Association -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -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. +This module is part of the `OCA/server-ux `_ project on GitHub. -To contribute to this module, please visit https://odoo-community.org. +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_optional_quick_create/__init__.py b/base_optional_quick_create/__init__.py index cde864b..0650744 100644 --- a/base_optional_quick_create/__init__.py +++ b/base_optional_quick_create/__init__.py @@ -1,3 +1 @@ -# -*- coding: utf-8 -*- - from . import models diff --git a/base_optional_quick_create/__manifest__.py b/base_optional_quick_create/__manifest__.py index 6f0f78d..f9b433f 100644 --- a/base_optional_quick_create/__manifest__.py +++ b/base_optional_quick_create/__manifest__.py @@ -1,17 +1,18 @@ -# -*- coding: utf-8 -*- # Copyright 2013 Agile Business Group sagl () -# Copyright 2016 ACSONE SA/NA () +# Copyright 2016 ACSONE SA/NV () { - 'name': "Optional quick create", - 'version': '10.0.1.0.1', + 'name': 'Optional quick create', + 'version': '12.0.1.0.0', 'category': 'Tools', - 'summary': "Avoid 'quick create' on m2o fields, on a 'by model' basis", - 'author': "Agile Business Group,Odoo Community Association (OCA)", - 'website': 'http://www.agilebg.com', + 'summary': 'Avoid "quick create" on m2o fields, on a "by model" basis', + 'author': 'Agile Business Group,Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/server-ux', 'license': 'AGPL-3', - "depends": ['base'], - "data": [ + 'depends': [ + 'base' + ], + 'data': [ 'views/model_view.xml', ], 'installable': True, diff --git a/base_optional_quick_create/models/__init__.py b/base_optional_quick_create/models/__init__.py index 045938c..413bb23 100644 --- a/base_optional_quick_create/models/__init__.py +++ b/base_optional_quick_create/models/__init__.py @@ -1,3 +1 @@ -# -*- coding: utf-8 -*- - from . import ir_model diff --git a/base_optional_quick_create/models/ir_model.py b/base_optional_quick_create/models/ir_model.py index 014e272..af68a07 100644 --- a/base_optional_quick_create/models/ir_model.py +++ b/base_optional_quick_create/models/ir_model.py @@ -1,7 +1,7 @@ -# -*- coding: utf-8 -*- -# Copyright 2016 ACSONE SA/NA () -# Copyright 2016 Akretion (Alexis de Lattre ) +# Copyright 2016 ACSONE SA/NV (https://acsone.eu) +# Copyright 2016 Akretion (Alexis de Lattre alexis.delattre@akretion.com) # Copyright 2018 Simone Rubino - Agile Business Group +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import api, fields, models, _ from odoo.exceptions import UserError @@ -38,17 +38,17 @@ class IrModel(models.Model): def _register_hook(self): models = self.search([]) models._patch_quick_create() - return super(IrModel, self)._register_hook() + return super()._register_hook() @api.model @api.returns('self', lambda value: value.id) def create(self, vals): - ir_model = super(IrModel, self).create(vals) + ir_model = super().create(vals) ir_model._patch_quick_create() return ir_model @api.multi def write(self, vals): - res = super(IrModel, self).write(vals) + res = super().write(vals) self._patch_quick_create() return res diff --git a/base_optional_quick_create/readme/CONTRIBUTORS.rst b/base_optional_quick_create/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..f80ec94 --- /dev/null +++ b/base_optional_quick_create/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* Jonathan Nemry jonathan.nemry@acsone.eu +* Lorenzo Battistini lorenzo.battistini@agilebg.com +* Alexis de Lattre alexis.delattre@akretion.com +* Gilles Meyomesse gilles.meyomesse@acsone.eu (https://acsone.eu) \ No newline at end of file diff --git a/base_optional_quick_create/readme/CREDITS.rst b/base_optional_quick_create/readme/CREDITS.rst new file mode 100644 index 0000000..e8134ce --- /dev/null +++ b/base_optional_quick_create/readme/CREDITS.rst @@ -0,0 +1,2 @@ +This module is maintained by: +* Odoo Community Association \ No newline at end of file diff --git a/base_optional_quick_create/readme/DESCRIPTION.rst b/base_optional_quick_create/readme/DESCRIPTION.rst new file mode 100644 index 0000000..ccb52dc --- /dev/null +++ b/base_optional_quick_create/readme/DESCRIPTION.rst @@ -0,0 +1,7 @@ +This module allows to avoid to *quick create* new records, through many2one +fields, for a specific model. +You can configure which models should allow *quick create*. +When specified, the *quick create* option will always open the standard create +form. + +Got the idea from https://twitter.com/nbessi/status/337869826028605441 \ No newline at end of file diff --git a/base_optional_quick_create/readme/USAGE.rst b/base_optional_quick_create/readme/USAGE.rst new file mode 100644 index 0000000..09e5a41 --- /dev/null +++ b/base_optional_quick_create/readme/USAGE.rst @@ -0,0 +1,5 @@ +To use this module, you need to: + + * go into the menu of *ir_model*, + * select the model for which you want to disable the quick create option, + * enable the option *Avoid quick create*. \ No newline at end of file diff --git a/base_optional_quick_create/static/description/index.html b/base_optional_quick_create/static/description/index.html new file mode 100644 index 0000000..5c831c5 --- /dev/null +++ b/base_optional_quick_create/static/description/index.html @@ -0,0 +1,445 @@ + + + + + + +Optional quick create + + + +
+

Optional quick create

+ + +

Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

+

This module allows to avoid to quick create new records, through many2one +fields, for a specific model. +You can configure which models should allow quick create. +When specified, the quick create option will always open the standard create +form.

+

Got the idea from https://twitter.com/nbessi/status/337869826028605441

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
+
    +
  • go into the menu of ir_model,
  • +
  • select the model for which you want to disable the quick create option,
  • +
  • enable the option Avoid quick create.
  • +
+
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Agile Business Group
  • +
+
+ +
+

Other credits

+

This module is maintained by: +* Odoo Community Association

+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/server-tools project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/base_optional_quick_create/tests/__init__.py b/base_optional_quick_create/tests/__init__.py index 3af4c0e..d51c305 100644 --- a/base_optional_quick_create/tests/__init__.py +++ b/base_optional_quick_create/tests/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from . import test_quick_create diff --git a/base_optional_quick_create/tests/test_quick_create.py b/base_optional_quick_create/tests/test_quick_create.py index c468874..f218b4f 100644 --- a/base_optional_quick_create/tests/test_quick_create.py +++ b/base_optional_quick_create/tests/test_quick_create.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2018 Simone Rubino - Agile Business Group # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). @@ -9,7 +8,7 @@ from odoo.tests.common import TransactionCase class TestQuickCreate(TransactionCase): def setUp(self, *args, **kwargs): - super(TestQuickCreate, self).setUp() + super().setUp() model_model = self.env['ir.model'] self.partner_model = model_model.search([ ('model', '=', 'res.partner')])