From b2456c9c70d059baad14103d2691b8c51d752263 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 6 Oct 2025 11:59:20 +0700 Subject: cleansing useless sale order --- fixco_custom/models/sale.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fixco_custom/models/sale.py b/fixco_custom/models/sale.py index c6e9ccb..6912796 100755 --- a/fixco_custom/models/sale.py +++ b/fixco_custom/models/sale.py @@ -194,4 +194,13 @@ class SaleOrder(models.Model): for order in self: order._check_duplicate_order_id() res = super(SaleOrder, self).action_confirm() - return res \ No newline at end of file + return res + + def _clean_sale_order(self): + orders = self.env['sale.order'].search([ + ('invoice_status', '=', 'no'), + ('state', '=', ['draft', 'sale']) + ], limit=2000) + for order in orders: + print("cancel sales or draft "+order.name) + order.action_cancel() -- cgit v1.2.3