Giter Site home page Giter Site logo

Comments (5)

pedrobaeza avatar pedrobaeza commented on August 19, 2024

Have you tried to put that part in SQL to see if the time is reduced?

from account-financial-reporting.

laetitia-gangloff avatar laetitia-gangloff commented on August 19, 2024

Yes, I tried with the following method (instead of the existing one, easy-ugly fix) and the time is reduced (quasi immediate) :

    def _get_move_ids_from_periods(self, account_id, period_start, period_stop,
                                   target_move):
        period_obj = self.pool.get('account.period')
        periods = period_obj.build_ctx_periods(
            self.cursor, self.uid, period_start.id, period_stop.id)
        if not periods:
            return []
        move_state = ['draft', 'posted']
        if target_move == 'posted':
            move_state = ['posted', '']
        #return move_line_obj.search(self.cursor, self.uid, search)
        sql = """select aml.id
                 from account_move_line aml
                      LEFT JOIN account_move am ON (am.id = aml.move_id)
                 where aml.period_id in %s
                 and aml.account_id = %s
                 and am.state IN %s
        """
        self.cursor.execute(sql, (tuple(periods), account_id,
                                  tuple(move_state)))
        res = self.cursor.fetchall()
        return res

from account-financial-reporting.

laetitia-gangloff avatar laetitia-gangloff commented on August 19, 2024

I also tried to set auto_join=True on the column move_id of account.move.line and the result is also quasi immediate.

from account-financial-reporting.

laetitia-gangloff avatar laetitia-gangloff commented on August 19, 2024

I proposed the following PR to odoo (to add auto_join):
odoo/odoo#5573

from account-financial-reporting.

laetitia-gangloff avatar laetitia-gangloff commented on August 19, 2024

PR is closed, so I closed this issue.

from account-financial-reporting.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.