From 4ea701d6692c93b9738d9c8e4f17f460151c801f Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Tue, 7 Jul 2026 15:58:59 +0200 Subject: [PATCH] Linkage report --- modules/purchase_trade/__init__.py | 9 +++++---- modules/purchase_trade/configuration.py | 4 ++++ modules/purchase_trade/stock.py | 9 +++++++++ modules/purchase_trade/stock.xml | 20 +++++++++++++++---- modules/purchase_trade/tests/test_module.py | 13 ++++++++++++ .../view/template_configuration_form.xml | 4 ++++ 6 files changed, 51 insertions(+), 8 deletions(-) diff --git a/modules/purchase_trade/__init__.py b/modules/purchase_trade/__init__.py index 22acbd7..b4be175 100755 --- a/modules/purchase_trade/__init__.py +++ b/modules/purchase_trade/__init__.py @@ -359,8 +359,9 @@ def register(): invoice.SaleReport, invoice.PurchaseReport, stock.ShipmentShippingReport, - stock.ShipmentInsuranceReport, - stock.ShipmentCOOReport, - stock.ShipmentPackingListReport, - module='purchase_trade', type_='report') + stock.ShipmentInsuranceReport, + stock.ShipmentCOOReport, + stock.ShipmentPackingListReport, + stock.ShipmentLinkageReport, + module='purchase_trade', type_='report') diff --git a/modules/purchase_trade/configuration.py b/modules/purchase_trade/configuration.py index ce40808..1f7bf7d 100644 --- a/modules/purchase_trade/configuration.py +++ b/modules/purchase_trade/configuration.py @@ -109,6 +109,8 @@ class Configuration(ModelSingleton, ModelSQL, ModelView): 'report_shipment_in_coo', 'COO'), ('shipment_packing_list_report_label', 'purchase_trade', 'report_shipment_in_packing_list', 'Packing List'), + ('shipment_linkage_report_label', 'purchase_trade', + 'report_shipment_in_linkage', 'Linkage'), ) _COFFEE_MENU_XML_IDS = ( 'menu_coffee_purchase', @@ -169,6 +171,8 @@ class Configuration(ModelSingleton, ModelSQL, ModelView): shipment_packing_list_report_template = fields.Char("Packing List Template") shipment_packing_list_report_label = fields.Char( "Packing List Menu Label") + shipment_linkage_report_template = fields.Char("Linkage Template") + shipment_linkage_report_label = fields.Char("Linkage Menu Label") @classmethod def __register__(cls, module_name): diff --git a/modules/purchase_trade/stock.py b/modules/purchase_trade/stock.py index 5a30df9..f4714fc 100755 --- a/modules/purchase_trade/stock.py +++ b/modules/purchase_trade/stock.py @@ -4168,6 +4168,15 @@ class ShipmentPackingListReport(ShipmentTemplateReportMixin, BaseSupplierShippin 'shipment_packing_list_report_template', 'stock') +class ShipmentLinkageReport(ShipmentTemplateReportMixin, BaseSupplierShipping): + __name__ = 'stock.shipment.in.linkage' + + @classmethod + def _resolve_configured_report_path(cls, action): + return cls._resolve_template_path( + 'shipment_linkage_report_template', 'stock') + + class ShipmentCOOReport(ShipmentTemplateReportMixin, BaseSupplierShipping): __name__ = 'stock.shipment.in.coo' diff --git a/modules/purchase_trade/stock.xml b/modules/purchase_trade/stock.xml index 6eb6de4..29cab59 100755 --- a/modules/purchase_trade/stock.xml +++ b/modules/purchase_trade/stock.xml @@ -247,10 +247,22 @@ this repository contains the full copyright notices and license terms. --> stock.shipment.in,-1 - - - Update with SoF PDF - sof.update + + + Linkage + stock.shipment.in + stock.shipment.in.linkage + stock/linkage.fodt + + + form_print + stock.shipment.in,-1 + + + + + Update with SoF PDF + sof.update stock.shipment.in diff --git a/modules/purchase_trade/tests/test_module.py b/modules/purchase_trade/tests/test_module.py index b43281d..fbec6ef 100644 --- a/modules/purchase_trade/tests/test_module.py +++ b/modules/purchase_trade/tests/test_module.py @@ -6174,6 +6174,7 @@ class PurchaseTradeTestCase(ModuleTestCase): insurance_report = Pool().get('stock.shipment.in.insurance', type='report') coo_report = Pool().get('stock.shipment.in.coo', type='report') packing_report = Pool().get('stock.shipment.in.packing_list', type='report') + linkage_report = Pool().get('stock.shipment.in.linkage', type='report') config_model = Mock() config_model.search.return_value = [ Mock( @@ -6181,6 +6182,7 @@ class PurchaseTradeTestCase(ModuleTestCase): shipment_insurance_report_template='insurance_custom.fodt', shipment_coo_report_template='coo_custom.fodt', shipment_packing_list_report_template='packing_list_custom.fodt', + shipment_linkage_report_template='linkage_custom.fodt', ) ] @@ -6213,6 +6215,12 @@ class PurchaseTradeTestCase(ModuleTestCase): 'report': 'stock/packing_list.fodt', }), 'stock/packing_list_custom.fodt') + self.assertEqual( + linkage_report._resolve_configured_report_path({ + 'name': 'Linkage', + 'report': 'stock/linkage.fodt', + }), + 'stock/linkage_custom.fodt') def test_configuration_syncs_report_menu_labels(self): 'document template configuration updates report menu labels' @@ -6230,6 +6238,7 @@ class PurchaseTradeTestCase(ModuleTestCase): shipment_insurance_report_label='', shipment_coo_report_label='Certificate of Origin', shipment_packing_list_report_label='', + shipment_linkage_report_label='Linkage Summary', ) action_sale = Mock(spec=['name']) action_sale.name = 'Proforma' @@ -6255,6 +6264,8 @@ class PurchaseTradeTestCase(ModuleTestCase): action_coo.name = 'COO' action_packing = Mock(spec=['name']) action_packing.name = 'Packing List' + action_linkage = Mock(spec=['name']) + action_linkage.name = 'Linkage' actions = { 1: action_sale, 2: action_bill, @@ -6268,6 +6279,7 @@ class PurchaseTradeTestCase(ModuleTestCase): 10: action_insurance, 11: action_coo, 12: action_packing, + 13: action_linkage, } model_data = Mock() @@ -6296,6 +6308,7 @@ class PurchaseTradeTestCase(ModuleTestCase): [actions[7]], {'name': 'Packing Slip'}, [actions[6]], {'name': 'Wire Order'}, [actions[11]], {'name': 'Certificate of Origin'}, + [actions[13]], {'name': 'Linkage Summary'}, )) def test_shipment_insurance_helpers_use_fee_and_controller(self): diff --git a/modules/purchase_trade/view/template_configuration_form.xml b/modules/purchase_trade/view/template_configuration_form.xml index 1c4fb9a..6edc210 100644 --- a/modules/purchase_trade/view/template_configuration_form.xml +++ b/modules/purchase_trade/view/template_configuration_form.xml @@ -71,4 +71,8 @@