Leonardo, thanks for the review. For your questions:
1. yes, that field needs to be stored. The initial commit mentions that a sum of the lines is used in a groupby view, which is the default view for budget lines, coming from a project. 2. I think the optimal solution would be to retrieve all the analytic accounts and then do a search [('analytic_account_id', 'in', <list of account ids>)]; we could even do it in SQL, with DISTINCT, to avoid duplicates and speed up a bit. I'll see what I can do. > I wonder if that trigger would impact performance. > > As the code stands, a trigger like that does a search for every analytic line > we write. If we write 1000 analytic lines, same analytic account, we get 1000 > queries. > > This raises a few questions: > > 1. Do we actually need to store this field? > > 2. If we do, maybe it would be faster to fetch the analytic accounts of the > lines in a set, and then using the one2many field budget_line_ids in analytic > account instead of a search. > > Thanks! -- https://code.launchpad.net/~camptocamp/account-budgeting/7.0-fix-store-fields-mdh/+merge/216849 Your team Account Core Editors is requested to review the proposed merge of lp:~camptocamp/account-budgeting/7.0-fix-store-fields-mdh into lp:account-budgeting. -- Mailing list: https://launchpad.net/~openerp-community-reviewer Post to : openerp-community-reviewer@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-community-reviewer More help : https://help.launchpad.net/ListHelp