Skip to content

[14.0][OU-IMP] account: Compute stored function fields by SQL#3626

Merged
pedrobaeza merged 12 commits intoOCA:14.0from
tegin:14.0-imp-account
Mar 31, 2023
Merged

[14.0][OU-IMP] account: Compute stored function fields by SQL#3626
pedrobaeza merged 12 commits intoOCA:14.0from
tegin:14.0-imp-account

Conversation

@etobella
Copy link
Copy Markdown
Member

@etobella etobella commented Nov 23, 2022

When managing files from account.move, account.move.line, account.payment, account.bank.statement or account.bank.statement.line we should always migrate them by SQL, not using the computed function (it could take hours or, even worse, fail for a Memory failure)

Candidate fields

  • account.move
    • sequence_prefix
    • sequence_number
    • payment_state --> Already done on preovious migration
  • account.bank.statement
    • sequence_prefix
    • sequence_number
    • is_valid_balance_start
    • previous_statement_id
  • account.bank.statement.line
    • amount_residual
    • is_reconciled
  • account.move.line
    • matching_number
  • account.payment
    • is_internal_transfer
    • destination_account_id
    • is_matched
    • is_reconciled
    • partner_bank_id
  • account.partial.reconcile
    • credit_currency_id
    • debit_currency_id

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @pedrobaeza, @MiquelRForgeFlow, @StefanRijnhart,
some modules you are maintaining are being modified, check this out!

@etobella etobella force-pushed the 14.0-imp-account branch 12 times, most recently from ae218ba to b6cd773 Compare November 24, 2022 09:50
@MiquelRForgeFlow MiquelRForgeFlow added this to the 14.0 milestone Nov 24, 2022
@MiquelRForgeFlow MiquelRForgeFlow changed the title [OU] account: Compute stored function fields by SQL [14.0][OU] account: Compute stored function fields by SQL Nov 24, 2022
Copy link
Copy Markdown
Member

@chienandalu chienandalu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks for this!

@OCA-git-bot
Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@pedrobaeza pedrobaeza changed the title [14.0][OU] account: Compute stored function fields by SQL [14.0][OU-IMP] account: Compute stored function fields by SQL Mar 31, 2023
- Don't use account_move, as for draft payment, they are not available,
  and anyway, we can extract the needed data from account_journal.
- Perform only 2 queries for destination_account_id instead of 8, and
  also do it more readable.
- It's more expressive and shorter doing JOIN with ON clause.
- is_reconciled flag was not updated.
- Nested CASE for shorting the query and making it more readable.
- Extra: Assign False by default on column creation for avoiding
  NULL/False dualities.
@pedrobaeza pedrobaeza merged commit 9f08c93 into OCA:14.0 Mar 31, 2023
@pedrobaeza pedrobaeza deleted the 14.0-imp-account branch March 31, 2023 22:51
hhgabelgaard added a commit to steingabelgaard/OpenUpgrade that referenced this pull request Nov 14, 2025
It is due to our use of account_move_name_sequence in v15 we are missing these
SQL lifted from OCA#3626
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants