Lots Management Enhancement

This commit is contained in:
2026-05-09 11:03:51 +02:00
parent c27c915700
commit d8ac25dcda
7 changed files with 291 additions and 102 deletions

View File

@@ -781,6 +781,37 @@ class PurchaseTradeTestCase(ModuleTestCase):
fee_model.save.assert_not_called()
product_model.get_by_name.assert_not_called()
@with_transaction()
def test_shipment_in_type_detects_dropship(self):
'shipment type is dropship from supplier directly to customer'
ShipmentIn = Pool().get('stock.shipment.in')
shipment = ShipmentIn()
shipment.from_location = Mock(type='supplier')
shipment.to_location = Mock(type='customer')
self.assertEqual(shipment.get_shipment_type(), 'dropship')
@with_transaction()
def test_shipment_in_type_defaults_to_inbound(self):
'shipment type is inbound for non supplier-to-customer routes'
ShipmentIn = Pool().get('stock.shipment.in')
shipment = ShipmentIn()
shipment.from_location = Mock(type='supplier')
shipment.to_location = Mock(type='storage')
self.assertEqual(shipment.get_shipment_type(), 'inbound')
@with_transaction()
def test_lot_report_shipment_type_uses_linked_shipment(self):
'lot report shipment type mirrors the linked shipment_in'
LotReport = Pool().get('lot.report')
report = LotReport()
report.r_lot_shipment_in = Mock(shipment_type='dropship')
report.r_from_l = Mock(type='storage')
report.r_from_t = Mock(type='storage')
self.assertEqual(report.get_shipment_type(None), 'dropship')
def test_purchase_line_default_pricing_rule_comes_from_configuration(self):
'purchase line pricing_rule defaults to the purchase_trade singleton value'
PurchaseLine = Pool().get('purchase.line')