diff --git a/ext/custom-addons/base_unece/README.rst b/ext/custom-addons/base_unece/README.rst new file mode 100644 index 00000000..0de6661a --- /dev/null +++ b/ext/custom-addons/base_unece/README.rst @@ -0,0 +1,52 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +========== +Base UNECE +========== + +This module adds the technical basis for the use of the code lists standardized by the `United Nations Economic Commission for Europe `_ (which has 56 members states in Europe, America and Central Asia, cf `Wikipedia `_. These code lists are sometimes called UNCL (United Nations Code List). UNECE has standardized code lists for many different things: units of measure, payment means, modes of transport, packacing, taxes, etc.... + +Configuration +============= + +The configuration takes place in the menu *Settings > Technical > Parameters > UNECE Code Lists*. + +Usage +===== + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/101/11.0 + +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 smash it by providing detailed and welcomed feedback. + +Credits +======= + +Contributors +------------ + +* Alexis de Lattre + +Maintainer +---------- + +.. 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. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/ext/custom-addons/base_unece/__init__.py b/ext/custom-addons/base_unece/__init__.py new file mode 100644 index 00000000..31660d6a --- /dev/null +++ b/ext/custom-addons/base_unece/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import models diff --git a/ext/custom-addons/base_unece/__manifest__.py b/ext/custom-addons/base_unece/__manifest__.py new file mode 100644 index 00000000..99d5442b --- /dev/null +++ b/ext/custom-addons/base_unece/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2016 Akretion (http://www.akretion.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +# @author Alexis de Lattre + +{ + 'name': 'Base UNECE', + 'version': '11.0.1.0.1', + 'category': 'Tools', + 'license': 'AGPL-3', + 'summary': 'Base module for UNECE code lists', + 'author': 'Akretion,Odoo Community Association (OCA)', + "website": "https://github.com/OCA/community-data-files", + 'depends': ['base'], + 'data': [ + 'views/unece_code_list.xml', + 'security/ir.model.access.csv', + ], + 'installable': True, +} diff --git a/ext/custom-addons/base_unece/i18n/base_unece.pot b/ext/custom-addons/base_unece/i18n/base_unece.pot new file mode 100644 index 00000000..ffcccf5c --- /dev/null +++ b/ext/custom-addons/base_unece/i18n/base_unece.pot @@ -0,0 +1,117 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_unece +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: base_unece +#: sql_constraint:unece.code.list:0 +msgid "An UNECE code of the same type already exists" +msgstr "" + +#. module: base_unece +#: model:ir.model.fields,field_description:base_unece.field_unece_code_list_code +msgid "Code" +msgstr "" + +#. module: base_unece +#: model:ir.model.fields,field_description:base_unece.field_unece_code_list_create_uid +msgid "Created by" +msgstr "" + +#. module: base_unece +#: model:ir.model.fields,field_description:base_unece.field_unece_code_list_create_date +msgid "Created on" +msgstr "" + +#. module: base_unece +#: selection:unece.code.list,type:0 +msgid "Date, Time or Period Qualifier (UNTDID 2005)" +msgstr "" + +#. module: base_unece +#: model:ir.model.fields,field_description:base_unece.field_unece_code_list_description +msgid "Description" +msgstr "" + +#. module: base_unece +#: model:ir.model.fields,field_description:base_unece.field_unece_code_list_display_name +msgid "Display Name" +msgstr "" + +#. module: base_unece +#: model:ir.ui.view,arch_db:base_unece.unece_code_list_search +msgid "Group By" +msgstr "" + +#. module: base_unece +#: model:ir.model.fields,field_description:base_unece.field_unece_code_list_id +msgid "ID" +msgstr "" + +#. module: base_unece +#: model:ir.model.fields,field_description:base_unece.field_unece_code_list___last_update +msgid "Last Modified on" +msgstr "" + +#. module: base_unece +#: model:ir.model.fields,field_description:base_unece.field_unece_code_list_write_uid +msgid "Last Updated by" +msgstr "" + +#. module: base_unece +#: model:ir.model.fields,field_description:base_unece.field_unece_code_list_write_date +msgid "Last Updated on" +msgstr "" + +#. module: base_unece +#: model:ir.model.fields,field_description:base_unece.field_unece_code_list_name +msgid "Name" +msgstr "" + +#. module: base_unece +#: model:ir.ui.view,arch_db:base_unece.unece_code_list_search +msgid "Name or Code" +msgstr "" + +#. module: base_unece +#: selection:unece.code.list,type:0 +msgid "Payment Means (UNCL 4461)" +msgstr "" + +#. module: base_unece +#: selection:unece.code.list,type:0 +msgid "Tax Categories (UNCL 5305)" +msgstr "" + +#. module: base_unece +#: selection:unece.code.list,type:0 +msgid "Tax Types (UNCL 5153)" +msgstr "" + +#. module: base_unece +#: model:ir.model.fields,field_description:base_unece.field_unece_code_list_type +#: model:ir.ui.view,arch_db:base_unece.unece_code_list_search +msgid "Type" +msgstr "" + +#. module: base_unece +#: model:ir.actions.act_window,name:base_unece.unece_code_list_action +#: model:ir.ui.menu,name:base_unece.unece_code_list_menu +msgid "UNECE Code Lists" +msgstr "" + +#. module: base_unece +#: model:ir.model,name:base_unece.model_unece_code_list +msgid "UNECE nomenclatures" +msgstr "" + diff --git a/ext/custom-addons/base_unece/models/__init__.py b/ext/custom-addons/base_unece/models/__init__.py new file mode 100644 index 00000000..11cf4acc --- /dev/null +++ b/ext/custom-addons/base_unece/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import unece_code_list diff --git a/ext/custom-addons/base_unece/models/unece_code_list.py b/ext/custom-addons/base_unece/models/unece_code_list.py new file mode 100644 index 00000000..1f0ec6eb --- /dev/null +++ b/ext/custom-addons/base_unece/models/unece_code_list.py @@ -0,0 +1,40 @@ +# Copyright 2016 Akretion (http://www.akretion.com) +# @author: Alexis de Lattre +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +# There are so many UNCL that can be usefull in Odoo +# that it would be stupid to have one object for each UNCL +# because it would duplicate the python code, views, menu entries, ACL, etc... +# So I decided to have a single object with a type field +class UneceCodeList(models.Model): + _name = 'unece.code.list' + _description = 'UNECE nomenclatures' + _order = 'type, code' + + @api.depends('code', 'name') + def _compute_display_name(self): + for entry in self: + entry.display_name = '[%s] %s' % (entry.code, entry.name) + + code = fields.Char(required=True, copy=False) + name = fields.Char(required=True, copy=False) + display_name = fields.Char( + compute='_compute_display_name', store=True) + type = fields.Selection([], required=True) + description = fields.Text() + + _sql_constraints = [( + 'type_code_uniq', + 'unique(type, code)', + 'An UNECE code of the same type already exists' + )] + + @api.multi + def name_get(self): + res = [] + for entry in self: + res.append((entry.id, '[%s] %s' % (entry.code, entry.name))) + return res diff --git a/ext/custom-addons/base_unece/security/ir.model.access.csv b/ext/custom-addons/base_unece/security/ir.model.access.csv new file mode 100644 index 00000000..bee05cbf --- /dev/null +++ b/ext/custom-addons/base_unece/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_unece_code_list_read,Read access on unece.code.list to everybody,model_unece_code_list,,1,0,0,0 +access_unece_code_list_full,Full access on unece.code.list to Settings group,model_unece_code_list,base.group_system,1,1,1,1 diff --git a/ext/custom-addons/base_unece/static/description/icon.png b/ext/custom-addons/base_unece/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/ext/custom-addons/base_unece/static/description/icon.png differ diff --git a/ext/custom-addons/base_unece/views/unece_code_list.xml b/ext/custom-addons/base_unece/views/unece_code_list.xml new file mode 100644 index 00000000..7c087918 --- /dev/null +++ b/ext/custom-addons/base_unece/views/unece_code_list.xml @@ -0,0 +1,68 @@ + + + + + + + + unece.code.list + +
+ + + + + + + + + + + + +
+
+
+ + + unece.code.list + + + + + + + + + + + + unece.code.list + + + + + + + + + + + + + + UNECE Code Lists + unece.code.list + tree,form + {'unece_code_list_main_view': True} + + + + + +