-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] joint_buying_product: if line changed lately, recreate (or rede…
…lete) transport requests related to orders, if required, calling hook
- Loading branch information
1 parent
e45e57e
commit 47bb94d
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
joint_buying_product/tests/test_joint_buying_wizard_update_order_grouped.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Copyright (C) 2024 - Today: GRAP (http://www.grap.coop) | ||
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
|
||
from odoo.tests import tagged | ||
|
||
from .test_abstract import TestAbstract | ||
|
||
|
||
@tagged("post_install", "-at_install") | ||
class TestJointBuyingWizardUpdateOrderGrouped(TestAbstract): | ||
def setUp(self): | ||
super().setUp() | ||
|
||
def test_01_wizard_update_order_grouped(self): | ||
|
||
wizard = self.JointBuyingWizardUpdateOrderGrouped.with_context( | ||
active_id=self.grouped_order_ronzon_past.id | ||
).create({}) | ||
wizard.show_all_orders = True | ||
wizard.show_all_products = True | ||
wizard.onchange_show_settings() | ||
|
||
wizard.line_ids.write({"qty": 0}) | ||
|
||
self.assertEqual( | ||
len( | ||
self.grouped_order_ronzon_past.mapped("order_ids.transport_request_id") | ||
), | ||
0, | ||
) | ||
|
||
wizard.line_ids.write({"qty": 100}) | ||
|
||
self.assertEqual( | ||
len( | ||
self.grouped_order_ronzon_past.mapped("order_ids.transport_request_id") | ||
), | ||
len( | ||
self.grouped_order_ronzon_past.mapped("order_ids").filtered( | ||
lambda x: x.deposit_partner_id != x.delivery_partner_id | ||
) | ||
), | ||
) |