Show countries on Melya invoice ports
This commit is contained in:
@@ -595,7 +595,7 @@
|
||||
<style:text-properties fo:color="#000000" loext:opacity="100%" style:font-name="Calibri" fo:font-size="9pt" fo:language="en" fo:country="US" fo:font-weight="bold" style:letter-kerning="false" style:font-name-asian="Times New Roman" style:font-size-asian="9pt" style:font-weight-asian="bold" style:font-name-complex="Arial" style:font-size-complex="9pt" style:font-weight-complex="bold"/>
|
||||
</style:style>
|
||||
<style:style style:name="T5" style:family="text">
|
||||
<style:text-properties fo:color="#000000" loext:opacity="100%" style:font-name="Arial" fo:font-size="8pt" style:letter-kerning="true" style:font-name-asian="Times New Roman" style:font-size-asian="8pt" style:font-name-complex="Arial" style:font-size-complex="8pt"/>
|
||||
<style:text-properties fo:color="#000000" loext:opacity="100%" style:font-name="Arial" fo:font-size="16pt" style:letter-kerning="true" style:font-name-asian="Times New Roman" style:font-size-asian="16pt" style:font-name-complex="Arial" style:font-size-complex="16pt"/>
|
||||
</style:style>
|
||||
<style:style style:name="T6" style:family="text">
|
||||
<style:text-properties fo:color="#000000" loext:opacity="100%" style:font-name="Arial" fo:font-size="8pt" style:letter-kerning="false" style:font-name-asian="Times New Roman" style:font-size-asian="8pt" style:font-name-complex="Arial" style:font-size-complex="8pt"/>
|
||||
|
||||
@@ -2305,19 +2305,34 @@ class Invoice(metaclass=PoolMeta):
|
||||
shipment = self._get_report_shipment()
|
||||
if shipment and shipment.vessel:
|
||||
return shipment.vessel.vessel_name
|
||||
|
||||
@staticmethod
|
||||
def _report_location_with_country(location):
|
||||
if not location:
|
||||
return ''
|
||||
location_name = (
|
||||
getattr(location, 'rec_name', None)
|
||||
or getattr(location, 'name', None)
|
||||
or '')
|
||||
country = getattr(location, 'country', None)
|
||||
country_name = getattr(country, 'name', None) if country else ''
|
||||
parts = [
|
||||
part for part in [location_name, country_name]
|
||||
if isinstance(part, str) and part]
|
||||
return ' '.join(parts)
|
||||
|
||||
@property
|
||||
def report_loading_port(self):
|
||||
shipment = self._get_report_shipment()
|
||||
if shipment and shipment.from_location:
|
||||
return shipment.from_location.rec_name
|
||||
return self._report_location_with_country(shipment.from_location)
|
||||
return ''
|
||||
|
||||
@property
|
||||
def report_discharge_port(self):
|
||||
shipment = self._get_report_shipment()
|
||||
if shipment and shipment.to_location:
|
||||
return shipment.to_location.rec_name
|
||||
return self._report_location_with_country(shipment.to_location)
|
||||
return ''
|
||||
|
||||
@property
|
||||
|
||||
@@ -10786,8 +10786,10 @@ description</t></is></c>
|
||||
bl_date='2026-04-05',
|
||||
bl_number='BL-B',
|
||||
vessel=Mock(vessel_name='VESSEL B'),
|
||||
from_location=Mock(rec_name='LOADING B'),
|
||||
to_location=Mock(rec_name='DISCHARGE B'),
|
||||
from_location=Mock(
|
||||
rec_name='LOADING B', country=Mock(name='Brazil')),
|
||||
to_location=Mock(
|
||||
rec_name='DISCHARGE B', country=Mock(name='Turkey')),
|
||||
controller=Mock(rec_name='CTRL B'),
|
||||
number='SI-B',
|
||||
)
|
||||
@@ -10805,8 +10807,8 @@ description</t></is></c>
|
||||
self.assertEqual(invoice.report_bl_nb, 'BL-B')
|
||||
self.assertEqual(invoice.report_bl_date, '2026-04-05')
|
||||
self.assertEqual(invoice.report_vessel, 'VESSEL B')
|
||||
self.assertEqual(invoice.report_loading_port, 'LOADING B')
|
||||
self.assertEqual(invoice.report_discharge_port, 'DISCHARGE B')
|
||||
self.assertEqual(invoice.report_loading_port, 'LOADING B Brazil')
|
||||
self.assertEqual(invoice.report_discharge_port, 'DISCHARGE B Turkey')
|
||||
self.assertEqual(invoice.report_controller_name, 'CTRL B')
|
||||
self.assertEqual(invoice.report_si_number, 'SI-B')
|
||||
self.assertEqual(invoice.report_si_reference, 'REF-B')
|
||||
|
||||
Reference in New Issue
Block a user