File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
openupgrade_scripts/scripts/point_of_sale/15.0.1.0.1 Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ # Copyright 2025 Tecnativa
2+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
3+ from openupgradelib import openupgrade
4+
5+
6+ def _update_pos_payment_method_journal (env ):
7+ """From now on, a journal is required when the transactions aren't splitted. If we
8+ don't set a journal in these cases, the session closing won't be made properly for
9+ these methods. Cash payment methos already had a jornal set, but bank ones didn't."""
10+ payment_methods = env ["pos.payment.method" ].search (
11+ [
12+ ("journal_id" , "=" , False ),
13+ ("split_transactions" , "=" , False ),
14+ ("type" , "=" , "bank" ),
15+ ]
16+ )
17+ for method in payment_methods :
18+ method .journal_id = env ["account.journal" ].create (
19+ {
20+ "type" : "bank" ,
21+ "name" : f"[openupgrade] Journal for { method .name } " ,
22+ "code" : "POS_BANK" ,
23+ "company_id" : method .company_id .id ,
24+ "sequence" : 99 ,
25+ }
26+ )
27+
28+
29+ @openupgrade .migrate ()
30+ def migrate (env , version ):
31+ _update_pos_payment_method_journal (env )
You can’t perform that action at this time.
0 commit comments