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

account_invoice_pricelist install into existing database takes excessive time #1508

Open
gdgellatly opened this issue Jul 13, 2023 · 5 comments
Labels

Comments

@gdgellatly
Copy link

gdgellatly commented Jul 13, 2023

Module

account_invoice_pricelist

Describe the bug

Install of account invoice pricelist takes a very very long time on an existing database.

To Reproduce

Affected versions:
16.0 - likely only v16 as that is where tracking was added

Steps to reproduce the behavior:

  1. Install module into existing database - install logs
2023-07-13 07:09:35,689 1 INFO mig odoo.modules.registry: module account_invoice_pricelist: creating or updating database tables 
2023-07-13 07:09:35,696 1 DEBUG mig odoo.schema: Table 'account_move': added column 'pricelist_id' of type int4 
2023-07-13 07:09:36,938 1 INFO mig odoo.models: Prepare computation of account.move.pricelist_id 
2023-07-13 07:17:03,625 1 DEBUG mig odoo.schema: Table 'account_move': added foreign key 'pricelist_id' references 'product_pricelist'('id') ON DELETE set null 
2023-07-13 07:17:05,088 1 INFO mig odoo.modules.loading: loading account_invoice_pricelist/views/account_invoice_view.xml 

Here we see the computation of pricelist id takes 8 mins. That is OK. I am writing this at 8:12, and it just completed. What it is is the tracking attribute of the pricelist id.

IN pg_activity we see a lot of entries

       1197 | INSERT INTO "mail_tracking_value" ("create_date", "create_uid", "field", "field_desc", "field_type", "mail_message_id", "new_value_char", "new_value_integer", "old_value_char", "old_value_integer", "tracking_sequence", "write_date", "write_uid") VALUES ('2023-07-13 07:0
9:35.381815', 1, 31160, 'Pricelist', 'many2one', 25129393, 'Retail Pricelist (NZD)', 1, '', 0, 100, '2023-07-13 07:09:35.381815', 1) RETURNING "id"

and

INSERT INTO "mail_message" ("author_id", "body", "create_date", "create_uid", "date", "email_add_signature", "email_from", "is_internal", "message_id", "message_type", "model", "record_name", "reply_to", "res_id", "subject", "subtype_id", "write_date", "write_uid") VALU
ES (2, '', '2023-07-13 07:09:35.381815', 1, '2023-07-13 08:06:26', false, '"X" <auto@localhost>', true, '<751558500365470.1689235586.792078018188477-openerp-message-notify@cd53b85615af>', 'notification', 'account.move', NULL, '"X" <catchall@localhost>', 469036
5, NULL, 2, '2023-07-13 07:09:35.381815', 1) RETURNING "id"

Expected behavior
A sub 1 hour installation time. The question is how to approach - pre-init hook? Remove tracking? Somehow suspend tracking?

Additional context
There isn't actually that many outwards invoices on this database, 530,000.

@gdgellatly gdgellatly added the bug label Jul 13, 2023
@gdgellatly gdgellatly changed the title account_invoice_pricelist install into existing database account_invoice_pricelist install into existing database takes excessive time Jul 13, 2023
@legalsylvain
Copy link
Contributor

Hi @gdgellatly. I don't see tracked field in this module. https://github.com/OCA/account-invoicing/blob/15.0/account_invoice_pricelist/models/account_move.py
Did i missed something ?

@gdgellatly
Copy link
Author

gdgellatly commented Jul 13, 2023

Thanks @legalsylvain Only the version number :)

@legalsylvain
Copy link
Contributor

Thanks @legalsylvain Only the version number :)

sorry, missed the version !

@legalsylvain
Copy link
Contributor

A sub 1 hour installation time. The question is how to approach - pre-init hook? Remove tracking? Somehow suspend tracking?

IMO, disable tracking make sense. Traking allow to know when the value changed. For a new computed field, having the date of the installation of the module for all the records is totally useless.
maybe some pseudo code my_field._tracking=False in the pre-init hook could do the job. (then =True) at the end of the computation.

@gdgellatly
Copy link
Author

Best I could come up with - I don't really need this now, installed with tracking disabled before writing #1511

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants