diff --git a/account_financial_report_qweb/__openerp__.py b/account_financial_report_qweb/__openerp__.py index 4443bdc8..97ba3ed2 100644 --- a/account_financial_report_qweb/__openerp__.py +++ b/account_financial_report_qweb/__openerp__.py @@ -5,7 +5,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'QWeb Financial Reports', - 'version': '9.0.1.0.3', + 'version': '9.0.1.0.4', 'category': 'Reporting', 'summary': 'OCA Financial Reports', 'author': 'Camptocamp SA,' diff --git a/account_financial_report_qweb/report/__init__.py b/account_financial_report_qweb/report/__init__.py index fb0e633c..d3746c0d 100644 --- a/account_financial_report_qweb/report/__init__.py +++ b/account_financial_report_qweb/report/__init__.py @@ -7,6 +7,7 @@ import logging _logger = logging.getLogger(__name__) +from . import abstract_report from . import aged_partner_balance from . import general_ledger from . import open_items diff --git a/account_financial_report_qweb/report/abstract_report.py b/account_financial_report_qweb/report/abstract_report.py new file mode 100644 index 00000000..3b4d8778 --- /dev/null +++ b/account_financial_report_qweb/report/abstract_report.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import models + + +class AbstractReport(models.AbstractModel): + _name = 'report_qweb_abstract' + + def _transient_clean_rows_older_than(self, cr, seconds): + assert self._transient, \ + "Model %s is not transient, it cannot be vacuumed!" % self._name + # Never delete rows used in last 5 minutes + seconds = max(seconds, 300) + query = """ +DELETE FROM """ + self._table + """ +WHERE + COALESCE(write_date, create_date, (now() at time zone 'UTC'))::timestamp + < ((now() at time zone 'UTC') - interval %s) +""" + cr.execute(query, ("%s seconds" % seconds,)) diff --git a/account_financial_report_qweb/report/aged_partner_balance.py b/account_financial_report_qweb/report/aged_partner_balance.py index 131cccee..ef8501c9 100644 --- a/account_financial_report_qweb/report/aged_partner_balance.py +++ b/account_financial_report_qweb/report/aged_partner_balance.py @@ -19,6 +19,7 @@ class AgedPartnerBalanceReport(models.TransientModel): """ _name = 'report_aged_partner_balance_qweb' + _inherit = 'report_qweb_abstract' # Filters fields, used for data computation date_at = fields.Date() @@ -41,6 +42,7 @@ class AgedPartnerBalanceReport(models.TransientModel): class AgedPartnerBalanceReportAccount(models.TransientModel): _name = 'report_aged_partner_balance_qweb_account' + _inherit = 'report_qweb_abstract' _order = 'code ASC' report_id = fields.Many2one( @@ -84,6 +86,7 @@ class AgedPartnerBalanceReportAccount(models.TransientModel): class AgedPartnerBalanceReportPartner(models.TransientModel): _name = 'report_aged_partner_balance_qweb_partner' + _inherit = 'report_qweb_abstract' report_account_id = fields.Many2one( comodel_name='report_aged_partner_balance_qweb_account', @@ -128,6 +131,7 @@ ORDER BY class AgedPartnerBalanceReportLine(models.TransientModel): _name = 'report_aged_partner_balance_qweb_line' + _inherit = 'report_qweb_abstract' report_partner_id = fields.Many2one( comodel_name='report_aged_partner_balance_qweb_partner', @@ -149,6 +153,7 @@ class AgedPartnerBalanceReportLine(models.TransientModel): class AgedPartnerBalanceReportMoveLine(models.TransientModel): _name = 'report_aged_partner_balance_qweb_move_line' + _inherit = 'report_qweb_abstract' report_partner_id = fields.Many2one( comodel_name='report_aged_partner_balance_qweb_partner', diff --git a/account_financial_report_qweb/report/general_ledger.py b/account_financial_report_qweb/report/general_ledger.py index 6c05e450..872f5615 100644 --- a/account_financial_report_qweb/report/general_ledger.py +++ b/account_financial_report_qweb/report/general_ledger.py @@ -22,6 +22,7 @@ class GeneralLedgerReport(models.TransientModel): """ _name = 'report_general_ledger_qweb' + _inherit = 'report_qweb_abstract' # Filters fields, used for data computation date_from = fields.Date() @@ -71,6 +72,7 @@ class GeneralLedgerReport(models.TransientModel): class GeneralLedgerReportAccount(models.TransientModel): _name = 'report_general_ledger_qweb_account' + _inherit = 'report_qweb_abstract' _order = 'code ASC' report_id = fields.Many2one( @@ -112,6 +114,7 @@ class GeneralLedgerReportAccount(models.TransientModel): class GeneralLedgerReportPartner(models.TransientModel): _name = 'report_general_ledger_qweb_partner' + _inherit = 'report_qweb_abstract' report_account_id = fields.Many2one( comodel_name='report_general_ledger_qweb_account', @@ -157,6 +160,7 @@ ORDER BY class GeneralLedgerReportMoveLine(models.TransientModel): _name = 'report_general_ledger_qweb_move_line' + _inherit = 'report_qweb_abstract' report_account_id = fields.Many2one( comodel_name='report_general_ledger_qweb_account', diff --git a/account_financial_report_qweb/report/open_items.py b/account_financial_report_qweb/report/open_items.py index 96350269..640798cd 100644 --- a/account_financial_report_qweb/report/open_items.py +++ b/account_financial_report_qweb/report/open_items.py @@ -17,6 +17,7 @@ class OpenItemsReport(models.TransientModel): """ _name = 'report_open_items_qweb' + _inherit = 'report_qweb_abstract' # Filters fields, used for data computation date_at = fields.Date() @@ -39,6 +40,7 @@ class OpenItemsReport(models.TransientModel): class OpenItemsReportAccount(models.TransientModel): _name = 'report_open_items_qweb_account' + _inherit = 'report_qweb_abstract' _order = 'code ASC' report_id = fields.Many2one( @@ -68,6 +70,7 @@ class OpenItemsReportAccount(models.TransientModel): class OpenItemsReportPartner(models.TransientModel): _name = 'report_open_items_qweb_partner' + _inherit = 'report_qweb_abstract' report_account_id = fields.Many2one( comodel_name='report_open_items_qweb_account', @@ -108,6 +111,7 @@ ORDER BY class OpenItemsReportMoveLine(models.TransientModel): _name = 'report_open_items_qweb_move_line' + _inherit = 'report_qweb_abstract' report_partner_id = fields.Many2one( comodel_name='report_open_items_qweb_partner', diff --git a/account_financial_report_qweb/report/trial_balance.py b/account_financial_report_qweb/report/trial_balance.py index 80b30f9a..f7b09641 100644 --- a/account_financial_report_qweb/report/trial_balance.py +++ b/account_financial_report_qweb/report/trial_balance.py @@ -17,6 +17,7 @@ class TrialBalanceReport(models.TransientModel): """ _name = 'report_trial_balance_qweb' + _inherit = 'report_qweb_abstract' # Filters fields, used for data computation date_from = fields.Date() @@ -45,6 +46,7 @@ class TrialBalanceReport(models.TransientModel): class TrialBalanceReportAccount(models.TransientModel): _name = 'report_trial_balance_qweb_account' + _inherit = 'report_qweb_abstract' _order = 'code ASC' report_id = fields.Many2one( @@ -78,6 +80,7 @@ class TrialBalanceReportAccount(models.TransientModel): class TrialBalanceReportPartner(models.TransientModel): _name = 'report_trial_balance_qweb_partner' + _inherit = 'report_qweb_abstract' report_account_id = fields.Many2one( comodel_name='report_trial_balance_qweb_account',