Browse Source

[MIG][11.0] base_optional_quick_create

pull/14/head
Florent de Labarre 7 years ago
committed by Pedro M. Baeza
parent
commit
58d8e99bed
  1. 2
      base_optional_quick_create/README.rst
  2. 2
      base_optional_quick_create/__init__.py
  3. 9
      base_optional_quick_create/__manifest__.py
  4. 2
      base_optional_quick_create/models/__init__.py
  5. 2
      base_optional_quick_create/models/ir_model.py
  6. 3
      base_optional_quick_create/tests/__init__.py
  7. 6
      base_optional_quick_create/tests/test_quick_create.py

2
base_optional_quick_create/README.rst

@ -25,7 +25,7 @@ To use this module, you need to:
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/10.0
:target: https://runbot.odoo-community.org/runbot/250/11.0
Bug Tracker Bug Tracker
=========== ===========

2
base_optional_quick_create/__init__.py

@ -1,3 +1 @@
# -*- coding: utf-8 -*-
from . import models from . import models

9
base_optional_quick_create/__manifest__.py

@ -1,17 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2013 Agile Business Group sagl (<http://www.agilebg.com>) # Copyright 2013 Agile Business Group sagl (<http://www.agilebg.com>)
# Copyright 2016 ACSONE SA/NA (<http://acsone.eu>) # Copyright 2016 ACSONE SA/NA (<http://acsone.eu>)
{ {
'name': "Optional quick create", 'name': "Optional quick create",
'version': '10.0.1.0.1',
'version': '11.0.1.0.0',
'category': 'Tools', 'category': 'Tools',
'summary': "Avoid 'quick create' on m2o fields, on a 'by model' basis", 'summary': "Avoid 'quick create' on m2o fields, on a 'by model' basis",
'author': "Agile Business Group,Odoo Community Association (OCA)", 'author': "Agile Business Group,Odoo Community Association (OCA)",
'website': 'http://www.agilebg.com',
'website': 'http://github.com/OCA/server-ux',
'license': 'AGPL-3', 'license': 'AGPL-3',
"depends": ['base'],
"data": [
'depends': ['base'],
'data': [
'views/model_view.xml', 'views/model_view.xml',
], ],
'installable': True, 'installable': True,

2
base_optional_quick_create/models/__init__.py

@ -1,3 +1 @@
# -*- coding: utf-8 -*-
from . import ir_model from . import ir_model

2
base_optional_quick_create/models/ir_model.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016 ACSONE SA/NA (<http://acsone.eu>) # Copyright 2016 ACSONE SA/NA (<http://acsone.eu>)
# Copyright 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) # Copyright 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# Copyright 2018 Simone Rubino - Agile Business Group # Copyright 2018 Simone Rubino - Agile Business Group
@ -41,7 +40,6 @@ class IrModel(models.Model):
return super(IrModel, self)._register_hook() return super(IrModel, self)._register_hook()
@api.model @api.model
@api.returns('self', lambda value: value.id)
def create(self, vals): def create(self, vals):
ir_model = super(IrModel, self).create(vals) ir_model = super(IrModel, self).create(vals)
ir_model._patch_quick_create() ir_model._patch_quick_create()

3
base_optional_quick_create/tests/__init__.py

@ -1,4 +1 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import test_quick_create from . import test_quick_create

6
base_optional_quick_create/tests/test_quick_create.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Simone Rubino - Agile Business Group # Copyright 2018 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
@ -27,3 +26,8 @@ class TestQuickCreate(TransactionCase):
self.partner_model.avoid_quick_create = False self.partner_model.avoid_quick_create = False
partner_id = self.env['res.partner'].name_create('TEST partner') partner_id = self.env['res.partner'].name_create('TEST partner')
self.assertEqual(bool(partner_id), True) self.assertEqual(bool(partner_id), True)
def test_create_model(self):
model_id = self.env['ir.model'].create({'name': 'Test',
'model': 'x_test_model'})
self.assertEqual(bool(model_id), True)
Loading…
Cancel
Save