Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions base_locale_uom_default/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
====================
Locale - Default UoM
====================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
:target: https://github.com/OCA/server-tools/tree/12.0/base_locale_uom_default
:alt: OCA/server-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-base_locale_uom_default
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/149/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds a concept of a default unit of measure on languages, unique by
unit category type.

It also provides a method that can be used in fields to work from said defaults.

**Table of contents**

.. contents::
:local:

Configuration
=============

Set default unit of measures in the `Languages` menu in settings.

Usage
=====

Fields that want to implement the language default should use the provided method,such as in the below example::

class MyModel(models.Model):
_name = 'my.model'
time_uom_id = fields.Many2one(
string='Time Units',
comodel_name='product.uom',
default=lambda s: s.env['res.lang'].default_uom_by_category('Time'),
)

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_locale_uom_default%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* LasLabs

Contributors
~~~~~~~~~~~~

* Dave Lasley <dave@laslabs.com>
* Rubén Bravo <rubenred18@gmail.com>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/12.0/base_locale_uom_default>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions base_locale_uom_default/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import models
26 changes: 26 additions & 0 deletions base_locale_uom_default/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2017 LasLabs Inc.
# Copyright 2019 Rubén Bravo <rubenred18@gmail.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
'name': 'Locale - Default UoM',
'summary': 'This provides settings to select default UoMs at the '
'language level.',
'version': '12.0.1.0.0',
'category': 'Extra Tools',
'website': 'https://github.com/OCA/server-tools/',
'author': 'LasLabs, '
'Odoo Community Association (OCA)',
'license': 'LGPL-3',
'application': False,
'installable': True,
'depends': [
'product',
],
'data': [
'views/res_lang_view.xml',
],
'demo': [
'demo/res_lang_demo.xml',
],
}
14 changes: 14 additions & 0 deletions base_locale_uom_default/demo/res_lang_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="base.lang_en" model="res.lang">
<field name="default_uom_ids" eval="[(6, 0, [
ref('uom.product_uom_unit'),
ref('uom.product_uom_hour'),
ref('uom.product_uom_lb'),
ref('uom.product_uom_inch'),
ref('uom.product_uom_floz'),
])]" />
</record>

</odoo>
36 changes: 36 additions & 0 deletions base_locale_uom_default/i18n/ar.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_locale_uom_default
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-01 02:10+0000\n"
"PO-Revision-Date: 2017-12-01 02:10+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Arabic (https://www.transifex.com/oca/teams/23907/ar/)\n"
"Language: ar\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"

#. module: base_locale_uom_default
#: model:ir.model.fields,field_description:base_locale_uom_default.field_res_lang_default_uom_ids
msgid "Default Units"
msgstr ""

#. module: base_locale_uom_default
#: model:ir.model,name:base_locale_uom_default.model_res_lang
msgid "Languages"
msgstr "اللغات"

#. module: base_locale_uom_default
#: code:addons/base_locale_uom_default/models/res_lang.py:24
#, python-format
msgid "Only one default unit of measure per category may be selected."
msgstr ""
31 changes: 31 additions & 0 deletions base_locale_uom_default/i18n/base_locale_uom_default.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_locale_uom_default
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.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_locale_uom_default
#: model:ir.model.fields,field_description:base_locale_uom_default.field_res_lang_default_uom_ids
msgid "Default Units"
msgstr ""

#. module: base_locale_uom_default
#: model:ir.model,name:base_locale_uom_default.model_res_lang
msgid "Languages"
msgstr ""

#. module: base_locale_uom_default
#: code:addons/base_locale_uom_default/models/res_lang.py:24
#, python-format
msgid "Only one default unit of measure per category may be selected."
msgstr ""

35 changes: 35 additions & 0 deletions base_locale_uom_default/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_locale_uom_default
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-01 02:10+0000\n"
"PO-Revision-Date: 2017-12-01 02:10+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: base_locale_uom_default
#: model:ir.model.fields,field_description:base_locale_uom_default.field_res_lang_default_uom_ids
msgid "Default Units"
msgstr ""

#. module: base_locale_uom_default
#: model:ir.model,name:base_locale_uom_default.model_res_lang
msgid "Languages"
msgstr "Idiomes "

#. module: base_locale_uom_default
#: code:addons/base_locale_uom_default/models/res_lang.py:24
#, python-format
msgid "Only one default unit of measure per category may be selected."
msgstr ""
35 changes: 35 additions & 0 deletions base_locale_uom_default/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_locale_uom_default
#
# Translators:
# Niki Waibel <niki.waibel@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-01 02:10+0000\n"
"PO-Revision-Date: 2017-12-01 02:10+0000\n"
"Last-Translator: Niki Waibel <niki.waibel@gmail.com>, 2017\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"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: base_locale_uom_default
#: model:ir.model.fields,field_description:base_locale_uom_default.field_res_lang_default_uom_ids
msgid "Default Units"
msgstr ""

#. module: base_locale_uom_default
#: model:ir.model,name:base_locale_uom_default.model_res_lang
msgid "Languages"
msgstr "Sprachen"

#. module: base_locale_uom_default
#: code:addons/base_locale_uom_default/models/res_lang.py:24
#, python-format
msgid "Only one default unit of measure per category may be selected."
msgstr ""
36 changes: 36 additions & 0 deletions base_locale_uom_default/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_locale_uom_default
#
# Translators:
# Pedro M. Baeza <pedro.baeza@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-01 02:10+0000\n"
"PO-Revision-Date: 2019-04-07 20:45-0400\n"
"Last-Translator: Pedro M. Baeza <pedro.baeza@gmail.com>, 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: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.8.11\n"

#. module: base_locale_uom_default
#: model:ir.model.fields,field_description:base_locale_uom_default.field_res_lang_default_uom_ids
msgid "Default Units"
msgstr "Unidades por defecto"

#. module: base_locale_uom_default
#: model:ir.model,name:base_locale_uom_default.model_res_lang
msgid "Languages"
msgstr "Idiomas"

#. module: base_locale_uom_default
#: code:addons/base_locale_uom_default/models/res_lang.py:24
#, python-format
msgid "Only one default unit of measure per category may be selected."
msgstr "Sólo se puede seleccionar una unidad de medida por defecto por categoría."
38 changes: 38 additions & 0 deletions base_locale_uom_default/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_locale_uom_default
#
# Translators:
# Quentin THEURET <odoo@kerpeo.com>, 2017
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-01 02:10+0000\n"
"PO-Revision-Date: 2017-12-01 02:10+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\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"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

#. module: base_locale_uom_default
#: model:ir.model.fields,field_description:base_locale_uom_default.field_res_lang_default_uom_ids
msgid "Default Units"
msgstr "Unités par défaut"

#. module: base_locale_uom_default
#: model:ir.model,name:base_locale_uom_default.model_res_lang
msgid "Languages"
msgstr "Langues"

#. module: base_locale_uom_default
#: code:addons/base_locale_uom_default/models/res_lang.py:24
#, python-format
msgid "Only one default unit of measure per category may be selected."
msgstr ""
"Seulement une unité de mesure par défaut peut être sélectionnée par "
"catégorie."
37 changes: 37 additions & 0 deletions base_locale_uom_default/i18n/hr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_locale_uom_default
#
# Translators:
# Goran Kliska <gkliska@gmail.com>, 2017
# Bole <bole@dajmi5.com>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-02 18:40+0000\n"
"PO-Revision-Date: 2018-03-02 18:40+0000\n"
"Last-Translator: Bole <bole@dajmi5.com>, 2018\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"
"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_locale_uom_default
#: model:ir.model.fields,field_description:base_locale_uom_default.field_res_lang_default_uom_ids
msgid "Default Units"
msgstr "Zadane jedinice"

#. module: base_locale_uom_default
#: model:ir.model,name:base_locale_uom_default.model_res_lang
msgid "Languages"
msgstr "Jezici"

#. module: base_locale_uom_default
#: code:addons/base_locale_uom_default/models/res_lang.py:24
#, python-format
msgid "Only one default unit of measure per category may be selected."
msgstr "Samo jedna zadana jedinica mjere može biti odabrana za kategoriju."
Loading