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

[11.0] account_asset: Do not loop on all the lines to search for one linked asset #838

Closed

Conversation

Projects
None yet
8 participants
@grindtildeath
Copy link
Contributor

commented Jun 3, 2019

Before this change, the use of mapped on self did loop on all the move
lines that are included in self to get the assets, what could be very
costly for a simple write on a lot of move lines. As the goal is to raise
an error only if at least one move is linked to an asset, we break the
loop if the condition is fulfilled.

@pedrobaeza pedrobaeza added this to the 11.0 milestone Jun 3, 2019

@astirpe

This comment has been minimized.

Copy link
Member

commented Jun 3, 2019

Travis error:

   File "/home/travis/build/OCA/account-financial-tools/account_asset_management/models/account_move.py", line 124, in write
     linked_asset and
 UnboundLocalError: local variable 'linked_asset' referenced before assignment

@luc-demeyer

This comment has been minimized.

Copy link
Contributor

commented Jun 3, 2019

@grindtildeath
cf. my PR on top of your PR (grindtildeath#2) for further performance improvement.

@sebalix

sebalix approved these changes Jun 4, 2019

Copy link

left a comment

@grindtildeath please rebase your fixup

@OCA-git-bot OCA-git-bot added the approved label Jun 4, 2019

@guewen

guewen approved these changes Jun 4, 2019

grindtildeath and others added some commits Jun 3, 2019

account_asset: Do not loop on all the lines to search for one linked …
…asset

Before this change, the use of `mapped` on self did loop on all the move
lines that are included in self to get the assets, what could be very
costly for a simple write on a lot of move lines. As the goal is to raise
an error only if at least one move is linked to an asset, we break the
loop if the condition is fulfilled.

@grindtildeath grindtildeath force-pushed the grindtildeath:11.0_imp_asset_move_write branch from 6bb8b70 to 848f886 Jun 4, 2019

@sbidoul

This comment has been minimized.

Copy link
Member

commented Jun 19, 2019

/ocabot merge patch

@OCA-git-bot

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2019

Rebased to 11.0-ocabot-merge-pr-838-by-sbidoul-bump-patch, awaiting test results.

@OCA-git-bot

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2019

Merged at d5d9f70. Don't worry if GitHub says there are unmerged commits: it is due to a rebase before merge. All commits of this PR have been merged on the main branch.

OCA-git-bot added a commit that referenced this pull request Jun 19, 2019

Merge PR #838 into 11.0
Signed-off-by sbidoul
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.