[FIX] point_of_sale: correctly delete sequences when uninstalling PoS
Current behavior: After uninstalling the PoS module, if you try to install it again, you get a traceback because Odoo is trying to create a sequence that already exists. Steps to reproduce: - install PoS - uninstall PoS - install PoS - you get a traceback opw-3515647 closes odoo/odoo#139767 X-original-commit: c57bb574721a3610f66320dacdc703abc490d5d4 Signed-off-by: Vlad Stroia (vlst) <vlst@odoo.com> Signed-off-by: Robin Engels (roen) <roen@odoo.com>
This commit is contained in:
@@ -5,3 +5,10 @@ from . import models
|
||||
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, {})
|
||||
#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()
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
'sequence': 40,
|
||||
'summary': 'User-friendly PoS interface for shops and restaurants',
|
||||
'depends': ['stock_account', 'barcodes', 'web_editor', 'digest'],
|
||||
'uninstall_hook': 'uninstall_hook',
|
||||
'data': [
|
||||
'security/point_of_sale_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
|
||||
Reference in New Issue
Block a user