From da8849e745675477cc2ee2f4e11e4bf44b1fe319 Mon Sep 17 00:00:00 2001 From: Kev-Roche Date: Mon, 26 Sep 2022 21:48:33 +0200 Subject: [PATCH] [FIX][14.0] Module: sale_stock_usability del picking_status --- sale_stock_usability/models/sale_order.py | 38 ----------------------- sale_stock_usability/views/sale_order.xml | 31 ------------------ 2 files changed, 69 deletions(-) diff --git a/sale_stock_usability/models/sale_order.py b/sale_stock_usability/models/sale_order.py index 0e59dd2..4260023 100644 --- a/sale_stock_usability/models/sale_order.py +++ b/sale_stock_usability/models/sale_order.py @@ -11,44 +11,6 @@ class SaleOrder(models.Model): warehouse_id = fields.Many2one(tracking=True) incoterm = fields.Many2one(tracking=True) - picking_status = fields.Selection([ - ('delivered', 'Fully Delivered'), - ('partially_delivered', 'Partially Delivered'), - ('to_deliver', 'To Deliver'), - ('cancel', 'Delivery Cancelled'), - ('no', 'Nothing to Deliver') - ], string='Picking Status', compute='_compute_picking_status', - store=True) - - @api.depends('state', 'picking_ids.state') - def _compute_picking_status(self): - """ - Compute the picking status for the SO. Possible statuses: - - no: if the SO is not in status 'sale' nor 'done', we consider that - there is nothing to deliver. This is also the default value if the - conditions of no other status is met. - - cancel: all pickings are cancelled - - delivered: if all pickings are done or cancel. - - partially_delivered: If at least one picking is done. - - to_deliver: if all pickings are in confirmed, assigned, waiting or - cancel state. - """ - for order in self: - picking_status = 'no' - if order.state in ('sale', 'done') and order.picking_ids: - pstates = [ - picking.state for picking in order.picking_ids] - if all([state == 'cancel' for state in pstates]): - picking_status = 'cancel' - elif all([state in ('done', 'cancel') for state in pstates]): - picking_status = 'delivered' - elif any([state == 'done' for state in pstates]): - picking_status = 'partially_delivered' - elif all([ - state in ('confirmed', 'assigned', 'waiting', 'cancel') - for state in pstates]): - picking_status = 'to_deliver' - order.picking_status = picking_status def report_qty_to_deliver(self): # Can be useful for delivery report diff --git a/sale_stock_usability/views/sale_order.xml b/sale_stock_usability/views/sale_order.xml index 20405d9..97125b2 100644 --- a/sale_stock_usability/views/sale_order.xml +++ b/sale_stock_usability/views/sale_order.xml @@ -12,41 +12,10 @@ sale.order - - - - - - sale_stock_usability.order.tree - sale.order - - - - - - - - - - sale_stock_usability.order.search - sale.order - - - - - - - - - - -