From 14d56e3b468c27ffaec2af415926d59fb83bcbc3 Mon Sep 17 00:00:00 2001 From: AjmalCybro Date: Fri, 30 Jun 2023 17:08:11 +0530 Subject: [PATCH] Jun 30 : [UPDT] Updated 'base_account_budget' --- base_account_budget/README.rst | 17 ++-- base_account_budget/__manifest__.py | 2 +- base_account_budget/doc/RELEASE_NOTES.md | 8 +- base_account_budget/models/__init__.py | 1 - .../models/account_analytic_account.py | 3 +- base_account_budget/models/account_budget.py | 93 +++++++++++------- .../static/description/assets/icons/logo.png | Bin 0 -> 3452 bytes .../static/description/index.html | 18 +++- 8 files changed, 94 insertions(+), 48 deletions(-) create mode 100644 base_account_budget/static/description/assets/icons/logo.png diff --git a/base_account_budget/README.rst b/base_account_budget/README.rst index ccefa79eb..7e7a4cc8d 100644 --- a/base_account_budget/README.rst +++ b/base_account_budget/README.rst @@ -1,5 +1,9 @@ -Odoo 15 Budgets Management -========================== +.. image:: https://img.shields.io/badge/licence-LGPL--3-green.svg + :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +Odoo 15 Budget Management +========================= * Budgets Management system for Odoo 15 Community edition Installation @@ -10,7 +14,7 @@ Installation License ------- General Public License, Version 3 (LGPL v3). -(https://www.odoo.com/documentation/user/13.0/legal/licenses/licenses.html) +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) Company ------- @@ -33,12 +37,13 @@ Bugs are tracked on GitHub Issues. In case of trouble, please check there if you Maintainer ========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + This module is maintained by Cybrosys Technologies. For support and more information, please visit https://www.cybrosys.com Further information =================== -HTML Description: ``__ - +HTML Description: ``__ diff --git a/base_account_budget/__manifest__.py b/base_account_budget/__manifest__.py index 76ff28bf8..25b043c83 100644 --- a/base_account_budget/__manifest__.py +++ b/base_account_budget/__manifest__.py @@ -21,7 +21,7 @@ ############################################################################# { 'name': 'Odoo 15 Budget Management', - 'version': '15.0.1.1.0', + 'version': '15.0.1.1.1', 'summary': """ Budget Management for Odoo 15 Community Edition. """, 'description': """ This module allows accountants to manage analytic and budgets. diff --git a/base_account_budget/doc/RELEASE_NOTES.md b/base_account_budget/doc/RELEASE_NOTES.md index 27a1eca41..2f9a8f622 100644 --- a/base_account_budget/doc/RELEASE_NOTES.md +++ b/base_account_budget/doc/RELEASE_NOTES.md @@ -1,7 +1,11 @@ -## Module +## Module #### 06.10.2021 #### Version 15.0.1.0.0 #### ADD -- Initial commit for base_account_budget +- Initial commit for Odoo 15 Budget Management +#### 27.06.2023 +#### Version 15.0.1.1.1 +#### REF +- Refactor code and remove unused files \ No newline at end of file diff --git a/base_account_budget/models/__init__.py b/base_account_budget/models/__init__.py index 2a08a54d2..29377c111 100644 --- a/base_account_budget/models/__init__.py +++ b/base_account_budget/models/__init__.py @@ -19,6 +19,5 @@ # If not, see . # ############################################################################# - from . import account_budget from . import account_analytic_account diff --git a/base_account_budget/models/account_analytic_account.py b/base_account_budget/models/account_analytic_account.py index 73625d7e4..dcaa8843d 100644 --- a/base_account_budget/models/account_analytic_account.py +++ b/base_account_budget/models/account_analytic_account.py @@ -25,4 +25,5 @@ from odoo import fields, models class AccountAnalyticAccount(models.Model): _inherit = "account.analytic.account" - budget_line = fields.One2many('budget.lines', 'analytic_account_id', 'Budget Lines') + budget_line = fields.One2many('budget.lines', 'analytic_account_id', + string='Budget Lines') diff --git a/base_account_budget/models/account_budget.py b/base_account_budget/models/account_budget.py index c4c0f3d23..b7efbe232 100644 --- a/base_account_budget/models/account_budget.py +++ b/base_account_budget/models/account_budget.py @@ -19,7 +19,6 @@ # If not, see . # ############################################################################# - from odoo import api, fields, models, _ from odoo.exceptions import ValidationError @@ -30,12 +29,15 @@ class AccountBudgetPost(models.Model): _description = "Budgetary Position" name = fields.Char('Name', required=True) - account_ids = fields.Many2many('account.account', 'account_budget_rel', 'budget_id', 'account_id', 'Accounts', - domain=[('deprecated', '=', False)]) - budget_line = fields.One2many('budget.lines', 'general_budget_id', 'Budget Lines') - company_id = fields.Many2one('res.company', 'Company', required=True, - default=lambda self: self.env['res.company']._company_default_get( - 'account.budget.post')) + account_ids = fields.Many2many( + 'account.account', 'account_budget_rel', 'budget_id', 'account_id', + string='Accounts', domain=[('deprecated', '=', False)]) + budget_line = fields.One2many('budget.lines', 'general_budget_id', + string='Budget Lines') + company_id = fields.Many2one( + 'res.company', string='Company', required=True, + default=lambda self: self.env['res.company']._company_default_get( + 'account.budget.post')) def _check_account_ids(self, vals): if 'account_ids' in vals: @@ -43,7 +45,8 @@ class AccountBudgetPost(models.Model): else: account_ids = self.account_ids if not account_ids: - raise ValidationError(_('The budget must have at least one account.')) + raise ValidationError( + _('The budget must have at least one account.')) @api.model def create(self, vals): @@ -60,22 +63,29 @@ class Budget(models.Model): _description = "Budget" _inherit = ['mail.thread'] - name = fields.Char('Budget Name', required=True, states={'done': [('readonly', True)]}) - creating_user_id = fields.Many2one('res.users', 'Responsible', default=lambda self: self.env.user) - date_from = fields.Date('Start Date', required=True, states={'done': [('readonly', True)]}) - date_to = fields.Date('End Date', required=True, states={'done': [('readonly', True)]}) + name = fields.Char( + 'Budget Name', required=True, states={'done': [('readonly', True)]}) + creating_user_id = fields.Many2one( + 'res.users', 'Responsible', default=lambda self: self.env.user) + date_from = fields.Date( + 'Start Date', required=True, states={'done': [('readonly', True)]}) + date_to = fields.Date( + 'End Date', required=True, states={'done': [('readonly', True)]}) state = fields.Selection([ ('draft', 'Draft'), ('cancel', 'Cancelled'), ('confirm', 'Confirmed'), ('validate', 'Validated'), ('done', 'Done') - ], 'Status', default='draft', index=True, required=True, readonly=True, copy=False, track_visibility='always') - budget_line = fields.One2many('budget.lines', 'budget_id', 'Budget Lines', - states={'done': [('readonly', True)]}, copy=True) - company_id = fields.Many2one('res.company', 'Company', required=True, - default=lambda self: self.env['res.company']._company_default_get( - 'account.budget.post')) + ], 'Status', default='draft', index=True, required=True, readonly=True, + copy=False, track_visibility='always') + budget_line = fields.One2many( + 'budget.lines', 'budget_id', 'Budget Lines', + states={'done': [('readonly', True)]}, copy=True) + company_id = fields.Many2one( + 'res.company', 'Company', required=True, + default=lambda self: self.env['res.company']._company_default_get( + 'account.budget.post')) def action_budget_confirm(self): self.write({'state': 'confirm'}) @@ -98,25 +108,34 @@ class BudgetLines(models.Model): _rec_name = "budget_id" _description = "Budget Line" - budget_id = fields.Many2one('budget.budget', 'Budget', ondelete='cascade', index=True, required=True) - analytic_account_id = fields.Many2one('account.analytic.account', 'Analytic Account') - general_budget_id = fields.Many2one('account.budget.post', 'Budgetary Position', required=True) - date_from = fields.Date('Start Date', required=True) - date_to = fields.Date('End Date', required=True) - paid_date = fields.Date('Paid Date') - planned_amount = fields.Float('Planned Amount', required=True, digits=0) - practical_amount = fields.Float(compute='_compute_practical_amount', string='Practical Amount', digits=0) - theoretical_amount = fields.Float(compute='_compute_theoretical_amount', string='Theoretical Amount', digits=0) - percentage = fields.Float(compute='_compute_percentage', string='Achievement') - company_id = fields.Many2one(related='budget_id.company_id', comodel_name='res.company', - string='Company', store=True, readonly=True) + budget_id = fields.Many2one('budget.budget', string='Budget', + ondelete='cascade', index=True, required=True) + analytic_account_id = fields.Many2one('account.analytic.account', + string='Analytic Account') + general_budget_id = fields.Many2one( + 'account.budget.post', string='Budgetary Position', required=True) + date_from = fields.Date(string='Start Date', required=True) + date_to = fields.Date(string='End Date', required=True) + paid_date = fields.Date(string='Paid Date') + planned_amount = fields.Float( + string='Planned Amount', required=True, digits=0) + practical_amount = fields.Float(compute='_compute_practical_amount', + string='Practical Amount', digits=0) + theoretical_amount = fields.Float(compute='_compute_theoretical_amount', + string='Theoretical Amount', digits=0) + percentage = fields.Float( + compute='_compute_percentage', string='Achievement') + company_id = fields.Many2one( + related='budget_id.company_id', comodel_name='res.company', + string='Company', store=True, readonly=True) def _compute_practical_amount(self): for line in self: result = 0.0 acc_ids = line.general_budget_id.account_ids.ids date_to = self.env.context.get('wizard_date_to') or line.date_to - date_from = self.env.context.get('wizard_date_from') or line.date_from + date_from = self.env.context.get( + 'wizard_date_from') or line.date_from if line.analytic_account_id.id: self.env.cr.execute(""" SELECT SUM(amount) @@ -124,7 +143,8 @@ class BudgetLines(models.Model): WHERE account_id=%s AND date between %s AND %s AND general_account_id=ANY(%s)""", - (line.analytic_account_id.id, date_from, date_to, acc_ids,)) + (line.analytic_account_id.id, date_from, + date_to, acc_ids,)) result = self.env.cr.fetchone()[0] or 0.0 line.practical_amount = result @@ -134,8 +154,10 @@ class BudgetLines(models.Model): # Used for the report if self.env.context.get('wizard_date_from') and self.env.context.get('wizard_date_to'): - date_from = fields.Datetime.from_string(self.env.context.get('wizard_date_from')) - date_to = fields.Datetime.from_string(self.env.context.get('wizard_date_to')) + date_from = fields.Datetime.from_string( + self.env.context.get('wizard_date_from')) + date_to = fields.Datetime.from_string( + self.env.context.get('wizard_date_to')) if date_from < fields.Datetime.from_string(line.date_from): date_from = fields.Datetime.from_string(line.date_from) elif date_from > fields.Datetime.from_string(line.date_to): @@ -182,6 +204,7 @@ class BudgetLines(models.Model): def _compute_percentage(self): for line in self: if line.theoretical_amount != 0.00: - line.percentage = float((line.practical_amount or 0.0) / line.theoretical_amount) * 100 + line.percentage = float( + (line.practical_amount or 0.0) / line.theoretical_amount) * 100 else: line.percentage = 0.00 diff --git a/base_account_budget/static/description/assets/icons/logo.png b/base_account_budget/static/description/assets/icons/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..478462d3e73d73cc9bae9fea8e7f8fac84fab049 GIT binary patch literal 3452 zcmV-?4TJKDP)Px#PEbr#MIs&_+uGWlo1Co^85R-~_VxAb=;{Ce|FR(_ z1OfvvEiGJHTFS}EY-(z&tE;-XxsHsCJUKc_M@Xp&4t;xj#adq9qNMD=!Jz;F(0O|# z0#`!-01V7YL_t(|+U%Qcd!sB9hJgTP5CM&8+W-GYAKnE-lXUy+{bB2Fk2X;OPp%n; z0nzY#ymR11AVJo77$n$_D1Fa*M>=QEcK-jP$1)5n#rB6~d~zCl$I9(F{&nvkAO9ph zZk0E!D<&x8l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