mirror of
https://github.com/NaN-tic/tryton-upgrades.git
synced 2023-12-14 03:32:55 +01:00
In migration_properties.py, ensure the account exists before trying to read it.
This commit is contained in:
parent
96bb186ad1
commit
0388b2b87d
|
@ -86,7 +86,13 @@ with Transaction().start(dbname, 0, context=context):
|
|||
|
||||
if not value:
|
||||
continue
|
||||
a = Account(value)
|
||||
|
||||
# Given property's weak consistency, the account set as default
|
||||
# may no longer exist
|
||||
accounts = Account.search([('id', '=', value)], limit=1)
|
||||
if not accounts:
|
||||
continue
|
||||
a, = accounts
|
||||
print("Account:", field, value, a.code, a.type.receivable, a.type.payable)
|
||||
if 'receivable' in field and not a.type.receivable:
|
||||
a.type.receivable = True
|
||||
|
|
Loading…
Reference in a new issue