From 1a0f9ebec05934e0e1e616edfbd5933547cbeaca Mon Sep 17 00:00:00 2001 From: migration-bot-adhoc Date: Wed, 29 Oct 2025 17:54:33 +0000 Subject: [PATCH 1/2] [MIG] product_uoms: Migration to 19.0 --- product_uoms/__manifest__.py | 4 ++-- product_uoms/demo/product_product_demo.xml | 2 -- product_uoms/models/product_product.py | 13 ++++++++++--- product_uoms/models/product_template.py | 16 ++++++++++------ product_uoms/models/product_uoms.py | 7 ++++--- product_uoms/views/product_template_views.xml | 3 +-- 6 files changed, 27 insertions(+), 18 deletions(-) diff --git a/product_uoms/__manifest__.py b/product_uoms/__manifest__.py index ecf41a9fd..6d5004c5f 100644 --- a/product_uoms/__manifest__.py +++ b/product_uoms/__manifest__.py @@ -19,7 +19,7 @@ ############################################################################## { "name": "Product UOMS", - "version": "18.0.1.0.0", + "version": "19.0.1.0.0", "category": "base.module_category_knowledge_management", "author": "ADHOC SA", "website": "www.adhoc.com.ar", @@ -36,7 +36,7 @@ "views/product_template_views.xml", "security/ir.model.access.csv", ], - "installable": False, + "installable": True, "auto_install": False, "application": False, } diff --git a/product_uoms/demo/product_product_demo.xml b/product_uoms/demo/product_product_demo.xml index 6912215b4..2a425d88c 100644 --- a/product_uoms/demo/product_product_demo.xml +++ b/product_uoms/demo/product_product_demo.xml @@ -2,9 +2,7 @@ Product On Centimeter Saleable on Meter and Km - - 1 2 consu diff --git a/product_uoms/models/product_product.py b/product_uoms/models/product_product.py index 4633b3389..7cc06c3bf 100644 --- a/product_uoms/models/product_product.py +++ b/product_uoms/models/product_product.py @@ -15,6 +15,13 @@ def get_product_uoms(self, product_uom, use=False): We send product uom so it can be send from sale or purchase """ self.ensure_one() - return product_uom + self.env["uom.uom"].search( - [("category_id", "=", product_uom.category_id.id), ("id", "!=", product_uom.id)] - ) + # Get the root reference UoM by traversing up the parent chain + root_uom = product_uom + while root_uom.relative_uom_id: + root_uom = root_uom.relative_uom_id + + # Find all UoMs that have the same root reference + all_uoms = self.env["uom.uom"].search([]) + compatible_uoms = all_uoms.filtered(lambda u: u._has_common_reference(product_uom) and u.id != product_uom.id) + + return product_uom + compatible_uoms diff --git a/product_uoms/models/product_template.py b/product_uoms/models/product_template.py index 65fab73fe..cdef7bbcf 100644 --- a/product_uoms/models/product_template.py +++ b/product_uoms/models/product_template.py @@ -9,9 +9,6 @@ class ProductTemplate(models.Model): _inherit = "product.template" - uom_category_id = fields.Many2one( - related="uom_id.category_id", - ) uom_ids = fields.One2many( "product.uoms", "product_tmpl_id", @@ -25,6 +22,13 @@ class ProductTemplate(models.Model): @api.constrains("uom_ids", "uom_id") def _check_uoms(self): for rec in self: - uom_categories = rec.uom_ids.mapped("uom_id.category_id") - if len(uom_categories) > 1 or (uom_categories and uom_categories != rec.uom_id.category_id): - raise ValidationError(_("UOMs Category must be of the same " "UOM Category as Product Unit of Measure")) + # Use _has_common_reference() to check if UoMs are compatible + product_uom = rec.uom_id + for uom_line in rec.uom_ids: + if not product_uom._has_common_reference(uom_line.uom_id): + raise ValidationError( + _( + "UOMs must have the same reference unit as the Product Unit of Measure (%s)", + product_uom.name, + ) + ) diff --git a/product_uoms/models/product_uoms.py b/product_uoms/models/product_uoms.py index 4b6a5af6f..76b6483bf 100644 --- a/product_uoms/models/product_uoms.py +++ b/product_uoms/models/product_uoms.py @@ -20,6 +20,7 @@ class ProductUoms(models.Model): required=True, ) - _sql_constraints = [ - ("uom_uniq", "unique(product_tmpl_id, uom_id)", ("UOM must be unique per Product Template!")), - ] + _uom_uniq = models.Constraint( + "unique(product_tmpl_id, uom_id)", + "UOM must be unique per Product Template!", + ) diff --git a/product_uoms/views/product_template_views.xml b/product_uoms/views/product_template_views.xml index a43d96873..8a56624f1 100644 --- a/product_uoms/views/product_template_views.xml +++ b/product_uoms/views/product_template_views.xml @@ -7,11 +7,10 @@ - - + From 04ca55e760248fe80b877abc2a8dca1396da7021 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Carreras Date: Fri, 26 Dec 2025 12:30:20 +0000 Subject: [PATCH 2/2] [REM]product_uoms: remove module --- product_uoms/README.rst | 72 --------- product_uoms/__init__.py | 5 - product_uoms/__manifest__.py | 42 ------ product_uoms/data/product_uoms_data.xml | 9 -- product_uoms/demo/product_product_demo.xml | 10 -- product_uoms/demo/product_uoms_demo.xml | 15 -- product_uoms/i18n/br.po | 139 ------------------ product_uoms/i18n/es.po | 132 ----------------- product_uoms/i18n/fr.po | 128 ---------------- product_uoms/i18n/lt.po | 128 ---------------- product_uoms/i18n/nl.po | 128 ---------------- product_uoms/i18n/ru.po | 135 ----------------- .../migrations/11.0.1.0.0/pre-migration.py | 16 -- product_uoms/models/__init__.py | 7 - product_uoms/models/product_product.py | 27 ---- product_uoms/models/product_template.py | 34 ----- product_uoms/models/product_uoms.py | 26 ---- product_uoms/security/ir.model.access.csv | 2 - product_uoms/views/product_template_views.xml | 20 --- 19 files changed, 1075 deletions(-) delete mode 100644 product_uoms/README.rst delete mode 100644 product_uoms/__init__.py delete mode 100644 product_uoms/__manifest__.py delete mode 100644 product_uoms/data/product_uoms_data.xml delete mode 100644 product_uoms/demo/product_product_demo.xml delete mode 100644 product_uoms/demo/product_uoms_demo.xml delete mode 100644 product_uoms/i18n/br.po delete mode 100644 product_uoms/i18n/es.po delete mode 100644 product_uoms/i18n/fr.po delete mode 100644 product_uoms/i18n/lt.po delete mode 100644 product_uoms/i18n/nl.po delete mode 100644 product_uoms/i18n/ru.po delete mode 100644 product_uoms/migrations/11.0.1.0.0/pre-migration.py delete mode 100644 product_uoms/models/__init__.py delete mode 100644 product_uoms/models/product_product.py delete mode 100644 product_uoms/models/product_template.py delete mode 100644 product_uoms/models/product_uoms.py delete mode 100644 product_uoms/security/ir.model.access.csv delete mode 100644 product_uoms/views/product_template_views.xml diff --git a/product_uoms/README.rst b/product_uoms/README.rst deleted file mode 100644 index f29ca4ee1..000000000 --- a/product_uoms/README.rst +++ /dev/null @@ -1,72 +0,0 @@ -.. |company| replace:: ADHOC SA - -.. |company_logo| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-logo.png - :alt: ADHOC SA - :target: https://www.adhoc.com.ar - -.. |icon| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-icon.png - -.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png - :target: https://www.gnu.org/licenses/agpl - :alt: License: AGPL-3 - -============ -Product UOMS -============ - -* Add a o2m field on products to allow defining uoms that can be used on other models. - - -Installation -============ - -To install this module, you need to: - -#. Just install this module. - - -Configuration -============= - -To configure this module, you need to: - -#. Enter to product, add item in sale UOMs and set UOM. - -Usage -===== - -To use this module, you need to: - -#. No usage needed. - -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: http://runbot.adhoc.com.ar/ - -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 smashing it by providing a detailed and welcomed feedback. - -Credits -======= - -Images ------- - -* |company| |icon| - -Contributors ------------- - -Maintainer ----------- - -|company_logo| - -This module is maintained by the |company|. - -To contribute to this module, please visit https://www.adhoc.com.ar. diff --git a/product_uoms/__init__.py b/product_uoms/__init__.py deleted file mode 100644 index d03377692..000000000 --- a/product_uoms/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -############################################################################## -# For copyright and license notices, see __manifest__.py file in module root -# directory -############################################################################## -from . import models diff --git a/product_uoms/__manifest__.py b/product_uoms/__manifest__.py deleted file mode 100644 index 6d5004c5f..000000000 --- a/product_uoms/__manifest__.py +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################## -# -# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar) -# All Rights Reserved. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## -{ - "name": "Product UOMS", - "version": "19.0.1.0.0", - "category": "base.module_category_knowledge_management", - "author": "ADHOC SA", - "website": "www.adhoc.com.ar", - "license": "AGPL-3", - "depends": [ - "product", - ], - "demo": [ - "demo/product_product_demo.xml", - "demo/product_uoms_demo.xml", - ], - "data": [ - "data/product_uoms_data.xml", - "views/product_template_views.xml", - "security/ir.model.access.csv", - ], - "installable": True, - "auto_install": False, - "application": False, -} diff --git a/product_uoms/data/product_uoms_data.xml b/product_uoms/data/product_uoms_data.xml deleted file mode 100644 index f5581a8c6..000000000 --- a/product_uoms/data/product_uoms_data.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/product_uoms/demo/product_product_demo.xml b/product_uoms/demo/product_product_demo.xml deleted file mode 100644 index 2a425d88c..000000000 --- a/product_uoms/demo/product_product_demo.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - Product On Centimeter Saleable on Meter and Km - - 1 - 2 - consu - - diff --git a/product_uoms/demo/product_uoms_demo.xml b/product_uoms/demo/product_uoms_demo.xml deleted file mode 100644 index 3bc5815fd..000000000 --- a/product_uoms/demo/product_uoms_demo.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/product_uoms/i18n/br.po b/product_uoms/i18n/br.po deleted file mode 100644 index 5b5db6076..000000000 --- a/product_uoms/i18n/br.po +++ /dev/null @@ -1,139 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * product_uoms -# -# Translators: -# Cesar Lucho Tatad , 2020 -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-01-11 13:03+0000\n" -"PO-Revision-Date: 2020-03-18 19:48+0000\n" -"Last-Translator: Cesar Lucho Tatad , 2020\n" -"Language-Team: Breton (https://www.transifex.com/adhoc/teams/46451/br/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Language: br\n" -"Plural-Forms: nplurals=5; plural=((n%10 == 1) && (n%100 != 11) && (n%100 !=71) && (n%100 !=91) ? 0 :(n%10 == 2) && (n%100 != 12) && (n%100 !=72) && (n%100 !=92) ? 1 :(n%10 ==3 || n%10==4 || n%10==9) && (n%100 < 10 || n% 100 > 19) && (n%100 < 70 || n%100 > 79) && (n%100 < 90 || n%100 > 99) ? 2 :(n != 0 && n % 1000000 == 0) ? 3 : 4);\n" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_product__uom_category_id -#: model:ir.model.fields,field_description:product_uoms.field_product_template__uom_category_id -msgid "Category" -msgstr "Categori" - -#. module: product_uoms -#: model:ir.model.fields,help:product_uoms.field_product_product__uom_category_id -#: model:ir.model.fields,help:product_uoms.field_product_template__uom_category_id -msgid "" -"Conversion between Units of Measure can only occur if they belong to the " -"same category. The conversion will be made based on the ratios." -msgstr "" -"2\n" -"Dim ond os ydyn nhw'n perthyn i'r un categori y gall trosi rhwng Unedau Mesur ddigwydd. Gwneir y trawsnewidiad yn seiliedig ar y cymarebau." - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__create_uid -msgid "Created by" -msgstr "Crëwyd Gan" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__create_date -msgid "Created on" -msgstr "Wedi'i greu" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__display_name -msgid "Display Name" -msgstr "Enw Arddangos" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__id -msgid "ID" -msgstr "adnabod" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms____last_update -msgid "Last Modified on" -msgstr "Newidiwyd Diwethaf Ar" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__write_uid -msgid "Last Updated by" -msgstr "Diweddariad diwethaf gan" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__write_date -msgid "Last Updated on" -msgstr "Diweddariad diwethaf ar" - -#. module: product_uoms -#: model:ir.model.fields,help:product_uoms.field_product_product__uom_ids -#: model:ir.model.fields,help:product_uoms.field_product_template__uom_ids -msgid "" -"Only uoms in this list will be available. If none is specified, then all " -"uoms of product uom category will be available." -msgstr "" -"Dim ond uoms yn y rhestr hon fydd ar gael. Os na nodir yr un, yna bydd pob " -"math o gategori uom cynnyrch ar gael." - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_product -msgid "Product" -msgstr "Cynnyrch" - -#. module: product_uoms -#: model:product.product,name:product_uoms.product_on_cm_saleable_on_m_and_km -#: model:product.template,name:product_uoms.product_on_cm_saleable_on_m_and_km_product_template -msgid "Product On Centimeter Saleable on Meter and Km" -msgstr "Cynnyrch Ar Gyflog Centimetr ar Fesurydd a Km" - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_template -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__product_tmpl_id -msgid "Product Template" -msgstr "Templed Cynnyrch" - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_uoms -msgid "Product Uoms" -msgstr "Uoms Cynnyrch" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__sequence -msgid "Sequence" -msgstr "Dilyniant" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__uom_id -msgid "UOM" -msgstr "UOM" - -#. module: product_uoms -#: code:addons/product_uoms/models/product_uoms.py:0 -#: model:ir.model.constraint,message:product_uoms.constraint_product_uoms_uom_uniq -#, python-format -msgid "UOM must be unique per Product Template!" -msgstr "Rhaid i UOM fod yn unigryw fesul Templed Cynnyrch!" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_product__uom_ids -#: model:ir.model.fields,field_description:product_uoms.field_product_template__uom_ids -msgid "UOMs" -msgstr "UOMs" - -#. module: product_uoms -#: code:addons/product_uoms/models/product_template.py:0 -#, python-format -msgid "" -"UOMs Category must be of the same UOM Category as Product Unit of Measure" -msgstr "Rhaid i gategori UOM fod o'r un Categori UOM â'r Uned Fesur Cynnyrch" - -#. module: product_uoms -#: model:product.product,uom_name:product_uoms.product_on_cm_saleable_on_m_and_km -#: model:product.template,uom_name:product_uoms.product_on_cm_saleable_on_m_and_km_product_template -msgid "cm" -msgstr "cm" diff --git a/product_uoms/i18n/es.po b/product_uoms/i18n/es.po deleted file mode 100644 index fa43c91c7..000000000 --- a/product_uoms/i18n/es.po +++ /dev/null @@ -1,132 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * product_uoms -# -# Translators: -# Juan José Scarafía , 2025 -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 18.0+e\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-03 05:16+0000\n" -"PO-Revision-Date: 2024-11-14 20:27+0000\n" -"Last-Translator: Juan José Scarafía , 2025\n" -"Language-Team: Spanish (https://app.transifex.com/adhoc/teams/46451/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=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n" - -#. module: product_uoms -#: model:ir.model.fields,help:product_uoms.field_product_product__uom_category_id -#: model:ir.model.fields,help:product_uoms.field_product_template__uom_category_id -msgid "" -"Conversion between Units of Measure can only occur if they belong to the " -"same category. The conversion will be made based on the ratios." -msgstr "" -"La conversión entre las unidades de medidas sólo puede ocurrir si pertenecen" -" a la misma categoría. La conversión se basará en los índices establecidos." - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__create_uid -msgid "Created by" -msgstr "Creado por" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__create_date -msgid "Created on" -msgstr "Creado el" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__display_name -msgid "Display Name" -msgstr "Nombre mostrado" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__id -msgid "ID" -msgstr "ID (identificación)" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__write_uid -msgid "Last Updated by" -msgstr "Última actualización por" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__write_date -msgid "Last Updated on" -msgstr "Última actualización en" - -#. module: product_uoms -#: model:ir.model.fields,help:product_uoms.field_product_product__uom_ids -#: model:ir.model.fields,help:product_uoms.field_product_template__uom_ids -msgid "" -"Only uoms in this list will be available. If none is specified, then all " -"uoms of product uom category will be available." -msgstr "" -"Solo las unidades de medida en esta lista estarán disponibles. Si no se " -"especifica ninguna, entonces estarán disponibles todas las unidades de " -"medida de la categoría de unidades de medida del producto." - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_template -msgid "Product" -msgstr "Producto" - -#. module: product_uoms -#: model:product.template,name:product_uoms.product_on_cm_saleable_on_m_and_km_product_template -msgid "Product On Centimeter Saleable on Meter and Km" -msgstr "Producto en centímetros vendible en metros y kilómetros" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__product_tmpl_id -msgid "Product Template" -msgstr "Plantilla de producto" - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_uoms -msgid "Product Uoms" -msgstr "UdM del producto" - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_product -msgid "Product Variant" -msgstr "Variante de producto" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__sequence -msgid "Sequence" -msgstr "Secuencia" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__uom_id -msgid "UOM" -msgstr "UdM" - -#. module: product_uoms -#: model:ir.model.constraint,message:product_uoms.constraint_product_uoms_uom_uniq -msgid "UOM must be unique per Product Template!" -msgstr "¡La unidad de medida (UdM) debe ser única por plantilla de producto!" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_product__uom_ids -#: model:ir.model.fields,field_description:product_uoms.field_product_template__uom_ids -msgid "UOMs" -msgstr "UdMs" - -#. module: product_uoms -#. odoo-python -#: code:addons/product_uoms/models/product_template.py:0 -msgid "" -"UOMs Category must be of the same UOM Category as Product Unit of Measure" -msgstr "" -"Las categorías de UdM deben ser de la misma categoría que la unidad de " -"medida del producto." - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_product__uom_category_id -#: model:ir.model.fields,field_description:product_uoms.field_product_template__uom_category_id -msgid "UoM Category" -msgstr "Categoría de UdM" diff --git a/product_uoms/i18n/fr.po b/product_uoms/i18n/fr.po deleted file mode 100644 index d75797e18..000000000 --- a/product_uoms/i18n/fr.po +++ /dev/null @@ -1,128 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * product_uoms -# -# Translators: -# Juan José Scarafía , 2018 -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 11.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-25 13:51+0000\n" -"PO-Revision-Date: 2018-09-25 13:51+0000\n" -"Last-Translator: Juan José Scarafía , 2018\n" -"Language-Team: French (https://www.transifex.com/adhoc/teams/46451/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: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_product_uom_category_id -#: model:ir.model.fields,field_description:product_uoms.field_product_template_uom_category_id -msgid "Category" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,help:product_uoms.field_product_product_uom_category_id -#: model:ir.model.fields,help:product_uoms.field_product_template_uom_category_id -msgid "" -"Conversion between Units of Measure can only occur if they belong to the " -"same category. The conversion will be made based on the ratios." -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_create_uid -msgid "Created by" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_create_date -msgid "Created on" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_display_name -msgid "Display Name" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_id -msgid "ID" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms___last_update -msgid "Last Modified on" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_write_uid -msgid "Last Updated by" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_write_date -msgid "Last Updated on" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,help:product_uoms.field_product_product_uom_ids -#: model:ir.model.fields,help:product_uoms.field_product_template_uom_ids -msgid "" -"Only uoms in this list will be available. If none is specified, then all " -"uoms of product uom category will be available." -msgstr "" - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_product -msgid "Product" -msgstr "Article" - -#. module: product_uoms -#: model:product.product,name:product_uoms.product_on_cm_saleable_on_m_and_km -#: model:product.template,name:product_uoms.product_on_cm_saleable_on_m_and_km_product_template -msgid "Product On Centimeter Saleable on Metera and Km" -msgstr "" - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_template -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_product_tmpl_id -msgid "Product Template" -msgstr "" - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_uoms -msgid "Product Uoms" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_sequence -msgid "Sequence" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_uom_id -msgid "UOM" -msgstr "" - -#. module: product_uoms -#: code:addons/product_uoms/models/product_uoms.py:29 -#: sql_constraint:product.uoms:0 -#, python-format -msgid "UOM must be unique per Product Template!" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_product_uom_ids -#: model:ir.model.fields,field_description:product_uoms.field_product_template_uom_ids -msgid "UOMs" -msgstr "" - -#. module: product_uoms -#: code:addons/product_uoms/models/product_template.py:38 -#, python-format -msgid "" -"UOMs Category must be of the same UOM Category as Product Unit of Measure" -msgstr "" diff --git a/product_uoms/i18n/lt.po b/product_uoms/i18n/lt.po deleted file mode 100644 index 84a529097..000000000 --- a/product_uoms/i18n/lt.po +++ /dev/null @@ -1,128 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * product_uoms -# -# Translators: -# Juan José Scarafía , 2018 -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 11.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-25 13:51+0000\n" -"PO-Revision-Date: 2018-09-25 13:51+0000\n" -"Last-Translator: Juan José Scarafía , 2018\n" -"Language-Team: Lithuanian (https://www.transifex.com/adhoc/teams/46451/lt/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Language: lt\n" -"Plural-Forms: nplurals=4; plural=(n % 10 == 1 && (n % 100 > 19 || n % 100 < 11) ? 0 : (n % 10 >= 2 && n % 10 <=9) && (n % 100 > 19 || n % 100 < 11) ? 1 : n % 1 != 0 ? 2: 3);\n" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_product_uom_category_id -#: model:ir.model.fields,field_description:product_uoms.field_product_template_uom_category_id -msgid "Category" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,help:product_uoms.field_product_product_uom_category_id -#: model:ir.model.fields,help:product_uoms.field_product_template_uom_category_id -msgid "" -"Conversion between Units of Measure can only occur if they belong to the " -"same category. The conversion will be made based on the ratios." -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_create_uid -msgid "Created by" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_create_date -msgid "Created on" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_display_name -msgid "Display Name" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_id -msgid "ID" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms___last_update -msgid "Last Modified on" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_write_uid -msgid "Last Updated by" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_write_date -msgid "Last Updated on" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,help:product_uoms.field_product_product_uom_ids -#: model:ir.model.fields,help:product_uoms.field_product_template_uom_ids -msgid "" -"Only uoms in this list will be available. If none is specified, then all " -"uoms of product uom category will be available." -msgstr "" - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_product -msgid "Product" -msgstr "Produktas" - -#. module: product_uoms -#: model:product.product,name:product_uoms.product_on_cm_saleable_on_m_and_km -#: model:product.template,name:product_uoms.product_on_cm_saleable_on_m_and_km_product_template -msgid "Product On Centimeter Saleable on Metera and Km" -msgstr "" - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_template -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_product_tmpl_id -msgid "Product Template" -msgstr "" - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_uoms -msgid "Product Uoms" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_sequence -msgid "Sequence" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_uom_id -msgid "UOM" -msgstr "" - -#. module: product_uoms -#: code:addons/product_uoms/models/product_uoms.py:29 -#: sql_constraint:product.uoms:0 -#, python-format -msgid "UOM must be unique per Product Template!" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_product_uom_ids -#: model:ir.model.fields,field_description:product_uoms.field_product_template_uom_ids -msgid "UOMs" -msgstr "" - -#. module: product_uoms -#: code:addons/product_uoms/models/product_template.py:38 -#, python-format -msgid "" -"UOMs Category must be of the same UOM Category as Product Unit of Measure" -msgstr "" diff --git a/product_uoms/i18n/nl.po b/product_uoms/i18n/nl.po deleted file mode 100644 index 939d52e6c..000000000 --- a/product_uoms/i18n/nl.po +++ /dev/null @@ -1,128 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * product_uoms -# -# Translators: -# Juan José Scarafía , 2018 -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 11.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-25 13:51+0000\n" -"PO-Revision-Date: 2018-09-25 13:51+0000\n" -"Last-Translator: Juan José Scarafía , 2018\n" -"Language-Team: Dutch (https://www.transifex.com/adhoc/teams/46451/nl/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Language: nl\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_product_uom_category_id -#: model:ir.model.fields,field_description:product_uoms.field_product_template_uom_category_id -msgid "Category" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,help:product_uoms.field_product_product_uom_category_id -#: model:ir.model.fields,help:product_uoms.field_product_template_uom_category_id -msgid "" -"Conversion between Units of Measure can only occur if they belong to the " -"same category. The conversion will be made based on the ratios." -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_create_uid -msgid "Created by" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_create_date -msgid "Created on" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_display_name -msgid "Display Name" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_id -msgid "ID" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms___last_update -msgid "Last Modified on" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_write_uid -msgid "Last Updated by" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_write_date -msgid "Last Updated on" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,help:product_uoms.field_product_product_uom_ids -#: model:ir.model.fields,help:product_uoms.field_product_template_uom_ids -msgid "" -"Only uoms in this list will be available. If none is specified, then all " -"uoms of product uom category will be available." -msgstr "" - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_product -msgid "Product" -msgstr "Product" - -#. module: product_uoms -#: model:product.product,name:product_uoms.product_on_cm_saleable_on_m_and_km -#: model:product.template,name:product_uoms.product_on_cm_saleable_on_m_and_km_product_template -msgid "Product On Centimeter Saleable on Metera and Km" -msgstr "" - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_template -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_product_tmpl_id -msgid "Product Template" -msgstr "" - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_uoms -msgid "Product Uoms" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_sequence -msgid "Sequence" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms_uom_id -msgid "UOM" -msgstr "" - -#. module: product_uoms -#: code:addons/product_uoms/models/product_uoms.py:29 -#: sql_constraint:product.uoms:0 -#, python-format -msgid "UOM must be unique per Product Template!" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_product_uom_ids -#: model:ir.model.fields,field_description:product_uoms.field_product_template_uom_ids -msgid "UOMs" -msgstr "" - -#. module: product_uoms -#: code:addons/product_uoms/models/product_template.py:38 -#, python-format -msgid "" -"UOMs Category must be of the same UOM Category as Product Unit of Measure" -msgstr "" diff --git a/product_uoms/i18n/ru.po b/product_uoms/i18n/ru.po deleted file mode 100644 index b1fb82c97..000000000 --- a/product_uoms/i18n/ru.po +++ /dev/null @@ -1,135 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * product_uoms -# -# Translators: -# Irina Fedulova , 2020 -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-01-11 13:03+0000\n" -"PO-Revision-Date: 2020-03-18 19:48+0000\n" -"Last-Translator: Irina Fedulova , 2020\n" -"Language-Team: Russian (https://www.transifex.com/adhoc/teams/46451/ru/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Language: ru\n" -"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_product__uom_category_id -#: model:ir.model.fields,field_description:product_uoms.field_product_template__uom_category_id -msgid "Category" -msgstr "Категория" - -#. module: product_uoms -#: model:ir.model.fields,help:product_uoms.field_product_product__uom_category_id -#: model:ir.model.fields,help:product_uoms.field_product_template__uom_category_id -msgid "" -"Conversion between Units of Measure can only occur if they belong to the " -"same category. The conversion will be made based on the ratios." -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__create_uid -msgid "Created by" -msgstr "Создано" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__create_date -msgid "Created on" -msgstr "Создано" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__display_name -msgid "Display Name" -msgstr "Отображаемое имя" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__id -msgid "ID" -msgstr "ID" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms____last_update -msgid "Last Modified on" -msgstr "Изменено" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__write_uid -msgid "Last Updated by" -msgstr "Обновлено" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__write_date -msgid "Last Updated on" -msgstr "Обновлено" - -#. module: product_uoms -#: model:ir.model.fields,help:product_uoms.field_product_product__uom_ids -#: model:ir.model.fields,help:product_uoms.field_product_template__uom_ids -msgid "" -"Only uoms in this list will be available. If none is specified, then all " -"uoms of product uom category will be available." -msgstr "" - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_product -msgid "Product" -msgstr "Товар" - -#. module: product_uoms -#: model:product.product,name:product_uoms.product_on_cm_saleable_on_m_and_km -#: model:product.template,name:product_uoms.product_on_cm_saleable_on_m_and_km_product_template -msgid "Product On Centimeter Saleable on Meter and Km" -msgstr "" - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_template -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__product_tmpl_id -msgid "Product Template" -msgstr "Шаблон товара" - -#. module: product_uoms -#: model:ir.model,name:product_uoms.model_product_uoms -msgid "Product Uoms" -msgstr "Uom-ы товаров" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__sequence -msgid "Sequence" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_uoms__uom_id -msgid "UOM" -msgstr "UOM" - -#. module: product_uoms -#: code:addons/product_uoms/models/product_uoms.py:0 -#: model:ir.model.constraint,message:product_uoms.constraint_product_uoms_uom_uniq -#, python-format -msgid "UOM must be unique per Product Template!" -msgstr "" - -#. module: product_uoms -#: model:ir.model.fields,field_description:product_uoms.field_product_product__uom_ids -#: model:ir.model.fields,field_description:product_uoms.field_product_template__uom_ids -msgid "UOMs" -msgstr "UOM-ы" - -#. module: product_uoms -#: code:addons/product_uoms/models/product_template.py:0 -#, python-format -msgid "" -"UOMs Category must be of the same UOM Category as Product Unit of Measure" -msgstr "" - -#. module: product_uoms -#: model:product.product,uom_name:product_uoms.product_on_cm_saleable_on_m_and_km -#: model:product.template,uom_name:product_uoms.product_on_cm_saleable_on_m_and_km_product_template -msgid "cm" -msgstr "см" diff --git a/product_uoms/migrations/11.0.1.0.0/pre-migration.py b/product_uoms/migrations/11.0.1.0.0/pre-migration.py deleted file mode 100644 index 5f6d6e3ec..000000000 --- a/product_uoms/migrations/11.0.1.0.0/pre-migration.py +++ /dev/null @@ -1,16 +0,0 @@ -from openupgradelib import openupgrade - -table_renames = [ - ("product_sale_uom", "product_uoms"), -] - -model_renames = [ - ("product.sale.uom", "product.uoms"), -] - - -@openupgrade.migrate(use_env=True) -def migrate(env, version): - cr = env.cr - openupgrade.rename_tables(cr, table_renames) - openupgrade.rename_models(cr, model_renames) diff --git a/product_uoms/models/__init__.py b/product_uoms/models/__init__.py deleted file mode 100644 index 78475d5da..000000000 --- a/product_uoms/models/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -############################################################################## -# For copyright and license notices, see __manifest__.py file in module root -# directory -############################################################################## -from . import product_uoms -from . import product_product -from . import product_template diff --git a/product_uoms/models/product_product.py b/product_uoms/models/product_product.py deleted file mode 100644 index 7cc06c3bf..000000000 --- a/product_uoms/models/product_product.py +++ /dev/null @@ -1,27 +0,0 @@ -############################################################################## -# For copyright and license notices, see __manifest__.py file in module root -# directory -############################################################################## -from odoo import models - - -class ProductProduct(models.Model): - _inherit = "product.product" - - def get_product_uoms(self, product_uom, use=False): - """ - if product has uoms configured, we use them - if not, we choose all uoms from uom_id category (first the product uom) - We send product uom so it can be send from sale or purchase - """ - self.ensure_one() - # Get the root reference UoM by traversing up the parent chain - root_uom = product_uom - while root_uom.relative_uom_id: - root_uom = root_uom.relative_uom_id - - # Find all UoMs that have the same root reference - all_uoms = self.env["uom.uom"].search([]) - compatible_uoms = all_uoms.filtered(lambda u: u._has_common_reference(product_uom) and u.id != product_uom.id) - - return product_uom + compatible_uoms diff --git a/product_uoms/models/product_template.py b/product_uoms/models/product_template.py deleted file mode 100644 index cdef7bbcf..000000000 --- a/product_uoms/models/product_template.py +++ /dev/null @@ -1,34 +0,0 @@ -############################################################################## -# For copyright and license notices, see __manifest__.py file in module root -# directory -############################################################################## -from odoo import _, api, fields, models -from odoo.exceptions import ValidationError - - -class ProductTemplate(models.Model): - _inherit = "product.template" - - uom_ids = fields.One2many( - "product.uoms", - "product_tmpl_id", - copy=True, - string="UOMs", - help="Only uoms in this list will be available. " - "If none is specified, then all uoms of product uom category will be " - "available.", - ) - - @api.constrains("uom_ids", "uom_id") - def _check_uoms(self): - for rec in self: - # Use _has_common_reference() to check if UoMs are compatible - product_uom = rec.uom_id - for uom_line in rec.uom_ids: - if not product_uom._has_common_reference(uom_line.uom_id): - raise ValidationError( - _( - "UOMs must have the same reference unit as the Product Unit of Measure (%s)", - product_uom.name, - ) - ) diff --git a/product_uoms/models/product_uoms.py b/product_uoms/models/product_uoms.py deleted file mode 100644 index 76b6483bf..000000000 --- a/product_uoms/models/product_uoms.py +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################## -# For copyright and license notices, see __manifest__.py file in module root -# directory -############################################################################## -from odoo import fields, models - - -class ProductUoms(models.Model): - _name = "product.uoms" - _description = "Product Uoms" - _order = "sequence" - - sequence = fields.Integer( - default=10, - ) - product_tmpl_id = fields.Many2one("product.template", string="Product Template") - uom_id = fields.Many2one( - "uom.uom", - string="UOM", - required=True, - ) - - _uom_uniq = models.Constraint( - "unique(product_tmpl_id, uom_id)", - "UOM must be unique per Product Template!", - ) diff --git a/product_uoms/security/ir.model.access.csv b/product_uoms/security/ir.model.access.csv deleted file mode 100644 index f70e0cd28..000000000 --- a/product_uoms/security/ir.model.access.csv +++ /dev/null @@ -1,2 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_product_uoms_all,product_uoms_public,model_product_uoms,base.group_user,1,0,0,0 diff --git a/product_uoms/views/product_template_views.xml b/product_uoms/views/product_template_views.xml deleted file mode 100644 index 8a56624f1..000000000 --- a/product_uoms/views/product_template_views.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - product.template.uom.form - product.template - - - - - - - - - - - - - -