From 93c038592d9e749b76ad59a6a628995c42761de7 Mon Sep 17 00:00:00 2001 From: Jose Zambudio Date: Fri, 22 Sep 2023 07:52:24 +0200 Subject: [PATCH] [Openupgrade] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - [FIX] *** TypeError: expected string or bytes-like object - [ADD] force-requirements.txt - fichero con dependencias python que se instalarán en último lugar - addons/point_of_sale/migrations/13.0.1.0.1/end-migration.py - Controlamos métodos de pago en pagos que ya no están permitidos en la config del TPV --- .../migrations/13.0.1.0.1/end-migration.py | 12 ++++++++++++ addons/stock/migrations/13.0.1.1/post-migration.py | 2 +- force-requirements.txt | 5 +++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 force-requirements.txt diff --git a/addons/point_of_sale/migrations/13.0.1.0.1/end-migration.py b/addons/point_of_sale/migrations/13.0.1.0.1/end-migration.py index 3168c6f5b522..1cbd9cca49a0 100644 --- a/addons/point_of_sale/migrations/13.0.1.0.1/end-migration.py +++ b/addons/point_of_sale/migrations/13.0.1.0.1/end-migration.py @@ -64,6 +64,7 @@ def create_pos_payment_methods(env): def create_pos_payments(env): + tmp_pos_config_payment_methods = {} env.cr.execute(""" SELECT DISTINCT absl.id, ppm.id, absl.pos_statement_id, absl.name, absl.amount, absl.create_date @@ -86,6 +87,14 @@ def create_pos_payments(env): 'payment_date': st_line[5], } vals_list += [vals] + # Hay clientes con métodos de pagos que ya no están permitidos + # los añadimos y posteriormente los eliminamos. + payment_method = env["pos.payment.method"].browse(st_line[1]) + config = env["pos.order"].browse(st_line[2]).session_id.config_id + if payment_method not in config.payment_method_ids: + config.payment_method_ids |= payment_method + tmp_pos_config_payment_methods.setdefault(config, payment_method) + tmp_pos_config_payment_methods[config] |= payment_method env['pos.payment'].create(vals_list) # We need to delete all the lines from sessions not validated in order to not # disturb validation @@ -106,6 +115,9 @@ def create_pos_payments(env): env["account.bank.statement"].search( [("pos_session_id.state", "!=", "closed")] )._end_balance() + # Borramos los métodos de pago que ya no están permitidos + for config, payment_methods in tmp_pos_config_payment_methods.items(): + config.payment_method_ids -= payment_methods def fill_stock_warehouse_pos_type_id(env): diff --git a/addons/stock/migrations/13.0.1.1/post-migration.py b/addons/stock/migrations/13.0.1.1/post-migration.py index 12d0f60f8833..0b3bd8a5f84c 100644 --- a/addons/stock/migrations/13.0.1.1/post-migration.py +++ b/addons/stock/migrations/13.0.1.1/post-migration.py @@ -191,7 +191,7 @@ def fill_stock_picking_type_sequence_code(env): spt_seq_codes = [] for picking_type in picking_types: prefix = picking_type.sequence_id.prefix - if picking_type.warehouse_id: + if picking_type.warehouse_id and prefix: groups = re.findall(r"(.*)\/(.*)\/", prefix) if groups and len(groups[0]) == 2: spt_seq_codes += [(picking_type.id, groups[0][1])] diff --git a/force-requirements.txt b/force-requirements.txt new file mode 100644 index 000000000000..5a7715898219 --- /dev/null +++ b/force-requirements.txt @@ -0,0 +1,5 @@ +# Needed for OpenUpgrade +odoorpc==0.7.0 +openupgradelib +# PngStream' object has no attribute 'chunk_eXIf' +Pillow==6.1.0