diff --git a/addons/account_budget/crossovered_budget.py b/addons/account_budget/crossovered_budget.py index e0e1be5e2a2..6c7eb6639ec 100644 --- a/addons/account_budget/crossovered_budget.py +++ b/addons/account_budget/crossovered_budget.py @@ -18,6 +18,7 @@ # along with this program. If not, see . # ############################################################################## + import datetime from osv import osv, fields @@ -42,7 +43,7 @@ class account_budget_post(osv.osv): 'company_id': fields.many2one('res.company', 'Company', required=True), } _defaults = { - 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.budget.post', context=c) + 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.budget.post', context=c) } _order = "name" @@ -62,8 +63,8 @@ class account_budget_post(osv.osv): account_budget_post() class account_budget_post_dotation(osv.osv): - def _tot_planned(self, cr, uid, ids,name,args,context): - res={} + def _tot_planned(self, cr, uid, ids, name, args, context): + res = {} for line in self.browse(cr, uid, ids): if line.period_id: obj_period=self.pool.get('account.period').browse(cr, uid, line.period_id.id) @@ -75,7 +76,6 @@ class account_budget_post_dotation(osv.osv): OR (date_to >=%s and date_to <= %s) OR (date_from < %s and date_to > %s)" cr.execute(query,(budget_id,obj_period.date_start,obj_period.date_stop,obj_period.date_start,obj_period.date_stop,obj_period.date_start,obj_period.date_stop,)) res1=cr.fetchall() - tot_planned=0.00 for record in res1: obj_lines = self.pool.get('crossovered.budget.lines').browse(cr, uid, record[0]) @@ -84,9 +84,9 @@ class account_budget_post_dotation(osv.osv): count_days = strToDate(obj_lines.date_to) - strToDate(obj_lines.date_from) total_days_of_rec = count_days.days +1 tot_planned += obj_lines.planned_amount/total_days_of_rec* days_in_period - res[line.id]=tot_planned + res[line.id] = tot_planned else: - res[line.id]=0.00 + res[line.id] = 0.00 return res _name = 'account.budget.post.dotation' @@ -143,7 +143,6 @@ class crossovered_budget(osv.osv): return True def budget_cancel(self, cr, uid, ids, *args): - self.write(cr, uid, ids, { 'state':'cancel' }) @@ -165,7 +164,6 @@ class crossovered_budget_lines(osv.osv): acc_ids = [x.id for x in line.general_budget_id.account_ids] if not acc_ids: raise osv.except_osv(_('Error!'),_("The General Budget '%s' has no Accounts!") % str(line.general_budget_id.name)) - date_to = line.date_to date_from = line.date_from if context.has_key('wizard_date_from'): @@ -185,7 +183,6 @@ class crossovered_budget_lines(osv.osv): res={} for line in self.browse(cr, uid, ids): res[line.id]=self._prac_amt(cr, uid, [line.id], context=context)[line.id] - return res def _theo_amt(self, cr, uid, ids,context={}): @@ -233,7 +230,8 @@ class crossovered_budget_lines(osv.osv): else: res[line.id]=0.00 return res - _name="crossovered.budget.lines" + + _name = "crossovered.budget.lines" _description = "Budget Line" _columns = { 'crossovered_budget_id': fields.many2one('crossovered.budget', 'Budget', ondelete='cascade', select=True, required=True), @@ -252,7 +250,6 @@ class crossovered_budget_lines(osv.osv): crossovered_budget_lines() class account_analytic_account(osv.osv): - _name = 'account.analytic.account' _inherit = 'account.analytic.account' _columns = { diff --git a/addons/account_budget/report/__init__.py b/addons/account_budget/report/__init__.py index 085b4262b6c..d1104982f8c 100644 --- a/addons/account_budget/report/__init__.py +++ b/addons/account_budget/report/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,12 +15,13 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## import crossovered_budget_report import analytic_account_budget_report import budget_report + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_budget/report/analytic_account_budget_report.py b/addons/account_budget/report/analytic_account_budget_report.py index 37fc4680d1f..c724968a06d 100644 --- a/addons/account_budget/report/analytic_account_budget_report.py +++ b/addons/account_budget/report/analytic_account_budget_report.py @@ -20,9 +20,10 @@ ############################################################################## import time +import datetime + import pooler from report import report_sxw -import datetime class analytic_account_budget_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): @@ -34,7 +35,6 @@ class analytic_account_budget_report(report_sxw.rml_parse): }) self.context=context - def funct(self,object,form,ids={}, done=None, level=1): if not ids: @@ -181,5 +181,5 @@ class analytic_account_budget_report(report_sxw.rml_parse): return result report_sxw.report_sxw('report.account.analytic.account.budget', 'account.analytic.account', 'addons/account_budget/report/analytic_account_budget_report.rml',parser=analytic_account_budget_report,header='internal') -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_budget/report/budget_report.py b/addons/account_budget/report/budget_report.py index 648015b3d2b..171984e9851 100644 --- a/addons/account_budget/report/budget_report.py +++ b/addons/account_budget/report/budget_report.py @@ -20,8 +20,9 @@ ############################################################################## import time -from report import report_sxw import datetime + +from report import report_sxw import operator class budget_report(report_sxw.rml_parse): @@ -64,8 +65,8 @@ class budget_report(report_sxw.rml_parse): achievements = float(self.cr.fetchone()[0]) res.append({'name': a.name, 'code': a.code, 'achievements': achievements}) return res + report_sxw.report_sxw('report.account.budget', 'account.budget.post', 'addons/account_budget/report/budget_report.rml',parser=budget_report, header="internal") -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_budget/wizard/account_budget_analytic.py b/addons/account_budget/wizard/account_budget_analytic.py index 62553520cbd..70ce1a5156b 100644 --- a/addons/account_budget/wizard/account_budget_analytic.py +++ b/addons/account_budget/wizard/account_budget_analytic.py @@ -53,5 +53,4 @@ class account_budget_analytic(osv.osv_memory): account_budget_analytic() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_budget/wizard/account_budget_crossovered_report.py b/addons/account_budget/wizard/account_budget_crossovered_report.py index 2862cd1db48..2427044e681 100644 --- a/addons/account_budget/wizard/account_budget_crossovered_report.py +++ b/addons/account_budget/wizard/account_budget_crossovered_report.py @@ -18,6 +18,7 @@ # along with this program. If not, see . # ############################################################################## + import time from osv import fields, osv @@ -54,5 +55,4 @@ class account_budget_crossvered_report(osv.osv_memory): account_budget_crossvered_report() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_budget/wizard/account_budget_spread.py b/addons/account_budget/wizard/account_budget_spread.py index b5ab413a862..31e059f754b 100644 --- a/addons/account_budget/wizard/account_budget_spread.py +++ b/addons/account_budget/wizard/account_budget_spread.py @@ -18,7 +18,7 @@ # along with this program. If not, see . # ############################################################################## -import netsvc + from osv import fields, osv import decimal_precision as dp