cron faircot

This commit is contained in:
2026-04-21 14:59:31 +02:00
parent 9e4a12605c
commit cfb719a7da
2 changed files with 62 additions and 26 deletions

View File

@@ -279,6 +279,28 @@ class PurchaseTradeTestCase(ModuleTestCase):
party.get_sla_cost(Mock()),
(None, None, None, None))
def test_get_party_by_name_adds_missing_category_to_existing_party(self):
'existing parties found by automation gain the requested category when missing'
Party = Pool().get('party.party')
existing_party = Mock(id=12)
category = Mock(id=34)
category_model = Mock()
category_model.search.return_value = [category]
party_category_model = Mock()
party_category_model.search.return_value = []
with patch.object(Party, 'search', return_value=[existing_party]), patch(
'trytond.modules.purchase_trade.party.Pool') as PoolMock:
PoolMock.return_value.get.side_effect = lambda name: {
'party.category': category_model,
'party.party-party.category': party_category_model,
}[name]
party = Party.getPartyByName('SYED SP COT D BD', 'CLIENT')
self.assertIs(party, existing_party)
party_category_model.save.assert_called_once()
def test_create_fee_skips_when_controller_has_no_sla_cost(self):
'shipment fee creation skips cleanly when controller has no matching sla'
ShipmentIn = Pool().get('stock.shipment.in')