Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efdfef7
commit e242654
Showing
4 changed files
with
32 additions
and
34 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
account_banking_mandate/migrations/14.0.1.0.0/post-migrate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright 2020 Opener B.V. - Stefan Rijnhart <stefan@opener.amsterdam> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
import logging | ||
|
||
from odoo.tools.sql import column_exists | ||
|
||
|
||
def migrate(cr, version): | ||
logger = logging.getLogger( | ||
"odoo.addons.account_banking_mandate.migrations.14.0.1.0.0" | ||
) | ||
if not column_exists(cr, "account_move_line", "mandate_id"): | ||
logger.warning( | ||
"Column account_move_line.mandate_id not found when " | ||
"populating account_move.mandate_id" | ||
) | ||
return | ||
logger.info( | ||
"Populating account_move.mandate_id from obsolete " | ||
"account_move_line.mandate_id" | ||
) | ||
cr.execute( | ||
""" | ||
UPDATE account_move am | ||
SET mandate_id = aml.mandate_id | ||
FROM account_move_line aml | ||
WHERE aml.mandate_id IS NOT NULL | ||
AND am.mandate_id IS NULL | ||
""" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.