diff --git a/account_budget_report/__init__.py b/account_budget_report/__init__.py new file mode 100644 index 000000000..a425858d5 --- /dev/null +++ b/account_budget_report/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Jesni Banu() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import models +import reports diff --git a/account_budget_report/__manifest__.py b/account_budget_report/__manifest__.py new file mode 100644 index 000000000..4851af47a --- /dev/null +++ b/account_budget_report/__manifest__.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Jesni Banu() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +{ + 'name': 'Account Budget Report', + 'version': '10.0.1.0.0', + 'summary': """Enables Budget Summary Report""", + 'description': """Providing budget analysis through different pdf reports. So we can take + quick budget analysis.""", + 'category': 'Accounting', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['base', 'account_budget'], + 'data': [ + 'views/budget_report_view.xml', + 'views/budget_summary_view.xml', + 'views/budget_print_view.xml', + 'views/analytic_budget_report_view.xml', + 'reports/account_budget_report.xml', + 'reports/report_crossovered_budget.xml', + 'reports/report_analytic_account_budget.xml', + ], + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'demo': [], + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/account_budget_report/models/__init__.py b/account_budget_report/models/__init__.py new file mode 100644 index 000000000..021a338e4 --- /dev/null +++ b/account_budget_report/models/__init__.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Jesni Banu() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import budget_report +import budget_summary +import budget +import analytic_budget_report + + diff --git a/account_budget_report/models/analytic_budget_report.py b/account_budget_report/models/analytic_budget_report.py new file mode 100644 index 000000000..f393f3dc3 --- /dev/null +++ b/account_budget_report/models/analytic_budget_report.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Jesni Banu() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import time +from odoo import fields, models + + +class AccountBudgetAnalytic(models.TransientModel): + + _name = 'account.budget.analytic' + _description = 'Account Budget report for analytic account' + + date_from = fields.Date('Start of period', required=True, default=lambda *a: time.strftime('%Y-01-01')) + date_to = fields.Date('End of period', required=True, default=lambda *a: time.strftime('%Y-%m-%d')) + + def check_report(self): + data = self.read()[0] + active_ids = self.env.context.get('active_ids', []) + datas = { + 'ids': active_ids, + 'model': 'account.analytic.account', + 'form': data + } + datas['form']['ids'] = datas['ids'] + return self.env['report'].get_action([], 'account_budget_report.report_analytic_account_budget', data=datas) diff --git a/account_budget_report/models/budget.py b/account_budget_report/models/budget.py new file mode 100644 index 000000000..bfa1e3a05 --- /dev/null +++ b/account_budget_report/models/budget.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Jesni Banu() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import time +from odoo import models, fields + + +class AccountBudgetCrossOverReport(models.TransientModel): + _name = "account.budget.cross.over.report" + _description = "Account Budget cross over report" + + date_from = fields.Date('Start of period', required=True, default=lambda *a: time.strftime('%Y-01-01')) + date_to = fields.Date('End of period', required=True, default=lambda *a: time.strftime('%Y-%m-%d')) + + def check_report(self): + data = self.read()[0] + active_ids = self.env.context.get('active_ids', []) + datas = { + 'ids': active_ids, + 'model': 'crossovered.budget', + 'form': data + } + datas['form']['ids'] = datas['ids'] + datas['form']['report'] = 'analytic-full' + return self.env['report'].get_action([], 'account_budget_report.report_cross_over_budget', data=datas) diff --git a/account_budget_report/models/budget_report.py b/account_budget_report/models/budget_report.py new file mode 100644 index 000000000..f5f7e487d --- /dev/null +++ b/account_budget_report/models/budget_report.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Jesni Banu() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import time +from odoo import models, fields + + +class AccountBudgetAnalytic(models.TransientModel): + _name = 'account.budget.report' + _description = 'Account Budget report for analytic account' + + date_from = fields.Date('Start of period', required=True, default=lambda *a: time.strftime('%Y-01-01')) + date_to = fields.Date('End of period', required=True, default=lambda *a: time.strftime('%Y-%m-%d')) + + def check_report(self): + active_ids = self.env.context.get('active_ids', []) + data = self.read()[0] + datas = { + 'ids': active_ids, + 'model': 'account.budget.post', + 'form': data + } + datas['form']['ids'] = datas['ids'] + datas['form']['report'] = 'analytic-full' + return self.env['report'].get_action([], 'account_budget_report.report_budget', data=datas) + + diff --git a/account_budget_report/models/budget_summary.py b/account_budget_report/models/budget_summary.py new file mode 100644 index 000000000..4cd7fe8b7 --- /dev/null +++ b/account_budget_report/models/budget_summary.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Jesni Banu() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import time +from odoo import models, fields + + +class AccountBudgetCrossOverSummaryReport(models.TransientModel): + _name = 'account.budget.cross.over.summary.report' + _description = 'Account Budget cross over summary report' + + date_from = fields.Date('Start of period', required=True, default=lambda *a: time.strftime('%Y-01-01')) + date_to = fields.Date('End of period', required=True, default=lambda *a: time.strftime('%Y-%m-%d')) + + def check_report(self): + data = self.read()[0] + active_ids = self.env.context.get('active_ids', []) + datas = { + 'ids': active_ids, + 'model': 'crossovered.budget', + 'form': data + } + datas['form']['ids'] = datas['ids'] + datas['form']['report'] = 'analytic-one' + return self.env['report'].get_action([], 'account_budget_report.report_cross_over_budget', data=datas) diff --git a/account_budget_report/reports/__init__.py b/account_budget_report/reports/__init__.py new file mode 100644 index 000000000..fd9824e84 --- /dev/null +++ b/account_budget_report/reports/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +import budget_parser +import cross_overed_budget_report +import analytic_budget + diff --git a/account_budget_report/reports/account_budget_report.xml b/account_budget_report/reports/account_budget_report.xml new file mode 100644 index 000000000..4a8951c63 --- /dev/null +++ b/account_budget_report/reports/account_budget_report.xml @@ -0,0 +1,85 @@ + + + + + + \ No newline at end of file diff --git a/account_budget_report/reports/analytic_budget.py b/account_budget_report/reports/analytic_budget.py new file mode 100644 index 000000000..8a6cef0b6 --- /dev/null +++ b/account_budget_report/reports/analytic_budget.py @@ -0,0 +1,156 @@ +# -*- coding: utf-8 -*- +import time +from odoo.osv import osv +from odoo.report import report_sxw +from odoo.http import request + + +class AnalyticAccountBudgetReport(report_sxw.rml_parse): + def __init__(self, cr, uid, name, context): + super(AnalyticAccountBudgetReport, self).__init__(cr, uid, name, context=context) + self.localcontext.update({ + 'funct': self.funct, + 'funct_total': self.funct_total, + 'time': time, + }) + self.context = context + + def funct(self, object, form, ids=None, done=None, level=1): + if ids is None: + ids = {} + if not ids: + ids = self.ids + if not done: + done = {} + + global tot + tot = { + 'theo': 0.00, + 'pln': 0.00, + 'prac': 0.00, + 'perc': 0.00 + } + result = [] + accounts = request.env['account.analytic.account'].browse(object.id) + c_b_lines_obj = request.env['crossovered.budget.lines'] + obj_c_budget = request.env['crossovered.budget'] + + for account_id in accounts: + res = {} + b_line_ids = [] + for line in account_id.crossovered_budget_line: + b_line_ids.append(line.id) + if not b_line_ids: + return [] + d_from = form['date_from'] + d_to = form['date_to'] + self.cr.execute('SELECT DISTINCT(crossovered_budget_id) FROM ' + 'crossovered_budget_lines WHERE id =ANY(%s)', (b_line_ids,)) + budget_ids = self.cr.fetchall() + + context = {'wizard_date_from': d_from, 'wizard_date_to': d_to} + for i in range(0, len(budget_ids)): + budget_name = obj_c_budget.browse([budget_ids[i][0]]) + res = { + 'b_id': '-1', + 'a_id': '-1', + 'name': budget_name[0].name, + 'status': 1, + 'theo': 0.00, + 'pln': 0.00, + 'prac': 0.00, + 'perc': 0.00 + } + result.append(res) + + line_ids = c_b_lines_obj.search([('id', 'in', b_line_ids), + ('crossovered_budget_id', '=', budget_ids[i][0])]) + line_id = line_ids + tot_theo = tot_pln = tot_prac = tot_perc = 0 + + done_budget = [] + for line in line_id: + if line.id in b_line_ids: + theo = pract = 0.00 + theo = line.theoritical_amount + pract = line.practical_amount + if line.general_budget_id.id in done_budget: + for record in result: + if record['b_id'] == line.general_budget_id.id and \ + record['a_id'] == line.analytic_account_id.id: + record['theo'] += theo + record['pln'] += line.planned_amount + record['prac'] += pract + record['perc'] += line.percentage + tot_theo += theo + tot_pln += line.planned_amount + tot_prac += pract + tot_perc += line.percentage + else: + res1 = { + 'b_id': line.general_budget_id.id, + 'a_id': line.analytic_account_id.id, + 'name': line.general_budget_id.name, + 'status': 2, + 'theo': theo, + 'pln': line.planned_amount, + 'prac': pract, + 'perc': line.percentage + } + tot_theo += theo + tot_pln += line.planned_amount + tot_prac += pract + tot_perc += line.percentage + result.append(res1) + done_budget.append(line.general_budget_id.id) + else: + if line.general_budget_id.id in done_budget: + continue + else: + res1 = { + 'b_id': line.general_budget_id.id, + 'a_id': line.analytic_account_id.id, + 'name': line.general_budget_id.name, + 'status': 2, + 'theo': 0.00, + 'pln': 0.00, + 'prac': 0.00, + 'perc': 0.00 + } + result.append(res1) + done_budget.append(line.general_budget_id.id) + if tot_theo == 0.00: + tot_perc = 0.00 + else: + tot_perc = float(tot_prac / tot_theo) * 100 + + result[-(len(done_budget) + 1)]['theo'] = tot_theo + tot['theo'] += tot_theo + result[-(len(done_budget) + 1)]['pln'] = tot_pln + tot['pln'] += tot_pln + result[-(len(done_budget) + 1)]['prac'] = tot_prac + tot['prac'] += tot_prac + result[-(len(done_budget) + 1)]['perc'] = tot_perc + if tot['theo'] == 0.00: + tot['perc'] = 0.00 + else: + tot['perc'] = float(tot['prac'] / tot['theo']) * 100 + return result + + def funct_total(self, form): + result = [] + res = { + 'tot_theo': tot['theo'], + 'tot_pln': tot['pln'], + 'tot_prac': tot['prac'], + 'tot_perc': tot['perc'] + } + result.append(res) + return result + + +class ReportAnalyticAccountBudget(osv.AbstractModel): + _name = 'report.account_budget_report.report_analytic_account_budget' + _inherit = 'report.abstract_report' + _template = 'account_budget_report.report_analytic_account_budget' + _wrapped_report_class = AnalyticAccountBudgetReport diff --git a/account_budget_report/reports/budget_parser.py b/account_budget_report/reports/budget_parser.py new file mode 100644 index 000000000..ccd331c94 --- /dev/null +++ b/account_budget_report/reports/budget_parser.py @@ -0,0 +1,177 @@ +# -*- coding: utf-8 -*- +import time +from odoo.osv import osv +from odoo.report import report_sxw +from odoo.http import request + +tot = {} + + +class BudgetReport(report_sxw.rml_parse): + def __init__(self, cr, uid, name, context): + super(BudgetReport, self).__init__(cr, uid, name, context=context) + self.localcontext.update({ + 'funct': self.funct, + 'funct_total': self.funct_total, + 'time': time, + }) + self.context = context + + def funct(self, object, form, ids=None, done=None, level=1): + if ids is None: + ids = {} + if not ids: + ids = self.ids + if not done: + done = {} + global tot + tot = { + 'theo': 0.00, + 'pln': 0.00, + 'prac': 0.00, + 'perc': 0.00 + } + result = [] + + budgets = request.env['account.budget.post'].browse(object.id) + c_b_lines_obj = request.env['crossovered.budget.lines'] + acc_analytic_obj = request.env['account.analytic.account'] + for budget_id in budgets: + res = {} + budget_ids = [] + d_from = form['date_from'] + d_to = form['date_to'] + + for line in budget_id.crossovered_budget_line: + budget_ids.append(line.id) + + if not budget_ids: + return [] + self.cr.execute('SELECT DISTINCT(analytic_account_id) FROM ' + 'crossovered_budget_lines WHERE id = ANY(%s)', (budget_ids,)) + an_ids = self.cr.fetchall() + context = {'wizard_date_from': d_from, 'wizard_date_to': d_to} + for i in range(0, len(an_ids)): + if not an_ids[i][0]: + continue + analytic_name = acc_analytic_obj.browse(an_ids[i][0]) + res= { + 'b_id': '-1', + 'a_id': '-1', + 'name': analytic_name[0].name, + 'status': 1, + 'theo': 0.00, + 'pln': 0.00, + 'prac': 0.00, + 'perc': 0.00 + } + result.append(res) + line_ids = c_b_lines_obj.search([('id', 'in', budget_ids), ('analytic_account_id', '=', an_ids[i][0])]) + line_id = line_ids + tot_theo = tot_pln = tot_prac = tot_perc = 0.00 + + done_budget = [] + for line in line_id: + if line.id in budget_ids: + theo = pract = 0.00 + theo = line.theoritical_amount + pract = line.practical_amount + if line.general_budget_id.id in done_budget: + for record in result: + if record['b_id'] == line.general_budget_id.id and \ + record['a_id'] == line.analytic_account_id.id: + record['theo'] += theo + record['pln'] += line.planned_amount + record['prac'] += pract + if record['theo'] <> 0.00: + perc = (record['prac'] / record['theo']) * 100 + else: + perc = 0.00 + record['perc'] = perc + tot_theo += theo + tot_pln += line.planned_amount + tot_prac += pract + tot_perc += perc + else: + if theo <> 0.00: + perc = (pract / theo) * 100 + else: + perc = 0.00 + res1 = { + 'a_id': line.analytic_account_id.id, + 'b_id': line.general_budget_id.id, + 'name': line.general_budget_id.name, + 'status': 2, + 'theo': theo, + 'pln': line.planned_amount, + 'prac': pract, + 'perc': perc, + } + tot_theo += theo + tot_pln += line.planned_amount + tot_prac += pract + tot_perc += perc + if form['report'] == 'analytic-full': + result.append(res1) + done_budget.append(line.general_budget_id.id) + else: + + if line.general_budget_id.id in done_budget: + continue + else: + res1 = { + 'a_id': line.analytic_account_id.id, + 'b_id': line.general_budget_id.id, + 'name': line.general_budget_id.name, + 'status': 2, + 'theo': 0.00, + 'pln': 0.00, + 'prac': 0.00, + 'perc': 0.00 + } + if form['report'] == 'analytic-full': + result.append(res1) + done_budget.append(line.general_budget_id.id) + if tot_theo == 0.00: + tot_perc = 0.00 + else: + tot_perc = float(tot_prac / tot_theo) * 100 + if form['report'] == 'analytic-full': + result[-(len(done_budget) + 1)]['theo'] = tot_theo + tot['theo'] += tot_theo + result[-(len(done_budget) + 1)]['pln'] = tot_pln + tot['pln'] += tot_pln + result[-(len(done_budget) + 1)]['prac'] = tot_prac + tot['prac'] += tot_prac + result[-(len(done_budget) + 1)]['perc'] = tot_perc + else: + result[-1]['theo'] = tot_theo + tot['theo'] += tot_theo + result[-1]['pln'] = tot_pln + tot['pln'] += tot_pln + result[-1]['prac'] = tot_prac + tot['prac'] += tot_prac + result[-1]['perc'] = tot_perc + if tot['theo'] == 0.00: + tot['perc'] = 0.00 + else: + tot['perc'] = float(tot['prac'] / tot['theo']) * 100 + return result + + def funct_total(self, form): + result = [] + res = { + 'tot_theo': tot['theo'], + 'tot_pln': tot['pln'], + 'tot_prac': tot['prac'], + 'tot_perc': tot['perc'] + } + result.append(res) + return result + + +class ReportBudget(osv.AbstractModel): + _name = 'report.account_budget_report.report_budget' + _inherit = 'report.abstract_report' + _template = 'account_budget_report.report_budget' + _wrapped_report_class = BudgetReport diff --git a/account_budget_report/reports/cross_overed_budget_report.py b/account_budget_report/reports/cross_overed_budget_report.py new file mode 100644 index 000000000..6a336344b --- /dev/null +++ b/account_budget_report/reports/cross_overed_budget_report.py @@ -0,0 +1,180 @@ +# -*- coding: utf-8 -*- +import time +from odoo.osv import osv +from odoo.report import report_sxw +from odoo.http import request + + +class BudgetReport(report_sxw.rml_parse): + def __init__(self, cr, uid, name, context): + super(BudgetReport, self).__init__(cr, uid, name, context=context) + self.localcontext.update({ + 'funct': self.funct, + 'funct_total': self.funct_total, + 'time': time, + }) + self.context = context + + def funct(self, object, form, ids=None, done=None, level=1): + if ids is None: + ids = {} + if not ids: + ids = self.ids + if not done: + done = {} + global tot + tot = { + 'theo': 0.00, + 'pln': 0.00, + 'prac': 0.00, + 'perc': 0.00 + } + result = [] + + budgets = request.env['crossovered.budget'].browse(object.id) + c_b_lines_obj = request.env['crossovered.budget.lines'] + acc_analytic_obj = request.env['account.analytic.account'] + for budget_id in budgets: + res = {} + budget_lines = [] + budget_ids = [] + d_from = form['date_from'] + d_to = form['date_to'] + + for line in budget_id.crossovered_budget_line: + budget_ids.append(line.id) + + if not budget_ids: + return [] + + self.cr.execute('SELECT DISTINCT(analytic_account_id) FROM crossovered_budget_lines ' + 'WHERE id = ANY(%s)', (budget_ids,)) + an_ids = self.cr.fetchall() + + context = {'wizard_date_from': d_from, 'wizard_date_to': d_to} + for i in range(0, len(an_ids)): + if not an_ids[i][0]: + continue + analytic_name = acc_analytic_obj.browse([an_ids[i][0]]) + res = { + 'b_id': '-1', + 'a_id': '-1', + 'name': analytic_name[0].name, + 'status': 1, + 'theo': 0.00, + 'pln': 0.00, + 'prac': 0.00, + 'perc': 0.00 + } + result.append(res) + + line_ids = c_b_lines_obj.search([('id', 'in', budget_ids), ('analytic_account_id', '=', an_ids[i][0]), + ('date_to', '>=', d_from), ('date_from', '<=', d_to)]) + line_id = line_ids + tot_theo = tot_pln = tot_prac = tot_perc = 0.00 + + done_budget = [] + for line in line_id: + if line.id in budget_ids: + theo = pract = 0.00 + theo = line.theoritical_amount + pract = c_b_lines_obj.practical_amount + if line.general_budget_id.id in done_budget: + for record in result: + if record['b_id'] == line.general_budget_id.id and \ + record['a_id'] == line.analytic_account_id.id: + record['theo'] += theo + record['pln'] += line.planned_amount + record['prac'] += pract + if record['theo'] <> 0.00: + perc = (record['prac'] / record['theo']) * 100 + else: + perc = 0.00 + record['perc'] = perc + tot_theo += theo + tot_pln += line.planned_amount + tot_prac += pract + tot_perc += perc + else: + if theo <> 0.00: + perc = (pract / theo) * 100 + else: + perc = 0.00 + res1 = { + 'a_id': line.analytic_account_id.id, + 'b_id': line.general_budget_id.id, + 'name': line.general_budget_id.name, + 'status': 2, + 'theo': theo, + 'pln': line.planned_amount, + 'prac': pract, + 'perc': perc, + } + tot_theo += theo + tot_pln += line.planned_amount + tot_prac += pract + tot_perc += perc + if form['report'] == 'analytic-full': + result.append(res1) + done_budget.append(line.general_budget_id.id) + else: + + if line.general_budget_id.id in done_budget: + continue + else: + res1 = { + 'a_id': line.analytic_account_id.id, + 'b_id': line.general_budget_id.id, + 'name': line.general_budget_id.name, + 'status': 2, + 'theo': 0.00, + 'pln': 0.00, + 'prac': 0.00, + 'perc': 0.00 + } + if form['report'] == 'analytic-full': + result.append(res1) + done_budget.append(line.general_budget_id.id) + if tot_theo == 0.00: + tot_perc = 0.00 + else: + tot_perc = float(tot_prac / tot_theo) * 100 + if form['report'] == 'analytic-full': + result[-(len(done_budget) + 1)]['theo'] = tot_theo + tot['theo'] += tot_theo + result[-(len(done_budget) + 1)]['pln'] = tot_pln + tot['pln'] += tot_pln + result[-(len(done_budget) + 1)]['prac'] = tot_prac + tot['prac'] += tot_prac + result[-(len(done_budget) + 1)]['perc'] = tot_perc + else: + result[-1]['theo'] = tot_theo + tot['theo'] += tot_theo + result[-1]['pln'] = tot_pln + tot['pln'] += tot_pln + result[-1]['prac'] = tot_prac + tot['prac'] += tot_prac + result[-1]['perc'] = tot_perc + if tot['theo'] == 0.00: + tot['perc'] = 0.00 + else: + tot['perc'] = float(tot['prac'] / tot['theo']) * 100 + return result + + def funct_total(self, form): + result = [] + res = { + 'tot_theo': tot['theo'], + 'tot_pln': tot['pln'], + 'tot_prac': tot['prac'], + 'tot_perc': tot['perc'] + } + result.append(res) + return result + + +class ReportCrossOverBudget(osv.AbstractModel): + _name = 'report.account_budget_report.report_cross_over_budget' + _inherit = 'report.abstract_report' + _template = 'account_budget_report.report_cross_over_budget' + _wrapped_report_class = BudgetReport diff --git a/account_budget_report/reports/report_analytic_account_budget.xml b/account_budget_report/reports/report_analytic_account_budget.xml new file mode 100644 index 000000000..a3b21c730 --- /dev/null +++ b/account_budget_report/reports/report_analytic_account_budget.xml @@ -0,0 +1,77 @@ + + + + + + \ No newline at end of file diff --git a/account_budget_report/reports/report_crossovered_budget.xml b/account_budget_report/reports/report_crossovered_budget.xml new file mode 100644 index 000000000..264e8a774 --- /dev/null +++ b/account_budget_report/reports/report_crossovered_budget.xml @@ -0,0 +1,89 @@ + + + + + + \ No newline at end of file diff --git a/account_budget_report/static/description/analytic_budget.png b/account_budget_report/static/description/analytic_budget.png new file mode 100644 index 000000000..71efa3f19 Binary files /dev/null and b/account_budget_report/static/description/analytic_budget.png differ diff --git a/account_budget_report/static/description/analytic_budget_report.png b/account_budget_report/static/description/analytic_budget_report.png new file mode 100644 index 000000000..972a61d1d Binary files /dev/null and b/account_budget_report/static/description/analytic_budget_report.png differ diff --git a/account_budget_report/static/description/banner.jpg b/account_budget_report/static/description/banner.jpg new file mode 100644 index 000000000..9502ebcb6 Binary files /dev/null and b/account_budget_report/static/description/banner.jpg differ diff --git a/account_budget_report/static/description/budget_adviser.png b/account_budget_report/static/description/budget_adviser.png new file mode 100644 index 000000000..32241515f Binary files /dev/null and b/account_budget_report/static/description/budget_adviser.png differ diff --git a/account_budget_report/static/description/budgetry_position.png b/account_budget_report/static/description/budgetry_position.png new file mode 100644 index 000000000..cbdfb25f3 Binary files /dev/null and b/account_budget_report/static/description/budgetry_position.png differ diff --git a/account_budget_report/static/description/budgetry_position_report.png b/account_budget_report/static/description/budgetry_position_report.png new file mode 100644 index 000000000..406ee3073 Binary files /dev/null and b/account_budget_report/static/description/budgetry_position_report.png differ diff --git a/account_budget_report/static/description/cybro_logo.png b/account_budget_report/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/account_budget_report/static/description/cybro_logo.png differ diff --git a/account_budget_report/static/description/icon.png b/account_budget_report/static/description/icon.png new file mode 100644 index 000000000..acfb759cc Binary files /dev/null and b/account_budget_report/static/description/icon.png differ diff --git a/account_budget_report/static/description/index.html b/account_budget_report/static/description/index.html new file mode 100644 index 000000000..c4059aac6 --- /dev/null +++ b/account_budget_report/static/description/index.html @@ -0,0 +1,145 @@ +
+
+

Account Budget Report

+

Helps You To Analyse Budget Summary

+

Cybrosys Technologies

+
+
+

Features:

+
+ Option to print budget summary from budgets
+ Option to print budgets from budgets
+ Option to print budgets from analytic accounts
+ Option to print budgets from budgetary positions
+
+
+
+ +
+
+
+

Overview

+

+ In odoo we can manage different budgets for every accounts. But currently there is no any option to take + budget report. So here we are providing budget analysis through different pdf reports. So we can take + quick budget analysis. +

+
+
+
+ +
+
+
+

+

Budget Summary

+

+

+
+
+ +
+ Go to Account -> Adviser -> Budgets. Then select one or more budgets. Then click on 'Print' + menu and choose 'Print Summary'. +
+ +
+ You can choose start date and end date then click on 'Print' button. +
+ +
+
+
+
+ +
+
+
+

+

Budgets

+

+

+
+ Go to Account -> Adviser -> Budgets. Then select one or more budgets. Then click on 'Print' + menu and choose 'Print Budgets'. +
+ +
+ You can choose start date and end date then click on 'Print' button. +
+ +
+
+
+
+ +
+
+
+

+

Analytic Accounts

+

+

+
+ Go to Account -> Adviser -> Analytic Accounts. Then select one analytic accounts. Then click on 'Print' + menu and choose 'Print Budgets'. +
+ +
+ You can choose start date and end date then click on 'Print' button. +
+ +
+
+
+
+ +
+
+
+

+

Budgetary Positions

+

+

+
+ Go to Account -> Configuration -> Management -> Budgetary Positions. Then select one budgetary position. + Then click on 'Print' menu and choose 'Budgets'. +
+ +
+ You can choose start date and end date then click on 'Print' button. +
+ +
+
+
+
+ +
+

Need Any Help?

+ +
+ + + diff --git a/account_budget_report/static/description/report2.png b/account_budget_report/static/description/report2.png new file mode 100644 index 000000000..e70d87f8d Binary files /dev/null and b/account_budget_report/static/description/report2.png differ diff --git a/account_budget_report/static/description/summary_report.png b/account_budget_report/static/description/summary_report.png new file mode 100644 index 000000000..7172522d3 Binary files /dev/null and b/account_budget_report/static/description/summary_report.png differ diff --git a/account_budget_report/static/description/wizard.png b/account_budget_report/static/description/wizard.png new file mode 100644 index 000000000..0541f748e Binary files /dev/null and b/account_budget_report/static/description/wizard.png differ diff --git a/account_budget_report/static/description/wizard1.png b/account_budget_report/static/description/wizard1.png new file mode 100644 index 000000000..c9d892fbc Binary files /dev/null and b/account_budget_report/static/description/wizard1.png differ diff --git a/account_budget_report/views/analytic_budget_report_view.xml b/account_budget_report/views/analytic_budget_report_view.xml new file mode 100644 index 000000000..cf5cf20e7 --- /dev/null +++ b/account_budget_report/views/analytic_budget_report_view.xml @@ -0,0 +1,38 @@ + + + + account.budget.analytic.form + account.budget.analytic + +
+ + + + +
+
+
+
+
+ + + Print Budgets + ir.actions.act_window + account.budget.analytic + form + form + + new + + + + + Print Budgets + client_print_multi + + action + account.analytic.account + +
\ No newline at end of file diff --git a/account_budget_report/views/budget_print_view.xml b/account_budget_report/views/budget_print_view.xml new file mode 100644 index 000000000..6a8df6fa6 --- /dev/null +++ b/account_budget_report/views/budget_print_view.xml @@ -0,0 +1,37 @@ + + + + account.budget.cross.over.report.form + account.budget.cross.over.report + +
+ + + + +
+
+
+
+
+ + + Print Budgets + ir.actions.act_window + account.budget.cross.over.report + form + form + + new + + + + Print Budgets + client_print_multi + + action + crossovered.budget + +
\ No newline at end of file diff --git a/account_budget_report/views/budget_report_view.xml b/account_budget_report/views/budget_report_view.xml new file mode 100644 index 000000000..604eba6bc --- /dev/null +++ b/account_budget_report/views/budget_report_view.xml @@ -0,0 +1,39 @@ + + + + account.budget.report.form + account.budget.report + +
+ + + + +
+
+
+
+
+ + + Budgets + ir.actions.act_window + account.budget.report + form + form + + new + + + + + Budgets + client_print_multi + + action + account.budget.post + +
\ No newline at end of file diff --git a/account_budget_report/views/budget_summary_view.xml b/account_budget_report/views/budget_summary_view.xml new file mode 100644 index 000000000..ad45b079c --- /dev/null +++ b/account_budget_report/views/budget_summary_view.xml @@ -0,0 +1,38 @@ + + + + account.budget.cross.over.summary.report.form + account.budget.cross.over.summary.report + +
+ + + + +
+
+
+
+
+ + + Print Summary + ir.actions.act_window + account.budget.cross.over.summary.report + form + form + + new + + + + + Print Summary + client_print_multi + + action + crossovered.budget + +
\ No newline at end of file