diff --git a/mrp_lot_number_propagation/README.rst b/mrp_lot_number_propagation/README.rst deleted file mode 100644 index 85931dff6..000000000 --- a/mrp_lot_number_propagation/README.rst +++ /dev/null @@ -1,90 +0,0 @@ -============================= -MRP Serial Number Propagation -============================= - -.. - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! This file is generated by oca-gen-addon-readme !! - !! changes will be overwritten. !! - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:c8e23faceaca56df99285955d3b929df0db46670c281ac1e04ae36723e4116ec - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png - :target: https://odoo-community.org/page/development-status - :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-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%2Fmanufacture-lightgray.png?logo=github - :target: https://github.com/OCA/manufacture/tree/15.0/mrp_lot_number_propagation - :alt: OCA/manufacture -.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-mrp_lot_number_propagation - :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/manufacture&target_branch=15.0 - :alt: Try me on Runboat - -|badge1| |badge2| |badge3| |badge4| |badge5| - -Allow to propagate a lot number from a component to a finished product. - -**Table of contents** - -.. contents:: - :local: - -Known issues / Roadmap -====================== - -* Add compatibility with lot number (in addition to serial number) - -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 to smash it by providing a detailed and welcomed -`feedback `_. - -Do not contact contributors directly about support or help with technical issues. - -Credits -======= - -Authors -~~~~~~~ - -* Camptocamp - -Contributors -~~~~~~~~~~~~ - -* Akim Juillerat -* Sébastien Alix - -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. - -.. |maintainer-sebalix| image:: https://github.com/sebalix.png?size=40px - :target: https://github.com/sebalix - :alt: sebalix - -Current `maintainer `__: - -|maintainer-sebalix| - -This module is part of the `OCA/manufacture `_ project on GitHub. - -You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mrp_lot_number_propagation/__manifest__.py b/mrp_lot_number_propagation/__manifest__.py index 55c432f02..f439e3c63 100644 --- a/mrp_lot_number_propagation/__manifest__.py +++ b/mrp_lot_number_propagation/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) { "name": "MRP Serial Number Propagation", - "version": "15.0.0.3.0", + "version": "14.0.1.0.0", "development_status": "Beta", "license": "AGPL-3", "author": "Camptocamp, Odoo Community Association (OCA)", diff --git a/mrp_lot_number_propagation/models/mrp_bom.py b/mrp_lot_number_propagation/models/mrp_bom.py index a084dcf12..0e6204175 100644 --- a/mrp_lot_number_propagation/models/mrp_bom.py +++ b/mrp_lot_number_propagation/models/mrp_bom.py @@ -60,11 +60,11 @@ class MrpBom(models.Model): for line in self.bom_line_ids: if ( line.product_id.tracking == "serial" + and line.product_uom_id == uom_unit and tools.float_compare( line.product_qty, 1, precision_rounding=line.product_uom_id.rounding ) == 0 - and line.product_uom_id == uom_unit ): return True return False diff --git a/mrp_lot_number_propagation/static/description/icon.png b/mrp_lot_number_propagation/static/description/icon.png deleted file mode 100644 index 3a0328b51..000000000 Binary files a/mrp_lot_number_propagation/static/description/icon.png and /dev/null differ diff --git a/mrp_lot_number_propagation/static/description/index.html b/mrp_lot_number_propagation/static/description/index.html deleted file mode 100644 index 8c22edb25..000000000 --- a/mrp_lot_number_propagation/static/description/index.html +++ /dev/null @@ -1,431 +0,0 @@ - - - - - - -MRP Serial Number Propagation - - - -
-

MRP Serial Number Propagation

- - -

Beta License: AGPL-3 OCA/manufacture Translate me on Weblate Try me on Runboat

-

Allow to propagate a lot number from a component to a finished product.

-

Table of contents

- -
-

Known issues / Roadmap

-
    -
  • Add compatibility with lot number (in addition to serial number)
  • -
-
-
-

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 to smash it by providing a detailed and welcomed -feedback.

-

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

-
-
-

Credits

-
-

Authors

-
    -
  • Camptocamp
  • -
-
-
-

Contributors

- -
-
-

Maintainers

-

This module is maintained by the OCA.

-Odoo Community Association -

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.

-

Current maintainer:

-

sebalix

-

This module is part of the OCA/manufacture project on GitHub.

-

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

-
-
-
- - diff --git a/mrp_lot_number_propagation/tests/common.py b/mrp_lot_number_propagation/tests/common.py index 19194492e..72cb3cf84 100644 --- a/mrp_lot_number_propagation/tests/common.py +++ b/mrp_lot_number_propagation/tests/common.py @@ -8,7 +8,7 @@ from odoo import fields from odoo.tests import Form, common -class Common(common.TransactionCase): +class Common(common.SavepointCase): LOT_NAME = "PROPAGATED-LOT" @@ -121,9 +121,7 @@ class Common(common.TransactionCase): { "product_tmpl_id": product_template.id, "attribute_id": attribute.id, - "value_ids": [ - fields.Command.set([att_val.id for att_val in att_values_list]) - ], + "value_ids": [(6, 0, [att_val.id for att_val in att_values_list])], } ) @@ -145,7 +143,7 @@ class Common(common.TransactionCase): att_values_commands = [] for att_value in product.product_template_attribute_value_ids: att_values_commands.append( - fields.Command.link(attribute_values_dict[att_value.name]) + (4, attribute_values_dict[att_value.name], 0) ) create_values[ "bom_product_template_attribute_value_ids" diff --git a/mrp_lot_number_propagation/tests/test_mrp_production.py b/mrp_lot_number_propagation/tests/test_mrp_production.py index b464e9a44..c4030e134 100644 --- a/mrp_lot_number_propagation/tests/test_mrp_production.py +++ b/mrp_lot_number_propagation/tests/test_mrp_production.py @@ -2,7 +2,6 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) from odoo.exceptions import UserError -from odoo.fields import Command from odoo.tests.common import Form from .common import Common @@ -41,6 +40,7 @@ class TestMrpProduction(Common): self.assertTrue(self.order.is_lot_number_propagated) # set by onchange self._update_stock_component_qty(self.order) self.order.action_confirm() + self.order.action_assign() self.assertTrue(self.order.is_lot_number_propagated) # set by action_confirm self.assertTrue(any(self.order.move_raw_ids.mapped("propagate_lot_number"))) self._set_qty_done(self.order) @@ -53,13 +53,16 @@ class TestMrpProduction(Common): def test_order_post_inventory(self): self._update_stock_component_qty(self.order) self.order.action_confirm() + self.order.action_assign() self._set_qty_done(self.order) + self.assertTrue(self.order.is_lot_number_propagated) # set by action_confirm self.order.button_mark_done() self.assertEqual(self.order.lot_producing_id.name, self.LOT_NAME) def test_order_post_inventory_lot_already_exists_but_not_used(self): self._update_stock_component_qty(self.order) self.order.action_confirm() + self.order.action_assign() self._set_qty_done(self.order) self.assertEqual(self.order.propagated_lot_producing, self.LOT_NAME) # Create a lot with the same number for the finished product @@ -77,6 +80,7 @@ class TestMrpProduction(Common): def test_order_post_inventory_lot_already_exists_and_used(self): self._update_stock_component_qty(self.order) self.order.action_confirm() + self.order.action_assign() self._set_qty_done(self.order) self.assertEqual(self.order.propagated_lot_producing, self.LOT_NAME) # Create a lot with the same number for the finished product @@ -116,9 +120,7 @@ class TestMrpProduction(Common): # Remove application on variant for first bom line # with this only the first variant of the product template # will have a single component where lot must be propagated - new_bom.bom_line_ids[0].bom_product_template_attribute_value_ids = [ - Command.clear() - ] + new_bom.bom_line_ids[0].bom_product_template_attribute_value_ids = [(5, 0, 0)] for cnt, product in enumerate(self.bom_product_template.product_variant_ids): new_order = self._create_order(product, new_bom) if cnt == 0: @@ -131,14 +133,15 @@ class TestMrpProduction(Common): self._add_color_and_legs_variants(self.bom_product_template) self._add_color_and_legs_variants(self.product_template_tracked_by_sn) new_bom = self._create_bom_with_variants() - # Remove first bom line - # with this the first variant of the product template - # will not have any component where lot must be propagated - new_bom.bom_line_ids[0].unlink() for cnt, product in enumerate(self.bom_product_template.product_variant_ids): new_order = self._create_order(product, new_bom) if cnt == 0: + # Fake the case with no component by removing the flag + new_order.move_raw_ids.bom_line_id.write( + {"propagate_lot_number": False} + ) with self.assertRaisesRegex(UserError, "no component"): new_order.action_confirm() + new_order.action_assign() else: new_order.action_confirm()