From 7d4b9c6fd9ca2a3e6ef4ba8ccbb622634a5a3300 Mon Sep 17 00:00:00 2001 From: John Herholz Date: Thu, 21 Dec 2023 11:22:23 +0100 Subject: [PATCH] [MIG] scrap_reason_code: Migration to 17.0 --- scrap_reason_code/__manifest__.py | 2 +- scrap_reason_code/models/stock_scrap.py | 1 - .../static/description/index.html | 1112 ++++++++++------- .../tests/test_scrap_reason_code.py | 16 +- scrap_reason_code/views/stock_move_views.xml | 5 +- scrap_reason_code/views/stock_scrap_views.xml | 12 +- 6 files changed, 672 insertions(+), 476 deletions(-) diff --git a/scrap_reason_code/__manifest__.py b/scrap_reason_code/__manifest__.py index 58a00ea2e..a644eeeaa 100644 --- a/scrap_reason_code/__manifest__.py +++ b/scrap_reason_code/__manifest__.py @@ -2,7 +2,7 @@ { "name": "Scrap Reason Code", - "version": "16.0.1.1.0", + "version": "17.0.1.0.0", "license": "AGPL-3", "summary": "Reason code for scrapping", "author": "Open Source Integrators, Odoo Community Association (OCA)", diff --git a/scrap_reason_code/models/stock_scrap.py b/scrap_reason_code/models/stock_scrap.py index 37c8899d2..1e8739735 100644 --- a/scrap_reason_code/models/stock_scrap.py +++ b/scrap_reason_code/models/stock_scrap.py @@ -12,7 +12,6 @@ class StockScrap(models.Model): reason_code_id = fields.Many2one( comodel_name="scrap.reason.code", - states={"done": [("readonly", True)]}, domain="[('id', 'in', allowed_reason_code_ids)]", ) allowed_reason_code_ids = fields.Many2many( diff --git a/scrap_reason_code/static/description/index.html b/scrap_reason_code/static/description/index.html index 9d0cd30b4..06cd24edb 100644 --- a/scrap_reason_code/static/description/index.html +++ b/scrap_reason_code/static/description/index.html @@ -1,458 +1,658 @@ - - + - - - -Scrap Reason Code - - - -
-

Scrap Reason Code

- - -

Beta License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runboat

-

Adds a reason code for scrapping operations and an interface for the -user to create scrap codes

-

Table of contents

- -
-

Configuration

-

Go to Inventory > Configuration > Scrap Reason Codes

-

Create a required scrap reason code and provide scrap location.

-
-
-

Usage

-
    -
  • Go to Inventory > Operations > Scrap
  • -
  • Create a scarp order and select reason code.
  • -
  • A scrap location will be readonly and auto fill based on selected -reason code.
  • -
-
- -
-

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

-
    -
  • Open Source Integrators
  • -
-
-
-

Contributors

- -
-
-

Other credits

-

The development of this module has been financially supported by:

-
    -
  • Open Source Integrators
  • -
-
-
-

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:

-

bodedra

-

This module is part of the OCA/stock-logistics-warehouse project on GitHub.

-

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

-
-
-
- + + + + Scrap Reason Code + + + +
+

Scrap Reason Code

+ + +

+ + Beta + + + License: AGPL-3 + + + OCA/stock-logistics-warehouse + + + Translate me on Weblate + + + Try me on Runboat + +

+

Adds a reason code for scrapping operations and an interface for the + user to create scrap codes +

+

+ Table of contents +

+
+ +
+
+

+ Configuration +

+

Go to Inventory > Configuration > Scrap Reason Codes

+

Create a required scrap reason code and provide scrap location.

+
+
+

+ Usage +

+
    +
  • Go to Inventory > Operations > Scrap
  • +
  • Create a scarp order and select reason code.
  • +
  • A scrap location will be readonly and auto fill based on selected + reason code. +
  • +
+
+ +
+

+ 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 +

+
    +
  • Open Source Integrators
  • +
+
+
+

+ Contributors +

+ +
+
+

+ Other credits +

+

The development of this module has been financially supported by:

+
    +
  • Open Source Integrators
  • +
+
+
+

+ 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: +

+

+ + bodedra + +

+

This module is part of the + + OCA/stock-logistics-warehouse + + project on GitHub. +

+

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

+
+
+
+ diff --git a/scrap_reason_code/tests/test_scrap_reason_code.py b/scrap_reason_code/tests/test_scrap_reason_code.py index 16e8298ea..e755a5cfa 100644 --- a/scrap_reason_code/tests/test_scrap_reason_code.py +++ b/scrap_reason_code/tests/test_scrap_reason_code.py @@ -106,17 +106,17 @@ class StockScrap(TransactionCase): scrapped_move = picking.move_ids.filtered(lambda m: m.state == "done") self.assertTrue(scrapped_move, "No scrapped move created.") self.assertEqual( - scrapped_move.scrap_ids.ids, [scrap.id], "Wrong scrap linked to the move." + scrapped_move.scrap_id.id, scrap.id, "Wrong scrap linked to the move." ) self.assertEqual( scrap.scrap_qty, 5, "Scrap quantity has been modified and is not " "correct anymore.", ) - move = scrap.move_id - self.assertEqual(move.reason_code_id.id, self.reason_code.id) + moves = scrap.move_ids + self.assertEqual(moves.mapped("reason_code_id.id"), [self.reason_code.id]) - scrapped_move.quantity_done = 8 + scrapped_move.quantity = 8 self.assertEqual(scrap.scrap_qty, 8, "Scrap quantity is not updated.") def test_scrap_reason_code_write(self): @@ -170,17 +170,17 @@ class StockScrap(TransactionCase): scrapped_move = picking2.move_ids.filtered(lambda m: m.state == "done") self.assertTrue(scrapped_move, "No scrapped move created.") self.assertEqual( - scrapped_move.scrap_ids.ids, [scrap2.id], "Wrong scrap linked to the move." + scrapped_move.scrap_id.id, scrap2.id, "Wrong scrap linked to the move." ) self.assertEqual( scrap2.scrap_qty, 5, "Scrap quantity has been modified and is not " "correct anymore.", ) - move = scrap2.move_id - self.assertEqual(move.reason_code_id.id, self.reason_code.id) + moves = scrap2.move_ids + self.assertEqual(moves.mapped("reason_code_id.id"), [self.reason_code.id]) - scrapped_move.quantity_done = 8 + scrapped_move.quantity = 8 self.assertEqual(scrap2.scrap_qty, 8, "Scrap quantity is not updated.") def test_allowed_reason_codes(self): diff --git a/scrap_reason_code/views/stock_move_views.xml b/scrap_reason_code/views/stock_move_views.xml index a2a77af18..fcfb96221 100644 --- a/scrap_reason_code/views/stock_move_views.xml +++ b/scrap_reason_code/views/stock_move_views.xml @@ -8,10 +8,7 @@ - + diff --git a/scrap_reason_code/views/stock_scrap_views.xml b/scrap_reason_code/views/stock_scrap_views.xml index 6ed37bdaa..3bb2d8dd4 100644 --- a/scrap_reason_code/views/stock_scrap_views.xml +++ b/scrap_reason_code/views/stock_scrap_views.xml @@ -8,8 +8,8 @@ - - + + @@ -19,8 +19,8 @@ - - + + @@ -30,8 +30,8 @@ - - + +