[MIG] stock_secondary_unit: migration to V14.

This commit is contained in:
Jesús Alan Ramos Rodríguez
2021-10-05 12:01:30 -05:00
committed by Rocío Vega
parent fe22e2e956
commit c03e0e659b
8 changed files with 55 additions and 46 deletions

View File

@@ -14,13 +14,13 @@ Stock Secondary Unit
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_secondary_unit :target: https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_secondary_unit
:alt: OCA/stock-logistics-warehouse :alt: OCA/stock-logistics-warehouse
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_secondary_unit :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-14-0/stock-logistics-warehouse-14-0-stock_secondary_unit
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/153/13.0 :target: https://runbot.odoo-community.org/runbot/153/14.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@@ -51,7 +51,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/issues>`_.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_secondary_unit%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_secondary_unit%0Aversion:%2014.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. Do not contact contributors directly about support or help with technical issues.
@@ -70,6 +70,7 @@ Contributors
* Sergio Teruel <sergio.teruel@tecnativa.com> * Sergio Teruel <sergio.teruel@tecnativa.com>
* Kitti Upariphutthiphong <kittiu@ecosoft.co.th> * Kitti Upariphutthiphong <kittiu@ecosoft.co.th>
* Pimolnat Suntian <pimolnats@ecosoft.co.th> * Pimolnat Suntian <pimolnats@ecosoft.co.th>
* Alan Ramos <alan.ramos@jarsa.com.mx>
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@@ -84,6 +85,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_secondary_unit>`_ project on GitHub. This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_secondary_unit>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -3,7 +3,7 @@
{ {
"name": "Stock Secondary Unit", "name": "Stock Secondary Unit",
"summary": "Get product quantities in a secondary unit", "summary": "Get product quantities in a secondary unit",
"version": "13.0.2.1.0", "version": "14.0.1.0.1",
"development_status": "Production/Stable", "development_status": "Production/Stable",
"category": "stock", "category": "stock",
"website": "https://github.com/OCA/stock-logistics-warehouse", "website": "https://github.com/OCA/stock-logistics-warehouse",

View File

@@ -4,7 +4,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 13.0\n" "Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
@@ -19,6 +19,15 @@ msgid "<strong>Secondary Qty</strong>"
msgstr "" msgstr ""
#. module: stock_secondary_unit #. module: stock_secondary_unit
#: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_move__product_uom_qty
msgid "Demand"
msgstr ""
#. module: stock_secondary_unit
#: model:ir.model.fields,field_description:stock_secondary_unit.field_product_product__display_name
#: model:ir.model.fields,field_description:stock_secondary_unit.field_product_template__display_name
#: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_move__display_name
#: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_move_line__display_name
#: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_product_secondary_unit__display_name #: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_product_secondary_unit__display_name
msgid "Display Name" msgid "Display Name"
msgstr "" msgstr ""
@@ -29,17 +38,19 @@ msgid "Done"
msgstr "" msgstr ""
#. module: stock_secondary_unit #. module: stock_secondary_unit
#: model:ir.model.fields,field_description:stock_secondary_unit.field_product_product__id
#: model:ir.model.fields,field_description:stock_secondary_unit.field_product_template__id
#: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_move__id
#: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_move_line__id
#: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_product_secondary_unit__id #: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_product_secondary_unit__id
msgid "ID" msgid "ID"
msgstr "" msgstr ""
#. module: stock_secondary_unit #. module: stock_secondary_unit
#: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_move__product_uom_qty #: model:ir.model.fields,field_description:stock_secondary_unit.field_product_product____last_update
#: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_reservation__product_uom_qty #: model:ir.model.fields,field_description:stock_secondary_unit.field_product_template____last_update
msgid "Initial Demand" #: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_move____last_update
msgstr "" #: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_move_line____last_update
#. module: stock_secondary_unit
#: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_product_secondary_unit____last_update #: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_product_secondary_unit____last_update
msgid "Last Modified on" msgid "Last Modified on"
msgstr "" msgstr ""
@@ -66,12 +77,24 @@ msgstr ""
msgid "Quantity On Hand (2Unit)" msgid "Quantity On Hand (2Unit)"
msgstr "" msgstr ""
#. module: stock_secondary_unit
#: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_move__secondary_uom_id
#: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_move_line__secondary_uom_id
msgid "Second unit"
msgstr ""
#. module: stock_secondary_unit #. module: stock_secondary_unit
#: model:ir.model.fields,field_description:stock_secondary_unit.field_product_product__stock_secondary_uom_id #: model:ir.model.fields,field_description:stock_secondary_unit.field_product_product__stock_secondary_uom_id
#: model:ir.model.fields,field_description:stock_secondary_unit.field_product_template__stock_secondary_uom_id #: model:ir.model.fields,field_description:stock_secondary_unit.field_product_template__stock_secondary_uom_id
msgid "Second unit for inventory" msgid "Second unit for inventory"
msgstr "" msgstr ""
#. module: stock_secondary_unit
#: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_move__secondary_uom_qty
#: model:ir.model.fields,field_description:stock_secondary_unit.field_stock_move_line__secondary_uom_qty
msgid "Secondary Qty"
msgstr ""
#. module: stock_secondary_unit #. module: stock_secondary_unit
#: model_terms:ir.ui.view,arch_db:stock_secondary_unit.view_template_property_form #: model_terms:ir.ui.view,arch_db:stock_secondary_unit.view_template_property_form
msgid "Secondary unit" msgid "Secondary unit"
@@ -89,7 +112,6 @@ msgstr ""
#. module: stock_secondary_unit #. module: stock_secondary_unit
#: model:ir.model.fields,help:stock_secondary_unit.field_stock_move__product_uom_qty #: model:ir.model.fields,help:stock_secondary_unit.field_stock_move__product_uom_qty
#: model:ir.model.fields,help:stock_secondary_unit.field_stock_reservation__product_uom_qty
msgid "" msgid ""
"This is the quantity of products from an inventory point of view. For moves " "This is the quantity of products from an inventory point of view. For moves "
"in the state 'done', this is the quantity of products that were actually " "in the state 'done', this is the quantity of products that were actually "

View File

@@ -1,22 +0,0 @@
# Copyright 2020 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade # pylint: disable=W7936
@openupgrade.migrate()
def migrate(env, version):
# Delete old security group for views.
views = [
"stock_secondary_unit.view_template_property_form",
"stock_secondary_unit.product_template_form_view_procurement_button",
"stock_secondary_unit.product_form_view_procurement_button",
"stock_secondary_unit.product_template_tree_view",
"stock_secondary_unit.product_product_tree_view",
]
IrUiView = env["ir.ui.view"]
user_group = env.ref("uom.group_uom")
views_to_update = IrUiView.browse()
for view in views:
views_to_update |= env.ref(view)
views_to_update.write({"groups_id": [(3, user_group.id)]})

View File

@@ -2,3 +2,4 @@
* Sergio Teruel <sergio.teruel@tecnativa.com> * Sergio Teruel <sergio.teruel@tecnativa.com>
* Kitti Upariphutthiphong <kittiu@ecosoft.co.th> * Kitti Upariphutthiphong <kittiu@ecosoft.co.th>
* Pimolnat Suntian <pimolnats@ecosoft.co.th> * Pimolnat Suntian <pimolnats@ecosoft.co.th>
* Alan Ramos <alan.ramos@jarsa.com.mx>

View File

@@ -29,6 +29,11 @@
<strong>Secondary Qty</strong> <strong>Secondary Qty</strong>
</th> </th>
</xpath> </xpath>
</template>
<template
id="stock_report_delivery_has_serial_move_line"
inherit_id="stock.stock_report_delivery_has_serial_move_line"
>
<xpath expr="//span[@t-field='move_line.product_id']/.." position="after"> <xpath expr="//span[@t-field='move_line.product_id']/.." position="after">
<td> <td>
<span t-field="move_line.secondary_uom_qty" /> <span t-field="move_line.secondary_uom_qty" />

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_secondary_unit"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_secondary_unit"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p><a class="reference external" 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" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_secondary_unit"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-14-0/stock-logistics-warehouse-14-0-stock_secondary_unit"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module extends the functionality of stock module to allow define <p>This module extends the functionality of stock module to allow define
other units with their conversion factor.</p> other units with their conversion factor.</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
@@ -400,7 +400,7 @@ other units with their conversion factor.</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_secondary_unit%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_secondary_unit%0Aversion:%2014.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> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@@ -418,6 +418,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Sergio Teruel &lt;<a class="reference external" href="mailto:sergio.teruel&#64;tecnativa.com">sergio.teruel&#64;tecnativa.com</a>&gt;</li> <li>Sergio Teruel &lt;<a class="reference external" href="mailto:sergio.teruel&#64;tecnativa.com">sergio.teruel&#64;tecnativa.com</a>&gt;</li>
<li>Kitti Upariphutthiphong &lt;<a class="reference external" href="mailto:kittiu&#64;ecosoft.co.th">kittiu&#64;ecosoft.co.th</a>&gt;</li> <li>Kitti Upariphutthiphong &lt;<a class="reference external" href="mailto:kittiu&#64;ecosoft.co.th">kittiu&#64;ecosoft.co.th</a>&gt;</li>
<li>Pimolnat Suntian &lt;<a class="reference external" href="mailto:pimolnats&#64;ecosoft.co.th">pimolnats&#64;ecosoft.co.th</a>&gt;</li> <li>Pimolnat Suntian &lt;<a class="reference external" href="mailto:pimolnats&#64;ecosoft.co.th">pimolnats&#64;ecosoft.co.th</a>&gt;</li>
<li>Alan Ramos &lt;<a class="reference external" href="mailto:alan.ramos&#64;jarsa.com.mx">alan.ramos&#64;jarsa.com.mx</a>&gt;</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
@@ -427,7 +428,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_secondary_unit">OCA/stock-logistics-warehouse</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_secondary_unit">OCA/stock-logistics-warehouse</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> <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>

View File

@@ -16,6 +16,7 @@ class TestProductSecondaryUnit(SavepointCase):
cls.location_stock = cls.env.ref("stock.stock_location_stock") cls.location_stock = cls.env.ref("stock.stock_location_stock")
cls.picking_type_in = cls.env.ref("stock.picking_type_in") cls.picking_type_in = cls.env.ref("stock.picking_type_in")
cls.picking_type_out = cls.env.ref("stock.picking_type_out") cls.picking_type_out = cls.env.ref("stock.picking_type_out")
cls.picking_type_out.show_operations = True
cls.product_uom_kg = cls.env.ref("uom.product_uom_kgm") cls.product_uom_kg = cls.env.ref("uom.product_uom_kgm")
cls.product_uom_ton = cls.env.ref("uom.product_uom_ton") cls.product_uom_ton = cls.env.ref("uom.product_uom_ton")
@@ -135,15 +136,15 @@ class TestProductSecondaryUnit(SavepointCase):
delivery_order = StockPicking.create(do_vals) delivery_order = StockPicking.create(do_vals)
delivery_order.action_confirm() delivery_order.action_confirm()
# Move is merged into 1 line for both stock.move and stock.move.line # Move is merged into 1 line for both stock.move and stock.move.line
self.assertEquals(len(delivery_order.move_lines), 1) self.assertEqual(len(delivery_order.move_lines), 1)
self.assertEquals(len(delivery_order.move_line_ids), 1) self.assertEqual(len(delivery_order.move_line_ids), 1)
# Qty merged to 20, and secondary unit qty is 40line # Qty merged to 20, and secondary unit qty is 40line
uom_qty = sum(delivery_order.move_lines.mapped("product_uom_qty")) uom_qty = sum(delivery_order.move_lines.mapped("product_uom_qty"))
secondary_uom_qty = sum( secondary_uom_qty = sum(
delivery_order.move_line_ids.mapped("secondary_uom_qty") delivery_order.move_line_ids.mapped("secondary_uom_qty")
) )
self.assertEquals(uom_qty, 20.0) self.assertEqual(uom_qty, 20.0)
self.assertEquals(secondary_uom_qty, 40.0) self.assertEqual(secondary_uom_qty, 40.0)
def test_picking_secondary_unit(self): def test_picking_secondary_unit(self):
product = self.product_template.product_variant_ids[0] product = self.product_template.product_variant_ids[0]
@@ -205,7 +206,7 @@ class TestProductSecondaryUnit(SavepointCase):
move.secondary_uom_id = product.secondary_uom_ids[1] move.secondary_uom_id = product.secondary_uom_ids[1]
picking = picking_form.save() picking = picking_form.save()
picking.action_confirm() picking.action_confirm()
self.assertEquals(len(picking.move_lines), 2) self.assertEqual(len(picking.move_lines), 2)
def test_secondary_unit_merge_move_same_uom(self): def test_secondary_unit_merge_move_same_uom(self):
product = self.product_template.product_variant_ids[0] product = self.product_template.product_variant_ids[0]
@@ -225,5 +226,5 @@ class TestProductSecondaryUnit(SavepointCase):
move.secondary_uom_id = product.secondary_uom_ids[0] move.secondary_uom_id = product.secondary_uom_ids[0]
picking = picking_form.save() picking = picking_form.save()
picking.action_confirm() picking.action_confirm()
self.assertEquals(len(picking.move_lines), 1) self.assertEqual(len(picking.move_lines), 1)
self.assertEquals(picking.move_lines.secondary_uom_qty, 2) self.assertEqual(picking.move_lines.secondary_uom_qty, 2)