-
-
Notifications
You must be signed in to change notification settings - Fork 669
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1727 from Eficent/12.0-mig-account_voucher
[12.0][MIG] account_voucher
- Loading branch information
Showing
3 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
addons/account_voucher/migrations/12.0.1.0/openupgrade_analysis_work.txt
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,15 @@ | ||
---Fields in module 'account_voucher'--- | ||
account_voucher / account.voucher / company_id (many2one) : is now stored | ||
account_voucher / account.voucher / currency_id (many2one) : is now stored | ||
account_voucher / account.voucher / message_last_post (datetime) : DEL | ||
account_voucher / account.voucher / message_main_attachment_id (many2one): NEW relation: ir.attachment | ||
# NOTHING TO DO | ||
|
||
account_voucher / account.voucher / payment_journal_id (many2one) : not a function anymore | ||
account_voucher / account.voucher / payment_journal_id (many2one) : is now stored | ||
# DONE: post-migration: filled if not is in 'draft' state because now this field is stored, so we need to find the correct journal used previously in the payment created | ||
|
||
account_voucher / account.voucher.line / analytic_tag_ids (many2many) : NEW relation: account.analytic.tag | ||
# NOTHING TO DO: new feature | ||
|
||
---XML records in module 'account_voucher'--- |
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,25 @@ | ||
# Copyright 2019 Eficent <http://www.eficent.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from openupgradelib import openupgrade | ||
|
||
|
||
def fill_account_voucher_payment_journal_id(cr): | ||
openupgrade.logged_query( | ||
cr, """ | ||
UPDATE account_voucher av | ||
SET payment_journal_id = ap.journal_id | ||
FROM account_payment ap | ||
INNER JOIN account_journal aj ON aj.id = ap.journal_id | ||
WHERE av.state != 'draft' AND av.pay_now = 'pay_now' | ||
AND ap.communication = av.name AND av.amount > 0 | ||
AND ap.amount = av.amount AND ap.payment_date = av.date | ||
AND ap.currency_id = av.currency_id | ||
AND aj.type IN ('cash', 'bank') | ||
AND av.payment_journal_id IS NULL | ||
""" | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
fill_account_voucher_payment_journal_id(env.cr) |
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