[FIX] stock_request: set stock request order state to done when partially delivered

This commit is contained in:
OriolMForgeFlow
2023-06-06 09:48:00 +02:00
parent 8da5cf1703
commit 767ae98db1
4 changed files with 7 additions and 2 deletions

View File

@@ -23,7 +23,7 @@ Stock Request
:target: https://runbot.odoo-community.org/runbot/153/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
|badge1| |badge2| |badge3| |badge4| |badge5|
This module was written to allow users to request products that are
frequently stocked by the company, to be transferred to their chosen location.

View File

@@ -243,7 +243,9 @@ class StockRequestOrder(models.Model):
def check_done(self):
for rec in self:
if not rec.stock_request_ids.filtered(lambda r: r.state != "done"):
if not rec.stock_request_ids.filtered(
lambda r: r.state not in ["done", "cancel"]
):
rec.action_done()
return

View File

@@ -10,3 +10,4 @@
* Steve Campbell <scampbell@opensourceintegrators.com>
* Héctor Villarreal <hector.villarreal@forgeflow.com>
* Oriol Miranda <oriol.miranda@forgeflow.com>

View File

@@ -1117,3 +1117,5 @@ class TestStockRequestBase(TestStockRequest):
self.assertEqual(sr2.qty_cancelled, 4)
self.assertEqual(sr3.state, "done")
self.assertEqual(sr3.qty_cancelled, 5)
# Set the request order to done if there are any delivered lines
self.assertEqual(order.state, "done")