From 2a8a5ff8f84e7e815d8812e7b73bcdb089407105 Mon Sep 17 00:00:00 2001 From: Bert Van Groenendael Date: Wed, 23 Oct 2024 10:37:28 +0200 Subject: [PATCH] [18.0][MIG] stock_no_negative: Migration to 18.0 --- stock_no_negative/README.rst | 4 ++++ stock_no_negative/models/stock_quant.py | 2 +- stock_no_negative/readme/CONTRIBUTORS.md | 3 +++ stock_no_negative/static/description/index.html | 4 ++++ stock_no_negative/tests/test_stock_no_negative.py | 6 ++++-- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/stock_no_negative/README.rst b/stock_no_negative/README.rst index 03fe6cdc01fb..2dd477691b7b 100644 --- a/stock_no_negative/README.rst +++ b/stock_no_negative/README.rst @@ -158,6 +158,10 @@ Contributors - Foram Darji +- `Dynapps `__: + + - Bert Van Groenendael + Maintainers ----------- diff --git a/stock_no_negative/models/stock_quant.py b/stock_no_negative/models/stock_quant.py index 584c77b7ab2d..6af202a2e36f 100644 --- a/stock_no_negative/models/stock_quant.py +++ b/stock_no_negative/models/stock_quant.py @@ -32,7 +32,7 @@ def check_negative_qty(self): disallowed_by_location = not quant.location_id.allow_negative_stock if ( float_compare(quant.quantity, 0, precision_digits=p) == -1 - and quant.product_id.type == "product" + and quant.product_id.is_storable and quant.location_id.usage in ["internal", "transit"] and disallowed_by_product and disallowed_by_location diff --git a/stock_no_negative/readme/CONTRIBUTORS.md b/stock_no_negative/readme/CONTRIBUTORS.md index 45b46d0779b0..0f244d08655e 100644 --- a/stock_no_negative/readme/CONTRIBUTORS.md +++ b/stock_no_negative/readme/CONTRIBUTORS.md @@ -18,3 +18,6 @@ - [OERP Canada](https://www.oerp.ca/): - Foram Darji \<\> + +- [Dynapps](https://www.dynapps.eu/): + - Bert Van Groenendael \<\> diff --git a/stock_no_negative/static/description/index.html b/stock_no_negative/static/description/index.html index 53e66af2c496..519d4d3d60b2 100644 --- a/stock_no_negative/static/description/index.html +++ b/stock_no_negative/static/description/index.html @@ -512,6 +512,10 @@

Contributors

  • Foram Darji <fd@oerp.ca>
  • +
  • Dynapps: +
  • diff --git a/stock_no_negative/tests/test_stock_no_negative.py b/stock_no_negative/tests/test_stock_no_negative.py index ce787ef1c41a..a7080e85e1ed 100644 --- a/stock_no_negative/tests/test_stock_no_negative.py +++ b/stock_no_negative/tests/test_stock_no_negative.py @@ -41,7 +41,8 @@ def _create_product(self, name): { "name": name, "categ_id": self.product_ctg.id, - "type": "product", + "is_storable": True, + "type": "consu", "allow_negative_stock": False, } ) @@ -52,7 +53,8 @@ def _create_product_with_lot(self, name): { "name": name, "categ_id": self.product_ctg.id, - "type": "product", + "is_storable": True, + "type": "consu", "tracking": "lot", "allow_negative_stock": False, }