Initial commit: Odoo 18.0-20251222 extra-addons
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled

This commit is contained in:
tocmo0nlord
2026-03-13 20:43:25 +00:00
parent 36e847a7df
commit adbe430761
9472 changed files with 1265727 additions and 0 deletions

View File

@@ -0,0 +1,110 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association
=========================
Sale Order Secondary Unit
=========================
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b6cd5a500712cd2681b14605e629fd1e3f3b710411c41958b917d87d6ed24898
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/18.0/sale_order_secondary_unit
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_order_secondary_unit
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=18.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
This module extends the functionality of sale orders to allow sale
products in secondary unit of distinct category.
**Table of contents**
.. contents::
:local:
Configuration
=============
To configure this module, you need to:
1. Go to *Sales > Configuration > Products > Secondary Units of Measure*
to manage all the 'Secondary Units of Measure' in the system.
Usage
=====
To use this module you need to:
1. Go to a *Product > General Information tab*.
2. Create any record in "Secondary unit of measure".
3. Set the conversion factor.
4. Go to *Sales > Quotation > Create*.
5. Change quantities in line and secondary unit (produc_qty will be
change).
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_order_secondary_unit%0Aversion:%2018.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
-------
* Tecnativa
Contributors
------------
- Tony Gu <tony@openerp.cn>
- Alexei Rivera <arivera@archeti.com>
- Kevin Roche <kevin.roche@akretion.com>
- `Tecnativa <https://www.tecnativa.com>`__:
- Carlos Dauden
- Sergio Teruel
- Ernesto Tejeda
- Pedro M. Baeza
- Pilar Vargas
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/sale-workflow <https://github.com/OCA/sale-workflow/tree/18.0/sale_order_secondary_unit>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -0,0 +1,2 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import models

View File

@@ -0,0 +1,22 @@
# Copyright 2018-2020 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Sale Order Secondary Unit",
"summary": "Sale product in a secondary unit",
"version": "18.0.1.0.0",
"development_status": "Production/Stable",
"category": "Sale",
"website": "https://github.com/OCA/sale-workflow",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"auto_install": True,
"depends": ["sale", "product_secondary_unit"],
"data": [
"views/product_secondary_unit_views.xml",
"views/product_views.xml",
"views/sale_order_views.xml",
"report/sale_report_templates.xml",
],
}

View File

@@ -0,0 +1,118 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_secondary_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-15 13:25+0000\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\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: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.view_order_form
msgid "-&gt;"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_unit_price
msgid "2nd unit price"
msgstr ""
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.report_saleorder_document
msgid "<span>Second. Qty</span>"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_product_product__sale_secondary_uom_id
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_product_template__sale_secondary_uom_id
msgid "Default secondary unit for sales"
msgstr ""
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Group By"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,help:sale_order_secondary_unit.field_product_product__sale_secondary_uom_id
#: model:ir.model.fields,help:sale_order_secondary_unit.field_product_template__sale_secondary_uom_id
msgid ""
"In order to set a value, please first add at least one record in 'Secondary "
"Unit of Measure'"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_product_template
msgid "Product"
msgstr ""
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Product Template"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_product_product
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Product Variant"
msgstr ""
#. module: sale_order_secondary_unit
#. odoo-python
#: code:addons/sale_order_secondary_unit/models/product_template.py:0
#, python-format
msgid ""
"Product variants have distinct sale secondary uom:\n"
"{secondary_uom}\n"
"All variants will be written with new secondary uom"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__product_uom_qty
msgid "Quantity"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_sale_order_line
msgid "Sales Order Line"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_id
msgid "Second unit"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_qty
msgid "Secondary Qty"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.actions.act_window,name:sale_order_secondary_unit.product_secondary_unit_action
msgid "Secondary Unit"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.ui.menu,name:sale_order_secondary_unit.product_secondary_unit_menu
msgid "Secondary Units of Measure"
msgstr ""
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "UoM"
msgstr ""
#. module: sale_order_secondary_unit
#. odoo-python
#: code:addons/sale_order_secondary_unit/models/product_template.py:0
#, python-format
msgid "Warning"
msgstr ""

View File

@@ -0,0 +1,141 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_secondary_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-22 15:23+0000\n"
"PO-Revision-Date: 2023-07-24 18:09+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: \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: Weblate 4.17\n"
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.view_order_form
msgid "-&gt;"
msgstr "-&gt;"
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_unit_price
msgid "2nd unit price"
msgstr "Precio de la 2ª unidad"
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.report_saleorder_document
msgid "<span>Second. Qty</span>"
msgstr "<span>Cantidad secundaria</span>"
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_product_product__sale_secondary_uom_id
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_product_template__sale_secondary_uom_id
msgid "Default secondary unit for sales"
msgstr "Ud de venta secundaria por defecto"
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Group By"
msgstr "Agrupado por"
#. module: sale_order_secondary_unit
#: model:ir.model.fields,help:sale_order_secondary_unit.field_product_product__sale_secondary_uom_id
#: model:ir.model.fields,help:sale_order_secondary_unit.field_product_template__sale_secondary_uom_id
msgid ""
"In order to set a value, please first add at least one record in 'Secondary "
"Unit of Measure'"
msgstr ""
"Para establecer un valor, primero agregue al menos un registro en 'Segunda "
"unidad de medida'"
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_product_template
msgid "Product"
msgstr "Producto"
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Product Template"
msgstr "Plantilla de producto"
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_product_product
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Product Variant"
msgstr "Variante de Producto"
#. module: sale_order_secondary_unit
#. odoo-python
#: code:addons/sale_order_secondary_unit/models/product_template.py:0
#, python-format
msgid ""
"Product variants have distinct sale secondary uom:\n"
"{secondary_uom}\n"
"All variants will be written with new secondary uom"
msgstr ""
"Las variantes de producto tienen unidades de medida secundarias de venta "
"distinto:\n"
"{secondary_uom}\n"
"Todas las variantes se escribirán con la nueva unidad de medida secundaria"
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__product_uom_qty
msgid "Quantity"
msgstr "Cantidad"
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_sale_order_line
msgid "Sales Order Line"
msgstr "Línea de pedido"
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_id
msgid "Second unit"
msgstr "Unidad secundaria"
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_qty
msgid "Secondary Qty"
msgstr "Cta. Ud. secundaria"
#. module: sale_order_secondary_unit
#: model:ir.actions.act_window,name:sale_order_secondary_unit.product_secondary_unit_action
msgid "Secondary Unit"
msgstr "Unidad Secundaria"
#. module: sale_order_secondary_unit
#: model:ir.ui.menu,name:sale_order_secondary_unit.product_secondary_unit_menu
msgid "Secondary Units of Measure"
msgstr "Unidades de medida secundarias"
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "UoM"
msgstr "UDM (Unidad De Medida)"
#. module: sale_order_secondary_unit
#. odoo-python
#: code:addons/sale_order_secondary_unit/models/product_template.py:0
#, python-format
msgid "Warning"
msgstr "Aviso"
#~ msgid "Display Name"
#~ msgstr "Mostrar nombre"
#~ msgid "ID"
#~ msgstr "ID (Identificador)"
#~ msgid "Last Modified on"
#~ msgstr "Última modificación en"
#~ msgid "Second. Qty"
#~ msgstr "Ud. Secundaria"
#~ msgid "Secondary uom"
#~ msgstr "Unidad Secundaria"

View File

@@ -0,0 +1,120 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_secondary_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-08-11 12:10+0000\n"
"Last-Translator: Oskars Zālītis <oskars.zalitis@avoin.systems>\n"
"Language-Team: none\n"
"Language: fi\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"
"X-Generator: Weblate 4.17\n"
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.view_order_form
msgid "-&gt;"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_unit_price
msgid "2nd unit price"
msgstr "2. Yksikköhinta"
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.report_saleorder_document
msgid "<span>Second. Qty</span>"
msgstr "<span>2. Määrä</span>"
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_product_product__sale_secondary_uom_id
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_product_template__sale_secondary_uom_id
msgid "Default secondary unit for sales"
msgstr "2. myynnin oletusyksikkö"
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Group By"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,help:sale_order_secondary_unit.field_product_product__sale_secondary_uom_id
#: model:ir.model.fields,help:sale_order_secondary_unit.field_product_template__sale_secondary_uom_id
msgid ""
"In order to set a value, please first add at least one record in 'Secondary "
"Unit of Measure'"
msgstr ""
"Asettaaksesi arvon, lisää vähintään yksi tietue \"Toissijaiseksi yksiköksi\""
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_product_template
msgid "Product"
msgstr ""
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Product Template"
msgstr "Tuotemalli"
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_product_product
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Product Variant"
msgstr ""
#. module: sale_order_secondary_unit
#. odoo-python
#: code:addons/sale_order_secondary_unit/models/product_template.py:0
#, python-format
msgid ""
"Product variants have distinct sale secondary uom:\n"
"{secondary_uom}\n"
"All variants will be written with new secondary uom"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__product_uom_qty
msgid "Quantity"
msgstr "Määrä"
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_sale_order_line
msgid "Sales Order Line"
msgstr "Myyntitilausrivi"
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_id
msgid "Second unit"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_qty
msgid "Secondary Qty"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.actions.act_window,name:sale_order_secondary_unit.product_secondary_unit_action
msgid "Secondary Unit"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.ui.menu,name:sale_order_secondary_unit.product_secondary_unit_menu
msgid "Secondary Units of Measure"
msgstr ""
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "UoM"
msgstr ""
#. module: sale_order_secondary_unit
#. odoo-python
#: code:addons/sale_order_secondary_unit/models/product_template.py:0
#, python-format
msgid "Warning"
msgstr ""

View File

@@ -0,0 +1,124 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_secondary_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-01-04 15:06+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\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"
"X-Generator: Weblate 5.6.2\n"
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.view_order_form
msgid "-&gt;"
msgstr "-&gt;"
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_unit_price
msgid "2nd unit price"
msgstr "2° prezzo unitario"
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.report_saleorder_document
msgid "<span>Second. Qty</span>"
msgstr "<span> Q.tà secondaria</span>"
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_product_product__sale_secondary_uom_id
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_product_template__sale_secondary_uom_id
msgid "Default secondary unit for sales"
msgstr "Unità di misura secondaria predefinita per la vendita"
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Group By"
msgstr "Raggruppa per"
#. module: sale_order_secondary_unit
#: model:ir.model.fields,help:sale_order_secondary_unit.field_product_product__sale_secondary_uom_id
#: model:ir.model.fields,help:sale_order_secondary_unit.field_product_template__sale_secondary_uom_id
msgid ""
"In order to set a value, please first add at least one record in 'Secondary "
"Unit of Measure'"
msgstr ""
"Per impostare un valore, aggiungere almeno un record in 'Unità di misura "
"secondaria'"
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_product_template
msgid "Product"
msgstr "Prodotto"
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Product Template"
msgstr "Modello prodotto"
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_product_product
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Product Variant"
msgstr "Variante prodotto"
#. module: sale_order_secondary_unit
#. odoo-python
#: code:addons/sale_order_secondary_unit/models/product_template.py:0
#, python-format
msgid ""
"Product variants have distinct sale secondary uom:\n"
"{secondary_uom}\n"
"All variants will be written with new secondary uom"
msgstr ""
"Le varianti prodotto hanno udm secondarie distinte per le vendite:\n"
"{secondary_uom}\n"
"Tutte le varianti verranno scritte con la nuova udm secondaria"
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__product_uom_qty
msgid "Quantity"
msgstr "Quantità"
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_sale_order_line
msgid "Sales Order Line"
msgstr "Riga ordine di vendita"
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_id
msgid "Second unit"
msgstr "Unità secondaria"
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_qty
msgid "Secondary Qty"
msgstr "Q.tà secondaria"
#. module: sale_order_secondary_unit
#: model:ir.actions.act_window,name:sale_order_secondary_unit.product_secondary_unit_action
msgid "Secondary Unit"
msgstr "Unità secondaria"
#. module: sale_order_secondary_unit
#: model:ir.ui.menu,name:sale_order_secondary_unit.product_secondary_unit_menu
msgid "Secondary Units of Measure"
msgstr "Unità di misura secondaria"
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "UoM"
msgstr "UdM"
#. module: sale_order_secondary_unit
#. odoo-python
#: code:addons/sale_order_secondary_unit/models/product_template.py:0
#, python-format
msgid "Warning"
msgstr "Attenzione"

View File

@@ -0,0 +1,109 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_secondary_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.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: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_unit_price
msgid "2nd unit price"
msgstr ""
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.report_saleorder_document
msgid "<span>Second. Qty</span>"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_product_product__sale_secondary_uom_id
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_product_template__sale_secondary_uom_id
msgid "Default secondary unit for sales"
msgstr ""
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Group By"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,help:sale_order_secondary_unit.field_product_product__sale_secondary_uom_id
#: model:ir.model.fields,help:sale_order_secondary_unit.field_product_template__sale_secondary_uom_id
msgid ""
"In order to set a value, please first add at least one record in 'Secondary "
"Unit of Measure'"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_product_template
msgid "Product"
msgstr ""
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Product Template"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_product_product
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Product Variant"
msgstr ""
#. module: sale_order_secondary_unit
#. odoo-python
#: code:addons/sale_order_secondary_unit/models/product_template.py:0
msgid ""
"Product variants have distinct sale secondary uom:\n"
"{secondary_uom}\n"
"All variants will be written with new secondary uom"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__product_uom_qty
msgid "Quantity"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_sale_order_line
msgid "Sales Order Line"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_id
msgid "Second unit"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_qty
msgid "Secondary Qty"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.actions.act_window,name:sale_order_secondary_unit.product_secondary_unit_action
msgid "Secondary Unit"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.ui.menu,name:sale_order_secondary_unit.product_secondary_unit_menu
msgid "Secondary Units of Measure"
msgstr ""
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "UoM"
msgstr ""
#. module: sale_order_secondary_unit
#. odoo-python
#: code:addons/sale_order_secondary_unit/models/product_template.py:0
msgid "Warning"
msgstr ""

View File

@@ -0,0 +1,124 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_secondary_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-15 13:25+0000\n"
"Last-Translator: Tony Gu <tony@openerp.cn>\n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.view_order_form
msgid "-&gt;"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_unit_price
msgid "2nd unit price"
msgstr ""
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.report_saleorder_document
msgid "<span>Second. Qty</span>"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_product_product__sale_secondary_uom_id
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_product_template__sale_secondary_uom_id
msgid "Default secondary unit for sales"
msgstr "默认销售辅助计量单位"
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Group By"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,help:sale_order_secondary_unit.field_product_product__sale_secondary_uom_id
#: model:ir.model.fields,help:sale_order_secondary_unit.field_product_template__sale_secondary_uom_id
msgid ""
"In order to set a value, please first add at least one record in 'Secondary "
"Unit of Measure'"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_product_template
msgid "Product"
msgstr ""
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Product Template"
msgstr "产品模版"
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_product_product
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "Product Variant"
msgstr ""
#. module: sale_order_secondary_unit
#. odoo-python
#: code:addons/sale_order_secondary_unit/models/product_template.py:0
#, python-format
msgid ""
"Product variants have distinct sale secondary uom:\n"
"{secondary_uom}\n"
"All variants will be written with new secondary uom"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__product_uom_qty
msgid "Quantity"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model,name:sale_order_secondary_unit.model_sale_order_line
msgid "Sales Order Line"
msgstr "销售订单明细"
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_id
msgid "Second unit"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_qty
msgid "Secondary Qty"
msgstr "辅助单位数量"
#. module: sale_order_secondary_unit
#: model:ir.actions.act_window,name:sale_order_secondary_unit.product_secondary_unit_action
msgid "Secondary Unit"
msgstr ""
#. module: sale_order_secondary_unit
#: model:ir.ui.menu,name:sale_order_secondary_unit.product_secondary_unit_menu
msgid "Secondary Units of Measure"
msgstr ""
#. module: sale_order_secondary_unit
#: model_terms:ir.ui.view,arch_db:sale_order_secondary_unit.product_secondary_unit_view_search
msgid "UoM"
msgstr ""
#. module: sale_order_secondary_unit
#. odoo-python
#: code:addons/sale_order_secondary_unit/models/product_template.py:0
#, python-format
msgid "Warning"
msgstr ""
#~ msgid "Second. Qty"
#~ msgstr "辅助单位数量"
#~ msgid "Secondary uom"
#~ msgstr "辅助计量单位"

View File

@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import product
from . import product_template
from . import sale_order

View File

@@ -0,0 +1,17 @@
# Copyright 2022 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ProductProduct(models.Model):
_inherit = "product.product"
sale_secondary_uom_id = fields.Many2one(
comodel_name="product.secondary.unit",
string="Default secondary unit for sales",
help="In order to set a value, please first add at least one record"
" in 'Secondary Unit of Measure'",
domain="['|', ('product_id', '=', id),"
"'&', ('product_tmpl_id', '=', product_tmpl_id),"
" ('product_id', '=', False)]",
)

View File

@@ -0,0 +1,72 @@
# Copyright 2018-2020 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class ProductTemplate(models.Model):
_inherit = "product.template"
sale_secondary_uom_id = fields.Many2one(
comodel_name="product.secondary.unit",
string="Default secondary unit for sales",
compute="_compute_sale_secondary_uom_id",
inverse="_inverse_sale_secondary_uom_id",
help="In order to set a value, please first add at least one record"
" in 'Secondary Unit of Measure'",
domain="[('product_tmpl_id', '=', id), ('product_id', '=', False)]",
store=True,
)
@api.depends("product_variant_ids", "product_variant_ids.sale_secondary_uom_id")
def _compute_sale_secondary_uom_id(self):
unique_variants = self.filtered(lambda tmpl: tmpl.product_variant_count == 1)
for template in unique_variants:
template.sale_secondary_uom_id = (
template.product_variant_ids.sale_secondary_uom_id
)
for template in self - unique_variants:
if len(template.product_variant_ids.sale_secondary_uom_id) == 1:
template.sale_secondary_uom_id = (
template.product_variant_ids.sale_secondary_uom_id
)
else:
template.sale_secondary_uom_id = False
def _inverse_sale_secondary_uom_id(self):
for template in self:
# if template.product_variant_count == 1:
template.product_variant_ids.sale_secondary_uom_id = (
template.sale_secondary_uom_id
)
@api.onchange("sale_secondary_uom_id")
def onchange_sale_secondary_uom_id(self):
if len(self.product_variant_ids.sale_secondary_uom_id) > 1:
return {
"warning": {
"title": self.env._("Warning"),
"message": self.env._(
"Product variants have distinct sale secondary uom:"
"\n{secondary_uom}\n"
"All variants will be written with new secondary uom"
).format(
secondary_uom="\n".join(
self.product_variant_ids.mapped(
"sale_secondary_uom_id.name"
)
)
),
}
}
@api.model_create_multi
def create(self, vals_list):
templates = super().create(vals_list)
# This is needed to set given values to first variant after creation
for template, vals in zip(templates, vals_list, strict=True):
related_vals = {}
if vals.get("sale_secondary_uom_id"):
related_vals["sale_secondary_uom_id"] = vals["sale_secondary_uom_id"]
if related_vals:
template.write(related_vals)
return templates

View File

@@ -0,0 +1,64 @@
# Copyright 2018-2020 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class SaleOrderLine(models.Model):
_inherit = ["sale.order.line", "product.secondary.unit.mixin"]
_name = "sale.order.line"
_secondary_unit_fields = {
"qty_field": "product_uom_qty",
"uom_field": "product_uom",
}
secondary_uom_unit_price = fields.Float(
string="2nd unit price",
digits="Product Price",
compute="_compute_secondary_uom_unit_price",
)
product_uom_qty = fields.Float(copy=True)
@api.depends(
"display_type",
"product_id",
"product_packaging_qty",
"secondary_uom_qty",
"secondary_uom_id",
"product_uom_qty",
)
def _compute_product_uom_qty(self):
res = super()._compute_product_uom_qty()
for line in self:
line._compute_helper_target_field_qty()
return res
@api.depends("product_id")
def _compute_product_uom(self):
res = super()._compute_product_uom()
for line in self:
line._onchange_helper_product_uom_for_secondary()
return res
@api.onchange("product_id")
def _onchange_product_id_warning(self):
res = super()._onchange_product_id_warning()
if self.product_id and not self.env.context.get("skip_secondary_uom_default"):
self.secondary_uom_id = self.product_id.sale_secondary_uom_id
if self.product_uom_qty == 1.0:
self.secondary_uom_qty = 1.0
self._onchange_helper_product_uom_for_secondary()
return res
@api.depends("secondary_uom_qty", "product_uom_qty", "price_unit")
def _compute_secondary_uom_unit_price(self):
for line in self:
if line.secondary_uom_id:
try:
line.secondary_uom_unit_price = (
line.price_subtotal / line.secondary_uom_qty
)
except ZeroDivisionError:
line.secondary_uom_unit_price = 0
else:
line.secondary_uom_unit_price = 0

View File

@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"

View File

@@ -0,0 +1,5 @@
To configure this module, you need to:
1. Go to *Sales \> Configuration \> Products \> Secondary Units of
Measure* to manage all the 'Secondary Units of Measure' in the
system.

View File

@@ -0,0 +1,9 @@
- Tony Gu \<<tony@openerp.cn>\>
- Alexei Rivera \<<arivera@archeti.com>\>
- Kevin Roche \<<kevin.roche@akretion.com>\>
- [Tecnativa](https://www.tecnativa.com):
- Carlos Dauden
- Sergio Teruel
- Ernesto Tejeda
- Pedro M. Baeza
- Pilar Vargas

View File

@@ -0,0 +1,2 @@
This module extends the functionality of sale orders to allow sale
products in secondary unit of distinct category.

View File

@@ -0,0 +1,8 @@
To use this module you need to:
1. Go to a *Product \> General Information tab*.
2. Create any record in "Secondary unit of measure".
3. Set the conversion factor.
4. Go to *Sales \> Quotation \> Create*.
5. Change quantities in line and secondary unit (produc_qty will be
change).

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="report_saleorder_document"
inherit_id="sale.report_saleorder_document"
>
<xpath
expr="//table[hasclass('o_has_total_table','table','o_main_table')]//th[@name='th_quantity']"
position="before"
>
<th name="th_secondary_uom_id" class="text-end" groups="uom.group_uom">
<span>Second. Qty</span>
</th>
</xpath>
<xpath expr="//span[@t-field='line.product_uom_qty']/.." position="before">
<td name="td_secondary_uom_id" class="text-end" groups="uom.group_uom">
<t t-if="line.secondary_uom_id">
<span t-field="line.secondary_uom_qty" />
<span
t-esc="' {}-{}-{}'.format(line.secondary_uom_id.name, line.secondary_uom_id.factor, line.secondary_uom_id.product_tmpl_id.uom_id.name)"
/>
</t>
</td>
</xpath>
</template>
</odoo>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1,462 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic, pre.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document">
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="sale-order-secondary-unit">
<h1>Sale Order Secondary Unit</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b6cd5a500712cd2681b14605e629fd1e3f3b710411c41958b917d87d6ed24898
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-workflow/tree/18.0/sale_order_secondary_unit"><img alt="OCA/sale-workflow" src="https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_order_secondary_unit"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module extends the functionality of sale orders to allow sale
products in secondary unit of distinct category.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
<p>To configure this module, you need to:</p>
<ol class="arabic simple">
<li>Go to <em>Sales &gt; Configuration &gt; Products &gt; Secondary Units of Measure</em>
to manage all the Secondary Units of Measure in the system.</li>
</ol>
</div>
<div class="section" id="usage">
<h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
<p>To use this module you need to:</p>
<ol class="arabic simple">
<li>Go to a <em>Product &gt; General Information tab</em>.</li>
<li>Create any record in “Secondary unit of measure”.</li>
<li>Set the conversion factor.</li>
<li>Go to <em>Sales &gt; Quotation &gt; Create</em>.</li>
<li>Change quantities in line and secondary unit (produc_qty will be
change).</li>
</ol>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/sale-workflow/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_order_secondary_unit%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
<ul class="simple">
<li>Tony Gu &lt;<a class="reference external" href="mailto:tony&#64;openerp.cn">tony&#64;openerp.cn</a>&gt;</li>
<li>Alexei Rivera &lt;<a class="reference external" href="mailto:arivera&#64;archeti.com">arivera&#64;archeti.com</a>&gt;</li>
<li>Kevin Roche &lt;<a class="reference external" href="mailto:kevin.roche&#64;akretion.com">kevin.roche&#64;akretion.com</a>&gt;</li>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Carlos Dauden</li>
<li>Sergio Teruel</li>
<li>Ernesto Tejeda</li>
<li>Pedro M. Baeza</li>
<li>Pilar Vargas</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-workflow/tree/18.0/sale_order_secondary_unit">OCA/sale-workflow</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import test_product_template
from . import test_sale_order

View File

@@ -0,0 +1,135 @@
# Copyright 2018-2020 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import Command
from odoo.tests import tagged
from odoo.addons.base.tests.common import BaseCommon
@tagged("post_install", "-at_install")
class TestProductTemplate(BaseCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.product_uom_unit = cls.env.ref("uom.product_uom_unit")
cls.product_attribute_model = cls.env["product.attribute"]
cls.product_attribute_value_model = cls.env["product.attribute.value"]
# Create product attributes
cls.color_attribute = cls.product_attribute_model.create(
{
"name": "Test Color (sale_order_secondary_unit)",
"create_variant": "always",
}
)
cls.color_values = cls.product_attribute_value_model.create(
[
{"name": "Red", "attribute_id": cls.color_attribute.id},
{"name": "Blue", "attribute_id": cls.color_attribute.id},
{"name": "Green", "attribute_id": cls.color_attribute.id},
]
)
cls.size_attribute = cls.product_attribute_model.create(
{
"name": "Test Size (sale_order_secondary_unit)",
"create_variant": "always",
}
)
cls.size_values = cls.product_attribute_value_model.create(
[
{"name": "S", "attribute_id": cls.size_attribute.id},
{"name": "M", "attribute_id": cls.size_attribute.id},
{"name": "L", "attribute_id": cls.size_attribute.id},
]
)
# Create product template
cls.product_template_1 = cls.env["product.template"].create(
{
"name": "Test Product 1",
}
)
# Create product variants
cls.product_template_2 = cls.env["product.template"].create(
{
"name": "Test Product 2",
"attribute_line_ids": [
Command.create(
{
"attribute_id": cls.color_attribute.id,
"value_ids": [(6, 0, cls.color_values.ids)],
},
),
Command.create(
{
"attribute_id": cls.size_attribute.id,
"value_ids": [(6, 0, cls.size_values.ids)],
},
),
],
}
)
# Create secondary units
cls.secondary_uom_1 = cls.env["product.secondary.unit"].create(
{
"name": "Unit 1",
"uom_id": cls.product_uom_unit.id,
"factor": 1,
"product_tmpl_id": cls.product_template_1.id,
}
)
cls.secondary_uom_2 = cls.env["product.secondary.unit"].create(
{
"name": "Unit 2",
"uom_id": cls.product_uom_unit.id,
"factor": 1,
"product_tmpl_id": cls.product_template_1.id,
}
)
cls.secondary_uom_3 = cls.env["product.secondary.unit"].create(
{
"name": "Unit 3",
"uom_id": cls.product_uom_unit.id,
"factor": 1,
"product_tmpl_id": cls.product_template_2.id,
}
)
cls.secondary_uom_4 = cls.env["product.secondary.unit"].create(
{
"name": "Unit 4",
"uom_id": cls.product_uom_unit.id,
"factor": 1,
"product_tmpl_id": cls.product_template_2.id,
}
)
def test_create_sets_sale_secondary_uom_id_for_single_variant(self):
product_variant_ids = self.product_template_1.product_variant_ids
product_variant_ids.sale_secondary_uom_id = self.secondary_uom_1
self.assertEqual(self.product_template_1.sale_secondary_uom_id.name, "Unit 1")
def test_create_not_sale_secondary_uom_id_for_variants_and_warns(self):
product_variant_ids = self.product_template_2.product_variant_ids
product_variant_ids[0].sale_secondary_uom_id = self.secondary_uom_3
product_variant_ids[1].sale_secondary_uom_id = self.secondary_uom_4
self.assertFalse(self.product_template_2.sale_secondary_uom_id)
warning = self.product_template_2.onchange_sale_secondary_uom_id()
self.assertIn("warning", warning)
self.assertIn(
"Product variants have distinct sale secondary uom",
warning["warning"]["message"],
)
def test_create_sale_secondary_uom_id_multiple_variants_same_uom(self):
product_variant_ids = self.product_template_2.product_variant_ids
product_variant_ids[0].sale_secondary_uom_id = self.secondary_uom_3
product_variant_ids[1].sale_secondary_uom_id = self.secondary_uom_3
self.assertEqual(self.product_template_2.sale_secondary_uom_id.name, "Unit 3")
def test_inverse_sale_secondary_uom_id_updates_variants_correctly(self):
self.product_template_1.sale_secondary_uom_id = self.secondary_uom_2
self.product_template_1._inverse_sale_secondary_uom_id()
self.assertEqual(
self.product_template_1.product_variant_ids.sale_secondary_uom_id,
self.product_template_1.sale_secondary_uom_id,
)

View File

@@ -0,0 +1,109 @@
# Copyright 2018-2020 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import Command
from odoo.tests import Form, tagged
from odoo.addons.base.tests.common import BaseCommon
@tagged("post_install", "-at_install")
class TestSaleOrder(BaseCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
# Remove this variable in v16 and put instead:
# from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT
cls.product_uom_kg = cls.env.ref("uom.product_uom_kgm")
cls.product_uom_gram = cls.env.ref("uom.product_uom_gram")
cls.product_uom_unit = cls.env.ref("uom.product_uom_unit")
cls.product = cls.env["product.product"].create(
{
"name": "test",
"uom_id": cls.product_uom_kg.id,
"uom_po_id": cls.product_uom_kg.id,
"list_price": 1000,
}
)
# Set secondary uom on product template
cls.product.product_tmpl_id.write(
{
"secondary_uom_ids": [
Command.create(
{
"name": "unit-500",
"uom_id": cls.product_uom_unit.id,
"factor": 0.5,
},
)
],
}
)
cls.secondary_unit = cls.env["product.secondary.unit"].search(
[("product_tmpl_id", "=", cls.product.product_tmpl_id.id)]
)
cls.product.sale_secondary_uom_id = cls.secondary_unit.id
cls.partner = cls.env["res.partner"].create({"name": "test - partner"})
with Form(cls.env["sale.order"]) as order_form:
order_form.partner_id = cls.partner
with order_form.order_line.new() as line_form:
line_form.product_id = cls.product
line_form.product_uom_qty = 1
cls.order = order_form.save()
def test_onchange_secondary_uom(self):
self.order.order_line.write(
{"secondary_uom_id": self.secondary_unit.id, "secondary_uom_qty": 5}
)
self.order.order_line._compute_product_uom_qty()
self.assertEqual(self.order.order_line.product_uom_qty, 2.5)
def test_onchange_secondary_unit_product_uom_qty(self):
self.order.order_line.update(
{"secondary_uom_id": self.secondary_unit.id, "product_uom_qty": 3.5}
)
self.assertEqual(self.order.order_line.secondary_uom_qty, 7.0)
def test_default_secondary_unit(self):
self.order.order_line._onchange_product_id_warning()
self.assertEqual(self.order.order_line.secondary_uom_id, self.secondary_unit)
def test_onchange_order_product_uom(self):
self.order.order_line.update(
{
"secondary_uom_id": self.secondary_unit.id,
"product_uom": self.product_uom_gram.id,
"product_uom_qty": 3500.00,
}
)
self.assertEqual(self.order.order_line.secondary_uom_qty, 7.0)
def test_independent_type(self):
# dependent type is already tested as dependency_type by default
self.order.order_line.secondary_uom_id = self.secondary_unit.id
self.order.order_line.secondary_uom_id.write({"dependency_type": "independent"})
# Remember previous UoM quantity for avoiding interactions with other modules
previous_uom_qty = self.order.order_line.product_uom_qty
self.order.order_line.write({"secondary_uom_qty": 2})
self.assertEqual(self.order.order_line.product_uom_qty, previous_uom_qty)
self.assertEqual(self.order.order_line.secondary_uom_qty, 2)
self.order.order_line.write({"product_uom_qty": 17})
self.assertEqual(self.order.order_line.secondary_uom_qty, 2)
self.assertEqual(self.order.order_line.product_uom_qty, 17)
def test_secondary_uom_unit_price(self):
# Remove secondary uom in sale line to do a complete test of secondary price
self.order.order_line.secondary_uom_id = False
self.assertEqual(self.order.order_line.secondary_uom_unit_price, 0)
self.order.order_line.update(
{"secondary_uom_id": self.secondary_unit.id, "product_uom_qty": 2}
)
self.assertEqual(self.order.order_line.secondary_uom_qty, 4)
self.assertEqual(self.order.order_line.secondary_uom_unit_price, 500)
self.order.order_line.write({"product_uom_qty": 8})
self.assertEqual(self.order.order_line.secondary_uom_qty, 16)
self.assertEqual(self.order.order_line.secondary_uom_unit_price, 500)
self.assertEqual(self.order.order_line.price_subtotal, 8000)

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="product_secondary_unit_view_search" model="ir.ui.view">
<field name="name">product.secondary.unit.view.search</field>
<field name="model">product.secondary.unit</field>
<field name="arch" type="xml">
<search>
<field name="product_tmpl_id" />
<field name="code" />
<field name="name" />
<group expand="1" string="Group By">
<filter
string="Product Template"
name="product_tmpl_id"
context="{'group_by':'product_tmpl_id'}"
/>
<filter
string="Product Variant"
name="product_id"
context="{'group_by':'product_id'}"
groups="product.group_product_variant"
/>
<filter
string="UoM"
name="uom_id"
context="{'group_by':'uom_id'}"
/>
</group>
</search>
</field>
</record>
<record id="product_secondary_unit_view_tree" model="ir.ui.view">
<field name="name">product.secondary.unit.sale.view.list</field>
<field name="model">product.secondary.unit</field>
<field name="arch" type="xml">
<list editable="top" multi_edit="1">
<field name="product_tmpl_id" />
<field
name="product_id"
domain="[('product_tmpl_id', '=', product_tmpl_id)]"
/>
<field name="code" />
<field name="name" />
<field name="uom_id" />
<field name="factor" />
</list>
</field>
</record>
<record id="product_secondary_unit_action" model="ir.actions.act_window">
<field name="name">Secondary Unit</field>
<field name="res_model">product.secondary.unit</field>
<field name="view_mode">list,form</field>
</record>
<menuitem
id="product_secondary_unit_menu"
name="Secondary Units of Measure"
action="product_secondary_unit_action"
parent="sale.next_id_16"
groups="uom.group_uom"
/>
</odoo>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018-2020 Tecnativa - Sergio Teruel
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">Product template Secondary Unit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view" />
<field name="arch" type="xml">
<div name="list_price_uom" position="after">
<field
name="sale_secondary_uom_id"
options="{'no_create': True}"
groups="uom.group_uom"
/>
</div>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018-2020 Tecnativa - Carlos Dauden
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_order_form" model="ir.ui.view">
<field name="name">Sale Order Secondary Unit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<xpath
expr="//field[@name='order_line']/form//field[@name='price_subtotal']"
position="after"
>
<label for="secondary_uom_qty" groups="uom.group_uom" />
<div class="o_row" name="secondary_uom_qty" groups="uom.group_uom">
<field
name="secondary_uom_qty"
class="oe_inline oe_no_button"
widget="numeric_step"
options="{'auto_select': True}"
readonly="state in ['done', 'cancel']"
/>
<field
name="secondary_uom_id"
class="oe_inline oe_no_button"
domain="product_id and ['|', ('product_id', '=', product_id),
'&amp;', ('product_tmpl_id.product_variant_ids', 'in', [product_id]),
('product_id', '=', False)] or [(0, '=', 1)]"
options="{'no_create': True, 'no_open': True}"
readonly="product_uom_readonly"
required="secondary_uom_qty != 0.0"
/>
</div>
</xpath>
<xpath
expr="//field[@name='order_line']/list//field[@name='product_uom_qty']"
position="before"
>
<field
name="secondary_uom_qty"
column_invisible="parent.state in ('done', 'cancel')"
groups="uom.group_uom"
/>
<field
name="secondary_uom_id"
domain="product_id and ['|', ('product_id', '=', product_id),
'&amp;', ('product_tmpl_id.product_variant_ids', 'in', [product_id]),
('product_id', '=', False)] or [(0, '=', 1)]"
options="{'no_create': True}"
readonly="product_uom_readonly"
required="secondary_uom_qty != 0.0"
groups="uom.group_uom"
/>
</xpath>
<xpath
expr="//field[@name='order_line']/kanban//field[@name='currency_id']"
position="after"
>
<field name="secondary_uom_id" invisible="1" />
<field name="secondary_uom_qty" invisible="1" />
</xpath>
<xpath
expr="//field[@name='order_line']/kanban//field[@name='product_uom_qty']"
position="before"
>
<t t-if="record.secondary_uom_id.value" groups="uom.group_uom">
<t t-esc="record.secondary_uom_qty.value" />
<t t-esc="record.secondary_uom_id.value" />
</t>
</xpath>
</field>
</record>
</odoo>