From 04e5eff3252f8a76ce24d44e5b8d06e8b15eb897 Mon Sep 17 00:00:00 2001 From: prye-odoo Date: Mon, 30 Oct 2023 17:48:08 +0530 Subject: [PATCH] [FIX] point_of_sale: prevent traceback while uninstalling module When users try to uninstall the "point_of_sale", a traceback will be generated. Error: TypeError: uninstall_hook() missing 1 required positional argument: 'registry' This is because the https://github.com/odoo/odoo/pull/138189 added the unistallhook from 16, but in the forword port of this PR, it did not change the argument list according to the new unistall hook from saas-16.2. This commit fixes the above issue by passing a valid argument in the unistill hook. code reference: https://github.com/odoo/odoo/blob/saas-16.2/addons/point_of_sale/__init__.py#L11 sentry-4586084597 closes odoo/odoo#140591 X-original-commit: 9eda662a89943f3c6725e223bf30238ef8e661f2 Signed-off-by: Vlad Stroia (vlst) Signed-off-by: Pradip Yenpure (prye) --- addons/point_of_sale/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/point_of_sale/__init__.py b/addons/point_of_sale/__init__.py index ee1ebcbaa51..4f95dadf8ce 100644 --- a/addons/point_of_sale/__init__.py +++ b/addons/point_of_sale/__init__.py @@ -6,9 +6,7 @@ from . import controllers from . import report from . import wizard -from odoo import api, SUPERUSER_ID -def uninstall_hook(cr, registry): - env = api.Environment(cr, SUPERUSER_ID, {}) +def uninstall_hook(env): #The search domain is based on how the sequence is defined in the _get_sequence_values method in /addons/point_of_sale/models/stock_warehouse.py env['ir.sequence'].search([('name', 'ilike', '%Picking POS%'), ('prefix', 'ilike', '%/POS/%')]).unlink()