Invoice Melya template
This commit is contained in:
@@ -5081,6 +5081,59 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
self.assertEqual(invoice.report_si_number, 'SI-B')
|
||||
self.assertEqual(invoice.report_si_reference, 'REF-B')
|
||||
|
||||
def test_shipment_in_truck_defaults_empty_cargo_mode(self):
|
||||
'truck shipment clears vessel data and uses empty cargo mode'
|
||||
ShipmentIn = Pool().get('stock.shipment.in')
|
||||
|
||||
shipment = ShipmentIn()
|
||||
shipment.transport_type = 'truck'
|
||||
shipment.vessel = Mock()
|
||||
shipment.cargo_mode = 'bulk'
|
||||
|
||||
shipment.on_change_transport_type()
|
||||
|
||||
self.assertIsNone(shipment.vessel)
|
||||
self.assertEqual(shipment.cargo_mode, 'none')
|
||||
self.assertEqual(
|
||||
ShipmentIn._normalize_transport_values({
|
||||
'transport_type': 'truck',
|
||||
'cargo_mode': 'bulk',
|
||||
'vessel': 42,
|
||||
}),
|
||||
{
|
||||
'transport_type': 'truck',
|
||||
'cargo_mode': 'none',
|
||||
'vessel': None,
|
||||
})
|
||||
|
||||
def test_invoice_report_transportation_uses_truck_label(self):
|
||||
'invoice_melya Transportation displays By Truck for truck shipments'
|
||||
Invoice = Pool().get('account.invoice')
|
||||
|
||||
invoice = Invoice()
|
||||
invoice._get_report_shipment = Mock(return_value=Mock(
|
||||
transport_type='truck',
|
||||
supplier=Mock(rec_name='SUPPLIER'),
|
||||
vessel=Mock(vessel_name='VESSEL A'),
|
||||
note='ignored',
|
||||
))
|
||||
|
||||
self.assertEqual(invoice.report_transportation, 'By Truck')
|
||||
|
||||
def test_invoice_report_transportation_uses_vessel_name_only(self):
|
||||
'invoice_melya Transportation displays only vessel name for vessels'
|
||||
Invoice = Pool().get('account.invoice')
|
||||
|
||||
invoice = Invoice()
|
||||
invoice._get_report_shipment = Mock(return_value=Mock(
|
||||
transport_type='vessel',
|
||||
supplier=Mock(rec_name='SUPPLIER'),
|
||||
vessel=Mock(vessel_name='VESSEL A'),
|
||||
note='ignored',
|
||||
))
|
||||
|
||||
self.assertEqual(invoice.report_transportation, 'VESSEL A')
|
||||
|
||||
def test_invoice_report_shipment_is_blank_if_invoice_mixes_shipments(self):
|
||||
'invoice shipment fields stay empty when multiple shipments are invoiced together'
|
||||
Invoice = Pool().get('account.invoice')
|
||||
|
||||
Reference in New Issue
Block a user