summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models')
-rw-r--r--indoteknik_custom/models/stock_picking.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 6be532b5..fb17d142 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -10,6 +10,10 @@ class StockPicking(models.Model):
is_efaktur_exported = fields.Boolean(string='Is eFaktur Exported')
date_efaktur_exported = fields.Datetime(string='eFaktur Exported Date')
delivery_status = fields.Char(string='Delivery Status', compute='compute_delivery_status', readonly=True)
+ summary_qty_detail = fields.Float('Total Qty Detail', compute='_compute_summary_qty')
+ summary_qty_operation = fields.Float('Total Qty Operation', compute='_compute_summary_qty')
+ count_line_detail = fields.Float('Total Item Detail', compute='_compute_summary_qty')
+ count_line_operation = fields.Float('Total Item Operation', compute='_compute_summary_qty')
# Delivery Order
driver_departure_date = fields.Datetime(
@@ -39,6 +43,20 @@ class StockPicking(models.Model):
copy=False
)
+ def _compute_summary_qty(self):
+ sum_qty_detail = sum_qty_operation = count_line_detail = count_line_operation = 0
+ for picking in self:
+ for detail in picking.move_line_ids_without_package: # detailed operations
+ sum_qty_detail += detail.qty_done
+ count_line_detail += 1
+ for operation in picking.move_ids_without_package: # operations
+ sum_qty_operation += operation.product_uom_qty
+ count_line_operation += 1
+ picking.summary_qty_detail = sum_qty_detail
+ picking.count_line_detail = count_line_detail
+ picking.summary_qty_operation = sum_qty_operation
+ picking.count_line_operation = count_line_operation
+
@api.onchange('picking_type_id')
def _onchange_operation_type(self):
self.is_internal_use = self.picking_type_id.is_internal_use