Skip to content

Commit

Permalink
[Openupgrade]
Browse files Browse the repository at this point in the history
 - [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
  • Loading branch information
zamberjo authored and docker-odoo committed Feb 26, 2024
1 parent 170c360 commit 4d79585
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
12 changes: 12 additions & 0 deletions addons/point_of_sale/migrations/13.0.1.0.1/end-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion addons/stock/migrations/13.0.1.1/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,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])]
Expand Down
5 changes: 5 additions & 0 deletions force-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Needed for OpenUpgrade
odoorpc==0.7.0
openupgradelib
# PngStream' object has no attribute 'chunk_eXIf'
Pillow==6.1.0

0 comments on commit 4d79585

Please sign in to comment.