Browse Source

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
parent
commit
1d5d3a9bdb
  1. 6
      base_optional_quick_create/__manifest__.py
  2. 26
      base_optional_quick_create/i18n/base_optional_quick_create.pot
  3. 22
      base_optional_quick_create/i18n/de.po
  4. 8
      base_optional_quick_create/i18n/es.po
  5. 8
      base_optional_quick_create/i18n/fi.po
  6. 10
      base_optional_quick_create/i18n/fr.po
  7. 16
      base_optional_quick_create/i18n/hr.po
  8. 14
      base_optional_quick_create/i18n/hr_HR.po
  9. 29
      base_optional_quick_create/i18n/it.po
  10. 11
      base_optional_quick_create/i18n/nb_NO.po
  11. 16
      base_optional_quick_create/i18n/pt_BR.po
  12. 16
      base_optional_quick_create/i18n/sl.po
  13. 8
      base_optional_quick_create/i18n/tr.po
  14. 11
      base_optional_quick_create/i18n/tr_TR.po
  15. 13
      base_optional_quick_create/i18n/zh_CN.po
  16. 29
      base_optional_quick_create/models/ir_model.py
  17. 4
      base_optional_quick_create/tests/__init__.py
  18. 29
      base_optional_quick_create/tests/test_quick_create.py

6
base_optional_quick_create/__manifest__.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
# © 2013 Agile Business Group sagl (<http://www.agilebg.com>)
# © 2016 ACSONE SA/NA (<http://acsone.eu>)
# Copyright 2013 Agile Business Group sagl (<http://www.agilebg.com>)
# Copyright 2016 ACSONE SA/NA (<http://acsone.eu>)
{
'name': "Optional quick create",
'version': '10.0.1.0.0',
'version': '10.0.1.0.1',
'category': 'Tools',
'summary': "Avoid 'quick create' on m2o fields, on a 'by model' basis",
'author': "Agile Business Group,Odoo Community Association (OCA)",

26
base_optional_quick_create/i18n/base_optional_quick_create.pot

@ -1,13 +1,11 @@
# Translation of OpenERP Server.
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_optional_quick_create
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-03-14 17:41+0000\n"
"PO-Revision-Date: 2014-03-14 17:41+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -16,25 +14,19 @@ msgstr ""
"Plural-Forms: \n"
#. module: base_optional_quick_create
#: model:_description:0
#: model:ir.model,name:base_optional_quick_create.model_ir_model
msgid "Models"
#: model:ir.model.fields,field_description:base_optional_quick_create.field_ir_model_avoid_quick_create
msgid "Avoid quick create"
msgstr ""
#. module: base_optional_quick_create
#: code:addons/base_optional_quick_create/model.py:35
#: code:addons/base_optional_quick_create/models/ir_model.py:21
#, python-format
msgid "Can't create quickly. Opening create form"
msgstr ""
#. module: base_optional_quick_create
#: field:ir.model,avoid_quick_create:0
msgid "Avoid quick create"
msgid "Can't create %s with name %s quickly.\n"
"Please contact your system administrator to disable this behaviour."
msgstr ""
#. module: base_optional_quick_create
#: code:addons/base_optional_quick_create/model.py:35
#, python-format
msgid "Error"
#: model:ir.model,name:base_optional_quick_create.model_ir_model
msgid "Models"
msgstr ""

22
base_optional_quick_create/i18n/de.po

@ -1,7 +1,7 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_optional_quick_create
#
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
# Rudolf Schnapka <rs@techno-flex.de>, 2017
@ -10,14 +10,15 @@ msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-10 00:47+0000\n"
"PO-Revision-Date: 2017-05-10 00:47+0000\n"
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>, 2017\n"
"PO-Revision-Date: 2018-09-06 13:26+0000\n"
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.1.1\n"
#. module: base_optional_quick_create
#: model:ir.model.fields,field_description:base_optional_quick_create.field_ir_model_avoid_quick_create
@ -27,10 +28,17 @@ msgstr "Unterbinde Schnellanlage"
#. module: base_optional_quick_create
#: code:addons/base_optional_quick_create/models/ir_model.py:21
#, python-format
msgid "Can't create quickly. Opening create form"
msgstr "Kann Schnellanlage nicht ausführen. Verwenden Sie Formularanlage"
msgid ""
"Can't create %s with name %s quickly.\n"
"Please contact your system administrator to disable this behaviour."
msgstr ""
"Kann %s mit Name %s nicht schnell anlegen.\n"
"Sprechen Sie mit dem Administrator, um dieses Verhalten abzustellen."
#. module: base_optional_quick_create
#: model:ir.model,name:base_optional_quick_create.model_ir_model
msgid "Models"
msgstr "Datenmodelle"
#~ msgid "Can't create quickly. Opening create form"
#~ msgstr "Kann Schnellanlage nicht ausführen. Verwenden Sie Formularanlage"

8
base_optional_quick_create/i18n/es.po

@ -1,7 +1,7 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_optional_quick_create
#
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
@ -12,10 +12,10 @@ msgstr ""
"PO-Revision-Date: 2017-05-01 10:38+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: base_optional_quick_create
@ -26,7 +26,9 @@ msgstr ""
#. module: base_optional_quick_create
#: code:addons/base_optional_quick_create/models/ir_model.py:21
#, python-format
msgid "Can't create quickly. Opening create form"
msgid ""
"Can't create %s with name %s quickly.\n"
"Please contact your system administrator to disable this behaviour."
msgstr ""
#. module: base_optional_quick_create

8
base_optional_quick_create/i18n/fi.po

@ -1,7 +1,7 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_optional_quick_create
#
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
@ -12,10 +12,10 @@ msgstr ""
"PO-Revision-Date: 2017-05-01 10:38+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Finnish (https://www.transifex.com/oca/teams/23907/fi/)\n"
"Language: fi\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: base_optional_quick_create
@ -26,7 +26,9 @@ msgstr ""
#. module: base_optional_quick_create
#: code:addons/base_optional_quick_create/models/ir_model.py:21
#, python-format
msgid "Can't create quickly. Opening create form"
msgid ""
"Can't create %s with name %s quickly.\n"
"Please contact your system administrator to disable this behaviour."
msgstr ""
#. module: base_optional_quick_create

10
base_optional_quick_create/i18n/fr.po

@ -1,7 +1,7 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_optional_quick_create
#
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
@ -12,10 +12,10 @@ msgstr ""
"PO-Revision-Date: 2016-07-30 00:58+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: base_optional_quick_create
@ -24,9 +24,11 @@ msgid "Avoid quick create"
msgstr ""
#. module: base_optional_quick_create
#: code:addons/base_optional_quick_create/models/ir_model.py:19
#: code:addons/base_optional_quick_create/models/ir_model.py:21
#, python-format
msgid "Can't create quickly. Opening create form"
msgid ""
"Can't create %s with name %s quickly.\n"
"Please contact your system administrator to disable this behaviour."
msgstr ""
#. module: base_optional_quick_create

16
base_optional_quick_create/i18n/hr.po

@ -1,7 +1,7 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_optional_quick_create
#
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
# Bole <bole@dajmi5.com>, 2017
@ -13,11 +13,12 @@ msgstr ""
"PO-Revision-Date: 2017-07-13 01:00+0000\n"
"Last-Translator: Bole <bole@dajmi5.com>, 2017\n"
"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n"
"Language: hr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: hr\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
#. module: base_optional_quick_create
#: model:ir.model.fields,field_description:base_optional_quick_create.field_ir_model_avoid_quick_create
@ -27,10 +28,15 @@ msgstr "Izbjegni brzo kreiranje"
#. module: base_optional_quick_create
#: code:addons/base_optional_quick_create/models/ir_model.py:21
#, python-format
msgid "Can't create quickly. Opening create form"
msgstr "Nije moguće brzo kreiranje, otvaram formu za kreiranje"
msgid ""
"Can't create %s with name %s quickly.\n"
"Please contact your system administrator to disable this behaviour."
msgstr ""
#. module: base_optional_quick_create
#: model:ir.model,name:base_optional_quick_create.model_ir_model
msgid "Models"
msgstr "Modeli"
#~ msgid "Can't create quickly. Opening create form"
#~ msgstr "Nije moguće brzo kreiranje, otvaram formu za kreiranje"

14
base_optional_quick_create/i18n/hr_HR.po

@ -1,7 +1,7 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_optional_quick_create
#
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
@ -11,12 +11,14 @@ msgstr ""
"POT-Creation-Date: 2017-05-01 10:38+0000\n"
"PO-Revision-Date: 2017-05-01 10:38+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Croatian (Croatia) (https://www.transifex.com/oca/teams/23907/hr_HR/)\n"
"Language-Team: Croatian (Croatia) (https://www.transifex.com/oca/teams/23907/"
"hr_HR/)\n"
"Language: hr_HR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: hr_HR\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
#. module: base_optional_quick_create
#: model:ir.model.fields,field_description:base_optional_quick_create.field_ir_model_avoid_quick_create
@ -26,7 +28,9 @@ msgstr ""
#. module: base_optional_quick_create
#: code:addons/base_optional_quick_create/models/ir_model.py:21
#, python-format
msgid "Can't create quickly. Opening create form"
msgid ""
"Can't create %s with name %s quickly.\n"
"Please contact your system administrator to disable this behaviour."
msgstr ""
#. module: base_optional_quick_create

29
base_optional_quick_create/i18n/it.po

@ -1,33 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_optional_quick_create
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
# * base_optional_quick_create
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 10.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-01 10:38+0000\n"
"PO-Revision-Date: 2017-05-01 10:38+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n"
"POT-Creation-Date: 2018-03-19 17:10+0000\n"
"PO-Revision-Date: 2018-03-19 17:10+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Plural-Forms: \n"
#. module: base_optional_quick_create
#: model:ir.model.fields,field_description:base_optional_quick_create.field_ir_model_avoid_quick_create
msgid "Avoid quick create"
msgstr ""
msgstr "Evita creazione veloce"
#. module: base_optional_quick_create
#: code:addons/base_optional_quick_create/models/ir_model.py:21
#, python-format
msgid "Can't create quickly. Opening create form"
msgid ""
"Can't create %s with name %s quickly.\n"
"Please contact your system administrator to disable this behaviour."
msgstr ""
"Non è possibile creare velocemente un %s con nome %s.\n"
"Si prega di contattare l'amministratore di sistema per disabilitare questo "
"comportamento."
#. module: base_optional_quick_create
#: model:ir.model,name:base_optional_quick_create.model_ir_model

11
base_optional_quick_create/i18n/nb_NO.po

@ -1,7 +1,7 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_optional_quick_create
#
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
@ -11,11 +11,12 @@ msgstr ""
"POT-Creation-Date: 2017-05-01 10:38+0000\n"
"PO-Revision-Date: 2017-05-01 10:38+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Norwegian Bokmål (Norway) (https://www.transifex.com/oca/teams/23907/nb_NO/)\n"
"Language-Team: Norwegian Bokmål (Norway) (https://www.transifex.com/oca/"
"teams/23907/nb_NO/)\n"
"Language: nb_NO\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: nb_NO\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: base_optional_quick_create
@ -26,7 +27,9 @@ msgstr ""
#. module: base_optional_quick_create
#: code:addons/base_optional_quick_create/models/ir_model.py:21
#, python-format
msgid "Can't create quickly. Opening create form"
msgid ""
"Can't create %s with name %s quickly.\n"
"Please contact your system administrator to disable this behaviour."
msgstr ""
#. module: base_optional_quick_create

16
base_optional_quick_create/i18n/pt_BR.po

@ -1,7 +1,7 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_optional_quick_create
#
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
@ -11,11 +11,12 @@ msgstr ""
"POT-Creation-Date: 2017-05-01 10:38+0000\n"
"PO-Revision-Date: 2017-05-01 10:38+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/23907/pt_BR/)\n"
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/"
"teams/23907/pt_BR/)\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: base_optional_quick_create
@ -26,10 +27,15 @@ msgstr "Evite criação rápida"
#. module: base_optional_quick_create
#: code:addons/base_optional_quick_create/models/ir_model.py:21
#, python-format
msgid "Can't create quickly. Opening create form"
msgstr "Não pode criar rapidamente; Abrindo formulário de criação"
msgid ""
"Can't create %s with name %s quickly.\n"
"Please contact your system administrator to disable this behaviour."
msgstr ""
#. module: base_optional_quick_create
#: model:ir.model,name:base_optional_quick_create.model_ir_model
msgid "Models"
msgstr "Modelos"
#~ msgid "Can't create quickly. Opening create form"
#~ msgstr "Não pode criar rapidamente; Abrindo formulário de criação"

16
base_optional_quick_create/i18n/sl.po

@ -1,7 +1,7 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_optional_quick_create
#
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
@ -12,11 +12,12 @@ msgstr ""
"PO-Revision-Date: 2017-05-01 10:38+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n"
"Language: sl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
"%100==4 ? 2 : 3);\n"
#. module: base_optional_quick_create
#: model:ir.model.fields,field_description:base_optional_quick_create.field_ir_model_avoid_quick_create
@ -26,10 +27,15 @@ msgstr "Izogibanje hitremu ustvarjanju"
#. module: base_optional_quick_create
#: code:addons/base_optional_quick_create/models/ir_model.py:21
#, python-format
msgid "Can't create quickly. Opening create form"
msgstr "Ne morete hitro ustvariti. Odpiram obrazec za ustvarjanje"
msgid ""
"Can't create %s with name %s quickly.\n"
"Please contact your system administrator to disable this behaviour."
msgstr ""
#. module: base_optional_quick_create
#: model:ir.model,name:base_optional_quick_create.model_ir_model
msgid "Models"
msgstr "Modeli"
#~ msgid "Can't create quickly. Opening create form"
#~ msgstr "Ne morete hitro ustvariti. Odpiram obrazec za ustvarjanje"

8
base_optional_quick_create/i18n/tr.po

@ -1,7 +1,7 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_optional_quick_create
#
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
@ -12,10 +12,10 @@ msgstr ""
"PO-Revision-Date: 2017-05-01 10:38+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Turkish (https://www.transifex.com/oca/teams/23907/tr/)\n"
"Language: tr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: tr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: base_optional_quick_create
@ -26,7 +26,9 @@ msgstr ""
#. module: base_optional_quick_create
#: code:addons/base_optional_quick_create/models/ir_model.py:21
#, python-format
msgid "Can't create quickly. Opening create form"
msgid ""
"Can't create %s with name %s quickly.\n"
"Please contact your system administrator to disable this behaviour."
msgstr ""
#. module: base_optional_quick_create

11
base_optional_quick_create/i18n/tr_TR.po

@ -1,7 +1,7 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_optional_quick_create
#
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
@ -11,11 +11,12 @@ msgstr ""
"POT-Creation-Date: 2017-05-01 10:38+0000\n"
"PO-Revision-Date: 2017-05-01 10:38+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Turkish (Turkey) (https://www.transifex.com/oca/teams/23907/tr_TR/)\n"
"Language-Team: Turkish (Turkey) (https://www.transifex.com/oca/teams/23907/"
"tr_TR/)\n"
"Language: tr_TR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: tr_TR\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#. module: base_optional_quick_create
@ -26,7 +27,9 @@ msgstr ""
#. module: base_optional_quick_create
#: code:addons/base_optional_quick_create/models/ir_model.py:21
#, python-format
msgid "Can't create quickly. Opening create form"
msgid ""
"Can't create %s with name %s quickly.\n"
"Please contact your system administrator to disable this behaviour."
msgstr ""
#. module: base_optional_quick_create

13
base_optional_quick_create/i18n/zh_CN.po

@ -1,7 +1,7 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_optional_quick_create
#
#
# Translators:
# Jeffery Chenn <jeffery9@gmail.com>, 2016
msgid ""
@ -11,11 +11,12 @@ msgstr ""
"POT-Creation-Date: 2016-08-31 11:58+0000\n"
"PO-Revision-Date: 2016-08-31 11:58+0000\n"
"Last-Translator: Jeffery Chenn <jeffery9@gmail.com>, 2016\n"
"Language-Team: Chinese (China) (https://www.transifex.com/oca/teams/23907/zh_CN/)\n"
"Language-Team: Chinese (China) (https://www.transifex.com/oca/teams/23907/"
"zh_CN/)\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#. module: base_optional_quick_create
@ -24,9 +25,11 @@ msgid "Avoid quick create"
msgstr "避免快速创建"
#. module: base_optional_quick_create
#: code:addons/base_optional_quick_create/models/ir_model.py:19
#: code:addons/base_optional_quick_create/models/ir_model.py:21
#, python-format
msgid "Can't create quickly. Opening create form"
msgid ""
"Can't create %s with name %s quickly.\n"
"Please contact your system administrator to disable this behaviour."
msgstr ""
#. module: base_optional_quick_create

29
base_optional_quick_create/models/ir_model.py

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# © 2013 Agile Business Group sagl (<http://www.agilebg.com>)
# © 2016 ACSONE SA/NA (<http://acsone.eu>)
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# Copyright 2016 ACSONE SA/NA (<http://acsone.eu>)
# Copyright 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# Copyright 2018 Simone Rubino - Agile Business Group
from odoo import api, fields, models, _
from odoo.exceptions import UserError
@ -15,21 +15,24 @@ class IrModel(models.Model):
@api.multi
def _patch_quick_create(self):
@api.multi
def _wrap_name_create():
def wrapper(self):
raise UserError(_("Can't create quickly. Opening create form"))
@api.model
def wrapper(self, name):
raise UserError(_(
"Can't create %s with name %s quickly.\n"
"Please contact your system administrator to disable "
"this behaviour.") % (self._name, name))
return wrapper
method_name = 'name_create'
for model in self:
model_obj = self.env.get(model.model)
if model.avoid_quick_create:
model_name = model.model
model_obj = self.env.get(model_name)
if (
not isinstance(model_obj, type(None)) and
not hasattr(model_obj, 'check_quick_create')):
model_obj._patch_method('name_create', _wrap_name_create())
model_obj.check_quick_create = True
model_obj._patch_method(method_name, _wrap_name_create())
else:
method = getattr(model_obj, method_name, None)
if method and hasattr(method, 'origin'):
model_obj._revert_method(method_name)
return True
def _register_hook(self):

4
base_optional_quick_create/tests/__init__.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

29
base_optional_quick_create/tests/test_quick_create.py

@ -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)
Loading…
Cancel
Save