From 591bf61870099cd8f02d0b80e8c40e3e54da1714 Mon Sep 17 00:00:00 2001 From: Ludovic CHEVALIER Date: Wed, 11 May 2022 13:21:25 +0200 Subject: [PATCH] [MODULE] ~account_budget_enhancement is a separated module now --- __openerp__.py | 2 +- lhc.py | 34 ---------------------------------- 2 files changed, 1 insertion(+), 35 deletions(-) diff --git a/__openerp__.py b/__openerp__.py index d5d5ed5..dceab53 100644 --- a/__openerp__.py +++ b/__openerp__.py @@ -40,7 +40,7 @@ Custom module for L'Heureux Cyclage 'website': 'http://www.heureux-cyclage.org', 'depends': [ 'account', - 'account_budget', + 'account_budget_enhancement', 'analytic', 'document', 'event', diff --git a/lhc.py b/lhc.py index 494773c..32ac0bf 100644 --- a/lhc.py +++ b/lhc.py @@ -160,38 +160,4 @@ class event_registration(orm.Model): vals['value']['phone'] = mobile return vals - -class crossovered_budget_lines(orm.Model): - _inherit = 'crossovered.budget.lines' - - def _prac_amt(self, cr, uid, ids, context=None): - """Calculate pratical amount even if there is no analytic account""" - res = {} - result = 0.0 - if context is None: - context = {} - account_obj = self.pool.get('account.account') - - for line in self.browse(cr, uid, ids, context=context): - acc_ids = [x.id for x in line.general_budget_id.account_ids] - if not acc_ids: - raise osv.except_osv(_('Error!'),_("The Budget '%s' has no accounts!") % ustr(line.general_budget_id.name)) - acc_ids = account_obj._get_children_and_consol(cr, uid, acc_ids, context=context) - date_to = line.date_to - date_from = line.date_from - - if line.analytic_account_id.id: - res = super(crossovered_budget_lines, self)._prac_amt(cr, uid, ids, context) - else: - cr.execute("SELECT SUM(credit) - SUM(debit) FROM account_move_line WHERE (date " - "between to_date(%s,'yyyy-mm-dd') AND to_date(%s,'yyyy-mm-dd')) AND " - "account_id=ANY(%s)", (date_from, date_to,acc_ids,)) - result = cr.fetchone()[0] - if result is None: - result = 0.00 - res[line.id] = result - - return res - - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: -- 2.20.1