Skip to content

Conversation

@dannyadair
Copy link
Contributor

Add columns to avoid MemoryError on an existing Odoo instance with lots of data.

payment_order_ok on account.move is computed from payment_order_ok on account.payment.mode which are both introduced by this module, so nothing to compute.
(see AccountMove._compute_payment_order_ok() in models/account_move.py)

partner_bank_id on account.move.line requires payment_order_ok to be True which it won't be as it's newly introduced - again nothing to compute. (see AccountMoveLine._compute_partner_bank_id() in models/account_move_line.py)

Add columns to avoid MemoryError on an existing Odoo instance
with lots of data.

payment_order_ok on account.move is computed from payment_order_ok
on account.payment.mode which are both introduced by this module,
so nothing to compute.
(see AccountMove._compute_payment_order_ok() in models/account_move.py)

partner_bank_id on account.move.line requires payment_order_ok to be True
which it won't be as it's newly introduced - again nothing to compute.
(see AccountMoveLine._compute_partner_bank_id() in models/account_move_line.py)
@dannyadair dannyadair changed the title Add pre_init_hook to add computed columns [14.0] account_payment_order: Add pre_init_hook to add computed columns Jan 20, 2023
@pedrobaeza pedrobaeza added this to the 14.0 milestone Jan 20, 2023
@pedrobaeza
Copy link
Member

payment_order_ok is a computed non-stored field, so you don't have to create the column.

partner_bank_id is OK to be pre-created.

@dannyadair
Copy link
Contributor Author

@pedrobaeza Thank you very much for the quick review! I've adjusted the hook accordingly.

Copy link

@dalonsod dalonsod left a comment

Choose a reason for hiding this comment

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

LGTM

@pedrobaeza
Copy link
Member

/ocabot merge patch

Can you fw-port it to 15?

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 14.0-ocabot-merge-pr-1022-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 3db9bd9 into OCA:14.0 Feb 10, 2023
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 24a35a0. Thanks a lot for contributing to OCA. ❤️

@dannyadair
Copy link
Contributor Author

/ocabot merge patch

Can you fw-port it to 15?

Submitted #1047

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.

4 participants