bemade-addons/bemade_fsm/tests/test_equipment.py
Marc Durepos 5793351bbe g This is a combination of 2 commits.
[MIG] bemade_fsm to 18.0

Aside from fixing standard 17.0..18.0 stuff and fixing XML ID
references:

1. **Remove `_get_closed_stage_by_project()`**: This method is
obsolete - it was copied from base FSM but no longer exists in
18.0. Base system now uses `is_closed` field.
2. **Implement State Propagation**: Enhance the `write()` method
to propagate done/cancelled states to child tasks using `is_closed` field logic.
3. **Test Task Creation**: Thoroughly test the custom task creation logic
against base 18.0

All 56 tests are passing.
2025-09-09 14:05:34 -04:00

32 lines
1.3 KiB
Python

from odoo.addons.bemade_fsm.tests.test_bemade_fsm_common import BemadeFSMBaseTest
from odoo.tests import tagged, Form
@tagged("-at_install", "post_install")
class TestEquipment(BemadeFSMBaseTest):
def test_equipment_search_domain_on_sale_order(self):
"""Equipment from other clients was showing up in sale order line
equipment choices. Make sure this doesn't happen."""
partner = self._generate_partner()
partner_2 = self._generate_partner()
equipment_1 = self._generate_equipment(partner=partner)
equipment_2 = self._generate_equipment(partner=partner_2)
sale_order = self._generate_sale_order(partner=partner)
product = self._generate_product()
self.assertEqual(sale_order.valid_equipment_ids, equipment_1)
name_search_results = self.env["fsm.equipment"].name_search(
args=[
"&",
["id", "in", sale_order.valid_equipment_ids.ids],
"!",
["id", "in", []],
],
limit=8,
name="test",
operator="ilike",
)
self.assertNotIn(
(equipment_2.id, equipment_2.display_name), name_search_results
)
self.assertIn((equipment_1.id, equipment_1.display_name), name_search_results)