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

[REF] account: Use a global update for each line instead of a update for each field #30979

Closed
wants to merge 1 commit into from

Conversation

moylop260
Copy link
Contributor

@moylop260 moylop260 commented Feb 9, 2019

Running a process to create too many account.move records is spent too much time.

I just get pyflame file and the SVG result is:
https://gist.github.com/moylop260/89e7703cd004485c044959f029af8423

The most consumed method is assigning fields of the method:
_compute_cash_basis

This PR improve this part.

OPW 1938216

@robodoo robodoo added seen 🙂 CI 🤖 Robodoo has seen passing statuses labels Feb 9, 2019
@moylop260
Copy link
Contributor Author

@nim-odoo @mart-e
May I ask you to give a look at this one?

@moylop260
Copy link
Contributor Author

moylop260 commented Feb 11, 2019

Another issue that I found is that the method _compute_matched_percentage has the following depends
api.depends('line_ids.debit', 'line_ids.credit', 'line_ids.matched_debit_ids.amount', 'line_ids.matched_credit_ids.amount', 'line_ids.account_id.user_type_id.type')

@api.depends('line_ids.debit', 'line_ids.credit', 'line_ids.matched_debit_ids.amount', 'line_ids.matched_credit_ids.amount', 'line_ids.account_id.user_type_id.type')
def _compute_matched_percentage(self):

Then, Do if we have added a new account_move_line all lines will be computed again and again?

UPDATE:
Worked from #31007

Copy link
Contributor

@nim-odoo nim-odoo left a comment

Choose a reason for hiding this comment

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

update won't help you there:

odoo/odoo/models.py

Lines 4862 to 4866 in 014d61c

def update(self, values):
""" Update the records in ``self`` with ``values``. """
for record in self:
for name, value in values.items():
record[name] = value

It does exactly what is done in the method.

@moylop260
Copy link
Contributor Author

@moylop260 moylop260 closed this Feb 12, 2019
@robodoo robodoo added closed 💔 and removed CI 🤖 Robodoo has seen passing statuses labels Feb 12, 2019
@moylop260 moylop260 deleted the 11.0-odoo-perf-acc-move-moy branch February 12, 2019 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants