From fe9056c55bc206a02e52b58baf1881271cf098f8 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Mon, 22 Dec 2025 13:37:48 +0700 Subject: count line in Shipment group --- fixco_custom/models/shipment_group.py | 6 ++++++ fixco_custom/views/shipment_group.xml | 24 +++++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/fixco_custom/models/shipment_group.py b/fixco_custom/models/shipment_group.py index aba77f5..3cdba5b 100644 --- a/fixco_custom/models/shipment_group.py +++ b/fixco_custom/models/shipment_group.py @@ -35,6 +35,12 @@ class ShipmentGroup(models.Model): picking_lines = fields.One2many('picking.line', 'shipment_id', string='Picking Lines', auto_join=True) related_count = fields.Integer(compute='_compute_related_count', string='Related Count') receipt = fields.Char(string='Receipt', related='picking_lines.scan_receipt') + total_line = fields.Integer(string='Total Line', compute='_compute_total_line') + + @api.depends('picking_lines') + def _compute_total_line(self): + for rec in self: + rec.total_line = len(rec.picking_lines) def sync_product_to_picking_line(self): for shipment in self: diff --git a/fixco_custom/views/shipment_group.xml b/fixco_custom/views/shipment_group.xml index 3edc432..4aae314 100644 --- a/fixco_custom/views/shipment_group.xml +++ b/fixco_custom/views/shipment_group.xml @@ -6,6 +6,7 @@ + @@ -16,15 +17,15 @@
-
@@ -38,6 +39,7 @@ + @@ -51,7 +53,7 @@ - + @@ -62,7 +64,7 @@ - + @@ -83,7 +85,7 @@ - + Shipment Group -- cgit v1.2.3