Merge PR #1741 into 14.0

Signed-off-by LoisRForgeFlow
This commit is contained in:
OCA-git-bot
2023-06-14 10:24:19 +00:00
3 changed files with 7 additions and 2 deletions

View File

@@ -23,7 +23,7 @@ Stock Request
:target: https://runbot.odoo-community.org/runbot/153/14.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.
@@ -117,6 +117,7 @@ Contributors
* Héctor Villarreal <hector.villarreal@forgeflow.com>
* Kitti U. <kittiu@ecosoft.co.th>
* Oriol Miranda <oriol.miranda@forgeflow.com>
Maintainers
~~~~~~~~~~~

View File

@@ -245,7 +245,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

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