Improve linkage report layout
This commit is contained in:
@@ -1714,6 +1714,15 @@ class ShipmentIn(metaclass=PoolMeta):
|
||||
amount = Decimal(str(amount or 0))
|
||||
return -amount if getattr(fee, 'p_r', None) == 'pay' else amount
|
||||
|
||||
@classmethod
|
||||
def _report_linkage_fee_label(cls, fee):
|
||||
product = getattr(fee, 'product', None)
|
||||
label = (
|
||||
getattr(product, 'name', None)
|
||||
or cls._report_rec_name(product)
|
||||
or 'Fee')
|
||||
return label
|
||||
|
||||
def _get_report_linkage_summary_rows(self):
|
||||
purchase_lines = self._get_report_linkage_purchase_lines()
|
||||
sale_lines = self._get_report_linkage_sale_lines()
|
||||
@@ -1728,11 +1737,13 @@ class ShipmentIn(metaclass=PoolMeta):
|
||||
rows.append(('Sales', '', sale_total, sale_total))
|
||||
|
||||
fee_total = Decimal('0')
|
||||
fee_rows = {}
|
||||
for fee in self._get_report_linkage_fees():
|
||||
product = getattr(fee, 'product', None)
|
||||
label = self._report_rec_name(product) or 'Fee'
|
||||
label = self._report_linkage_fee_label(fee)
|
||||
amount = self._report_fee_amount(fee)
|
||||
fee_total += amount
|
||||
fee_rows[label] = fee_rows.get(label, Decimal('0')) + amount
|
||||
for label, amount in fee_rows.items():
|
||||
rows.append(('Costs', label, amount, amount))
|
||||
|
||||
if rows:
|
||||
@@ -2940,6 +2951,10 @@ class LotQt(metaclass=PoolMeta):
|
||||
def _report_fee_amount(cls, fee):
|
||||
return ShipmentIn._report_fee_amount(fee)
|
||||
|
||||
@classmethod
|
||||
def _report_linkage_fee_label(cls, fee):
|
||||
return ShipmentIn._report_linkage_fee_label(fee)
|
||||
|
||||
@classmethod
|
||||
def _report_column(cls, rows, index, amount=False):
|
||||
return ShipmentIn._report_column(rows, index, amount=amount)
|
||||
@@ -4710,6 +4725,10 @@ class LotReportLinkageRecord:
|
||||
def _report_fee_amount(cls, fee):
|
||||
return ShipmentIn._report_fee_amount(fee)
|
||||
|
||||
@classmethod
|
||||
def _report_linkage_fee_label(cls, fee):
|
||||
return ShipmentIn._report_linkage_fee_label(fee)
|
||||
|
||||
@classmethod
|
||||
def _report_column(cls, rows, index, amount=False):
|
||||
return ShipmentIn._report_column(rows, index, amount=amount)
|
||||
|
||||
@@ -6562,7 +6562,17 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
ShipmentIn = Pool().get('stock.shipment.in')
|
||||
shipment = ShipmentIn()
|
||||
shipment.bl_date = datetime.date(2026, 4, 30)
|
||||
shipment.fees = []
|
||||
freight_product = SimpleNamespace(
|
||||
rec_name='[Maritime Freight] Maritime freight',
|
||||
name='Maritime freight')
|
||||
shipment.fees = [
|
||||
SimpleNamespace(
|
||||
id=201, product=freight_product, price=Decimal('10'),
|
||||
quantity=Decimal('1'), mode='lumpsum', p_r='pay'),
|
||||
SimpleNamespace(
|
||||
id=202, product=freight_product, price=Decimal('15'),
|
||||
quantity=Decimal('1'), mode='lumpsum', p_r='pay'),
|
||||
]
|
||||
shipment.moves = []
|
||||
shipment.lotqt = []
|
||||
|
||||
@@ -6637,6 +6647,12 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
self.assertIn('Sales', shipment.report_linkage_summary_groups)
|
||||
self.assertIn('-8,000.000', shipment.report_linkage_summary_estimated)
|
||||
self.assertIn('10,000.000', shipment.report_linkage_summary_estimated)
|
||||
summary_rows = shipment._get_report_linkage_summary_rows()
|
||||
freight_rows = [
|
||||
row for row in summary_rows
|
||||
if row[0] == 'Costs' and row[1] == 'Maritime freight']
|
||||
self.assertEqual(len(freight_rows), 1)
|
||||
self.assertEqual(freight_rows[0][2], Decimal('-25'))
|
||||
self.assertIn('P-10', shipment.report_linkage_movement_references)
|
||||
self.assertIn('S-20', shipment.report_linkage_movement_references)
|
||||
self.assertIn('100 MT', shipment.report_linkage_movement_quantities)
|
||||
|
||||
@@ -1153,15 +1153,15 @@
|
||||
<style:style style:name="LKSumGroupW" style:family="table-column"><style:table-column-properties style:column-width="1.65cm"/></style:style>
|
||||
<style:style style:name="LKSumCostW" style:family="table-column"><style:table-column-properties style:column-width="4.75cm"/></style:style>
|
||||
<style:style style:name="LKSumAmountW" style:family="table-column"><style:table-column-properties style:column-width="2.8cm"/></style:style>
|
||||
<style:style style:name="LKMoveTypeW" style:family="table-column"><style:table-column-properties style:column-width="1.15cm"/></style:style>
|
||||
<style:style style:name="LKMoveRefW" style:family="table-column"><style:table-column-properties style:column-width="5.6cm"/></style:style>
|
||||
<style:style style:name="LKMoveCounterW" style:family="table-column"><style:table-column-properties style:column-width="4.5cm"/></style:style>
|
||||
<style:style style:name="LKMoveCommodityW" style:family="table-column"><style:table-column-properties style:column-width="4.2cm"/></style:style>
|
||||
<style:style style:name="LKMoveQtyW" style:family="table-column"><style:table-column-properties style:column-width="2.6cm"/></style:style>
|
||||
<style:style style:name="LKMoveDelW" style:family="table-column"><style:table-column-properties style:column-width="1.35cm"/></style:style>
|
||||
<style:style style:name="LKMoveBasisW" style:family="table-column"><style:table-column-properties style:column-width="2.0cm"/></style:style>
|
||||
<style:style style:name="LKMovePeriodW" style:family="table-column"><style:table-column-properties style:column-width="2.0cm"/></style:style>
|
||||
<style:style style:name="LKMoveDateW" style:family="table-column"><style:table-column-properties style:column-width="2.0cm"/></style:style>
|
||||
<style:style style:name="LKMoveTypeW" style:family="table-column"><style:table-column-properties style:column-width="1.75cm"/></style:style>
|
||||
<style:style style:name="LKMoveRefW" style:family="table-column"><style:table-column-properties style:column-width="5.25cm"/></style:style>
|
||||
<style:style style:name="LKMoveCounterW" style:family="table-column"><style:table-column-properties style:column-width="4.35cm"/></style:style>
|
||||
<style:style style:name="LKMoveCommodityW" style:family="table-column"><style:table-column-properties style:column-width="4.0cm"/></style:style>
|
||||
<style:style style:name="LKMoveQtyW" style:family="table-column"><style:table-column-properties style:column-width="2.55cm"/></style:style>
|
||||
<style:style style:name="LKMoveDelW" style:family="table-column"><style:table-column-properties style:column-width="1.65cm"/></style:style>
|
||||
<style:style style:name="LKMoveBasisW" style:family="table-column"><style:table-column-properties style:column-width="1.8cm"/></style:style>
|
||||
<style:style style:name="LKMovePeriodW" style:family="table-column"><style:table-column-properties style:column-width="1.9cm"/></style:style>
|
||||
<style:style style:name="LKMoveDateW" style:family="table-column"><style:table-column-properties style:column-width="1.85cm"/></style:style>
|
||||
<style:style style:name="LKBankDealW" style:family="table-column"><style:table-column-properties style:column-width="5.1cm"/></style:style>
|
||||
<style:style style:name="LKBankTypeW" style:family="table-column"><style:table-column-properties style:column-width="1.35cm"/></style:style>
|
||||
<style:style style:name="LKBankNameW" style:family="table-column"><style:table-column-properties style:column-width="6.95cm"/></style:style>
|
||||
@@ -1186,26 +1186,26 @@
|
||||
<style:style style:name="LKTitleRow" style:family="table-row"><style:table-row-properties style:min-row-height="0.46cm"/></style:style>
|
||||
<style:style style:name="LKHeadRow" style:family="table-row"><style:table-row-properties style:min-row-height="0.48cm"/></style:style>
|
||||
<style:style style:name="LKSectionRow" style:family="table-row"><style:table-row-properties style:min-row-height="0.55cm"/></style:style>
|
||||
<style:style style:name="LKSmallRow" style:family="table-row"><style:table-row-properties style:min-row-height="0.34cm"/></style:style>
|
||||
<style:style style:name="LKSmallRow" style:family="table-row"><style:table-row-properties style:min-row-height="0.31cm"/></style:style>
|
||||
<style:style style:name="LKBankRow" style:family="table-row"><style:table-row-properties style:min-row-height="0.78cm"/></style:style>
|
||||
<style:style style:name="LKSignatureRow" style:family="table-row"><style:table-row-properties style:min-row-height="3.5cm"/></style:style>
|
||||
<style:style style:name="LKHeaderCell" style:family="table-cell"><style:table-cell-properties fo:padding="0.02cm" fo:border="none"/></style:style>
|
||||
<style:style style:name="LKNoBorder" style:family="table-cell"><style:table-cell-properties fo:padding="0.02cm" fo:border="none"/></style:style>
|
||||
<style:style style:name="LKNoBorder" style:family="table-cell"><style:table-cell-properties fo:padding="0.025cm" fo:border="none"/></style:style>
|
||||
<style:style style:name="LKBlue" style:family="table-cell"><style:table-cell-properties fo:background-color="#69b4f0" fo:padding="0.03cm" fo:border="1pt solid #000000"><style:background-image/></style:table-cell-properties></style:style>
|
||||
<style:style style:name="LKLine" style:family="table-cell"><style:table-cell-properties fo:padding="0.03cm" fo:border-left="none" fo:border-right="none" fo:border-top="none" fo:border-bottom="1pt solid #000000"/></style:style>
|
||||
<style:style style:name="LKZero" style:family="paragraph"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="1%"/><style:text-properties fo:font-size="1pt"/></style:style>
|
||||
<style:style style:name="LKSpacer" style:family="paragraph"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.13cm" fo:line-height="1%"/><style:text-properties fo:font-size="2pt"/></style:style>
|
||||
<style:style style:name="LKSpacer" style:family="paragraph"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.08cm" fo:line-height="1%"/><style:text-properties fo:font-size="2pt"/></style:style>
|
||||
<style:style style:name="LKPageBreak" style:family="paragraph"><style:paragraph-properties fo:break-before="page" fo:margin-top="0cm" fo:margin-bottom="0cm"/><style:text-properties fo:font-size="1pt"/></style:style>
|
||||
<style:style style:name="LKTitle" style:family="paragraph"><style:paragraph-properties fo:text-align="center" fo:margin-top="0cm" fo:margin-bottom="0.03cm" fo:line-height="100%"/><style:text-properties style:font-name="Arial" fo:font-size="16pt" fo:font-weight="bold"/></style:style>
|
||||
<style:style style:name="LKLogo" style:family="paragraph"><style:paragraph-properties fo:margin-top="0.08cm" fo:margin-bottom="0cm" fo:line-height="100%"/><style:text-properties style:font-name="Arial" fo:font-size="8pt"/></style:style>
|
||||
<style:style style:name="LKHeadLabel" style:family="paragraph"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%"/><style:text-properties style:font-name="Arial" fo:font-size="8.5pt" fo:font-weight="bold"/></style:style>
|
||||
<style:style style:name="LKHeadValue" style:family="paragraph"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%"/><style:text-properties style:font-name="Arial" fo:font-size="8.5pt"/></style:style>
|
||||
<style:style style:name="LKHeadLabel" style:family="paragraph"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%"/><style:text-properties style:font-name="Arial" fo:font-size="8pt" fo:font-weight="bold"/></style:style>
|
||||
<style:style style:name="LKHeadValue" style:family="paragraph"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%"/><style:text-properties style:font-name="Arial" fo:font-size="8pt"/></style:style>
|
||||
<style:style style:name="LKSectionText" style:family="paragraph"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%"/><style:text-properties style:font-name="Arial" fo:font-size="10pt" fo:font-weight="bold"/></style:style>
|
||||
<style:style style:name="LKCell" style:family="paragraph"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%"/><style:text-properties style:font-name="Arial" fo:font-size="8.5pt"/></style:style>
|
||||
<style:style style:name="LKCellRight" style:family="paragraph" style:parent-style-name="LKCell"><style:paragraph-properties fo:text-align="end"/><style:text-properties style:font-name="Arial" fo:font-size="8.5pt"/></style:style>
|
||||
<style:style style:name="LKCell" style:family="paragraph"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%"/><style:text-properties style:font-name="Arial" fo:font-size="8pt"/></style:style>
|
||||
<style:style style:name="LKCellRight" style:family="paragraph" style:parent-style-name="LKCell"><style:paragraph-properties fo:text-align="end"/><style:text-properties style:font-name="Arial" fo:font-size="8pt"/></style:style>
|
||||
<style:style style:name="LKCellCenter" style:family="paragraph" style:parent-style-name="LKCell"><style:paragraph-properties fo:text-align="center"/></style:style>
|
||||
<style:style style:name="LKBold" style:family="paragraph" style:parent-style-name="LKCell"><style:text-properties style:font-name="Arial" fo:font-size="8.5pt" fo:font-weight="bold"/></style:style>
|
||||
<style:style style:name="LKBoldRight" style:family="paragraph" style:parent-style-name="LKBold"><style:paragraph-properties fo:text-align="end"/><style:text-properties style:font-name="Arial" fo:font-size="8.5pt" fo:font-weight="bold"/></style:style>
|
||||
<style:style style:name="LKBold" style:family="paragraph" style:parent-style-name="LKCell"><style:text-properties style:font-name="Arial" fo:font-size="8pt" fo:font-weight="bold"/></style:style>
|
||||
<style:style style:name="LKBoldRight" style:family="paragraph" style:parent-style-name="LKBold"><style:paragraph-properties fo:text-align="end"/><style:text-properties style:font-name="Arial" fo:font-size="8pt" fo:font-weight="bold"/></style:style>
|
||||
<style:style style:name="LKSignatureName" style:family="paragraph"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm"/><style:text-properties style:font-name="Arial" fo:font-size="26pt"/></style:style>
|
||||
<style:style style:name="LKSignatureSmall" style:family="paragraph"><style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm"/><style:text-properties style:font-name="Arial" fo:font-size="11pt"/></style:style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user