UBL Integration
							parent
							
								
									23c30f7f96
								
							
						
					
					
						commit
						48242b5dbb
					
				|  | @ -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 <http://www.unece.org>`_ (which has 56 members states in Europe, America and Central Asia, cf `Wikipedia <https://en.wikipedia.org/wiki/United_Nations_Economic_Commission_for_Europe>`_. 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 | ||||||
|  | <https://github.com/OCA/community-data-files/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 <alexis.delattre@akretion.com> | ||||||
|  | 
 | ||||||
|  | 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. | ||||||
|  | @ -0,0 +1,3 @@ | ||||||
|  | # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||||||
|  | 
 | ||||||
|  | from . import models | ||||||
|  | @ -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 <alexis.delattre@akretion.com> | ||||||
|  | 
 | ||||||
|  | { | ||||||
|  |     '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, | ||||||
|  | } | ||||||
|  | @ -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 "" | ||||||
|  | 
 | ||||||
|  | @ -0,0 +1,3 @@ | ||||||
|  | # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||||||
|  | 
 | ||||||
|  | from . import unece_code_list | ||||||
|  | @ -0,0 +1,40 @@ | ||||||
|  | # Copyright 2016 Akretion (http://www.akretion.com) | ||||||
|  | # @author: Alexis de Lattre <alexis.delattre@akretion.com> | ||||||
|  | # 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 | ||||||
|  | @ -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 | ||||||
| 
 | 
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 9.2 KiB | 
|  | @ -0,0 +1,68 @@ | ||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <!-- | ||||||
|  |   Copyright 2016 Akretion (http://www.akretion.com/) | ||||||
|  |   @author Alexis de Lattre <alexis.delattre@akretion.com> | ||||||
|  |   License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||||||
|  | --> | ||||||
|  | 
 | ||||||
|  | <odoo> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | <record id="unece_code_list_form" model="ir.ui.view"> | ||||||
|  |     <field name="model">unece.code.list</field> | ||||||
|  |     <field name="arch" type="xml"> | ||||||
|  |         <form> | ||||||
|  |             <sheet> | ||||||
|  |                 <group name="main"> | ||||||
|  |                     <group name="general"> | ||||||
|  |                         <field name="code"/> | ||||||
|  |                         <field name="name"/> | ||||||
|  |                     </group> | ||||||
|  |                     <group name="extra"> | ||||||
|  |                         <field name="type"/> | ||||||
|  |                     </group> | ||||||
|  |                     <field name="description"/> | ||||||
|  |                 </group> | ||||||
|  |             </sheet> | ||||||
|  |         </form> | ||||||
|  |     </field> | ||||||
|  | </record> | ||||||
|  | 
 | ||||||
|  | <record id="unece_code_list_tree" model="ir.ui.view"> | ||||||
|  |     <field name="model">unece.code.list</field> | ||||||
|  |     <field name="arch" type="xml"> | ||||||
|  |         <tree> | ||||||
|  |             <field name="type" invisible="not context.get('unece_code_list_main_view')"/> | ||||||
|  |             <field name="code"/> | ||||||
|  |             <field name="name"/> | ||||||
|  |             <field name="description"/> | ||||||
|  |         </tree> | ||||||
|  |     </field> | ||||||
|  | </record> | ||||||
|  | 
 | ||||||
|  | <record id="unece_code_list_search" model="ir.ui.view"> | ||||||
|  |     <field name="model">unece.code.list</field> | ||||||
|  |     <field name="arch" type="xml"> | ||||||
|  |         <search> | ||||||
|  |             <field name="name" string="Name or Code" filter_domain="['|', ('name', 'ilike', self), ('code', 'ilike', self)]"/> | ||||||
|  |             <field name="code"/> | ||||||
|  |             <field name="type"/> | ||||||
|  |             <group string="Group By" name="groupby"> | ||||||
|  |                 <filter name="type_groupby" string="Type" context="{'group_by': 'type'}"/> | ||||||
|  |             </group> | ||||||
|  |         </search> | ||||||
|  |     </field> | ||||||
|  | </record> | ||||||
|  | 
 | ||||||
|  | <record id="unece_code_list_action" model="ir.actions.act_window"> | ||||||
|  |     <field name="name">UNECE Code Lists</field> | ||||||
|  |     <field name="res_model">unece.code.list</field> | ||||||
|  |     <field name="view_mode">tree,form</field> | ||||||
|  |     <field name="context">{'unece_code_list_main_view': True}</field> | ||||||
|  | </record> | ||||||
|  | 
 | ||||||
|  | <menuitem id="unece_code_list_menu" action="unece_code_list_action" | ||||||
|  |     parent="base.menu_ir_property" sequence="150"/> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | </odoo> | ||||||
		Loading…
	
		Reference in New Issue