Browse Source
base_optional_quick_create clears _api field of name_create method, unsetting the flag clears the patch
base_optional_quick_create clears _api field of name_create method, unsetting the flag clears the patch
Currently translated at 100,0% (3 of 3 strings) Translation: server-tools-10.0/server-tools-10.0-base_optional_quick_create Translate-URL: https://translation.odoo-community.org/projects/server-tools-10-0/server-tools-10-0-base_optional_quick_create/de/pull/31/head
Simone Rubino
7 years ago
committed by
Gilles Meyomesse
18 changed files with 177 additions and 99 deletions
-
6base_optional_quick_create/__manifest__.py
-
26base_optional_quick_create/i18n/base_optional_quick_create.pot
-
20base_optional_quick_create/i18n/de.po
-
6base_optional_quick_create/i18n/es.po
-
6base_optional_quick_create/i18n/fi.po
-
8base_optional_quick_create/i18n/fr.po
-
14base_optional_quick_create/i18n/hr.po
-
12base_optional_quick_create/i18n/hr_HR.po
-
27base_optional_quick_create/i18n/it.po
-
9base_optional_quick_create/i18n/nb_NO.po
-
14base_optional_quick_create/i18n/pt_BR.po
-
14base_optional_quick_create/i18n/sl.po
-
6base_optional_quick_create/i18n/tr.po
-
9base_optional_quick_create/i18n/tr_TR.po
-
11base_optional_quick_create/i18n/zh_CN.po
-
29base_optional_quick_create/models/ir_model.py
-
4base_optional_quick_create/tests/__init__.py
-
29base_optional_quick_create/tests/test_quick_create.py
@ -0,0 +1,4 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). |
||||
|
|
||||
|
from . import test_quick_create |
@ -0,0 +1,29 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2018 Simone Rubino - Agile Business Group |
||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). |
||||
|
|
||||
|
from odoo.exceptions import UserError |
||||
|
from odoo.tests.common import TransactionCase |
||||
|
|
||||
|
|
||||
|
class TestQuickCreate(TransactionCase): |
||||
|
|
||||
|
def setUp(self, *args, **kwargs): |
||||
|
super(TestQuickCreate, self).setUp() |
||||
|
model_model = self.env['ir.model'] |
||||
|
self.partner_model = model_model.search([ |
||||
|
('model', '=', 'res.partner')]) |
||||
|
|
||||
|
def test_quick_create(self): |
||||
|
partner_id = self.env['res.partner'].name_create('TEST partner') |
||||
|
self.assertEqual(bool(partner_id), True) |
||||
|
|
||||
|
# Setting the flag, patches the method |
||||
|
self.partner_model.avoid_quick_create = True |
||||
|
with self.assertRaises(UserError): |
||||
|
self.env['res.partner'].name_create('TEST partner') |
||||
|
|
||||
|
# Unsetting the flag, unpatches the method |
||||
|
self.partner_model.avoid_quick_create = False |
||||
|
partner_id = self.env['res.partner'].name_create('TEST partner') |
||||
|
self.assertEqual(bool(partner_id), True) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue