Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13.0][FIX] l10n_es_vat_book: Check if column invoice_id exists in account_move_line #3696

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions l10n_es_vat_book/migrations/13.0.1.0.0/pre-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@

def link_invoices(cr):
_logger.info("vat book: adding relation to account move")
if not openupgrade.column_exists(cr, "account_move_line", "invoice_id"):
return
cr.execute(
"""
UPDATE l10n_es_vat_book_line vbl0
SET move_id = am.id
FROM l10n_es_vat_book_line vbl
INNER JOIN account_invoice ai ON vbl.invoice_id = ai.id
INNER JOIN account_move_line aml ON aml.invoice_id = ai.id
INNER JOIN account_move am ON aml.move_id = am.id
WHERE vbl.id = vbl0.id
"""
UPDATE l10n_es_vat_book_line vbl0
SET move_id = am.id
FROM l10n_es_vat_book_line vbl
INNER JOIN account_invoice ai ON vbl.invoice_id = ai.id
INNER JOIN account_move_line aml ON aml.invoice_id = ai.id
INNER JOIN account_move am ON aml.move_id = am.id
WHERE vbl.id = vbl0.id
"""
)


Expand Down
Loading