-
-
Notifications
You must be signed in to change notification settings - Fork 739
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55639a6
commit f826ac9
Showing
14 changed files
with
912 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
=================== | ||
Account Move Budget | ||
=================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github | ||
:target: https://github.com/OCA/account-financial-tools/tree/11.0/account_move_budget | ||
:alt: OCA/account-financial-tools | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/account-financial-tools-11-0/account-financial-tools-11-0-account_move_budget | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/92/11.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows to define accounting budgets. | ||
|
||
These budgets can then be used in MIS Builder reports, as an alternate | ||
source. | ||
|
||
The difference between the MIS Builder Budget and this module is that | ||
this module defines budgets irrespective of the MIS Builder Template. The | ||
budget is thus agnostic of the reporting format. | ||
|
||
For example, the budgeted data can be used in a general Profit & Loss report | ||
and at the same time can be used in a department or project expenses report. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
[ This file is optional, it should explain how to configure | ||
the module before using it; it is aimed at advanced users. ] | ||
|
||
To configure this module, you need to: | ||
|
||
#. Go to ... | ||
|
||
.. figure:: ../static/description/image.png | ||
:alt: alternative description | ||
:width: 600 px | ||
|
||
Usage | ||
===== | ||
|
||
In order to set up the budget items go to | ||
*Invoicing / Adviser / Accounting Entries / Account Move Budgets*. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_move_budget%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Eficent | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Eficent Business and IT Consulting Services, S.L. (https://www.eficent.com) | ||
* Hector Villarreal <hector.villarreal@eficent.com> | ||
* Jordi Ballester Alomar <jordi.ballester@eficent.com> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/11.0/account_move_budget>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
from . import models | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright 2019 Eficent Business and IT Consulting Services, S.L. | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Account Move Budget", | ||
"summary": "Create Accounting Budgets", | ||
"version": "11.0.1.0.0", | ||
"category": "Accounting & Finance", | ||
"website": "https://github.com/OCA/account-financial-tools", | ||
"author": "Eficent, " | ||
"Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"application": False, | ||
"installable": True, | ||
"depends": [ | ||
"account", | ||
"date_range", | ||
], | ||
"data": [ | ||
"security/ir.model.access.csv", | ||
"views/account_move_budget_line_views.xml", | ||
"views/account_move_budget_views.xml", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
from . import account_move_budget | ||
from . import account_move_budget_line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# Copyright 2019 ACSONE SA/NV | ||
# Copyright 2019 Eficent Business and IT Consulting Services, S.L. | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import _, api, fields, models | ||
|
||
|
||
class AccountMoveBudget(models.Model): | ||
_name = "account.move.budget" | ||
_description = "Account Move Budget" | ||
_inherit = ['mail.thread', 'mail.activity.mixin'] | ||
|
||
@api.model | ||
def _default_company(self): | ||
return self.env['res.company']. \ | ||
_company_default_get('mis.budget') | ||
|
||
name = fields.Char( | ||
required=True, | ||
track_visibility='onchange', | ||
) | ||
description = fields.Char( | ||
track_visibility='onchange', | ||
) | ||
date_range_id = fields.Many2one( | ||
comodel_name='date.range', | ||
string='Date range', | ||
) | ||
date_from = fields.Date( | ||
required=True, | ||
string='From', | ||
track_visibility='onchange', | ||
) | ||
date_to = fields.Date( | ||
required=True, | ||
string='To', | ||
track_visibility='onchange', | ||
) | ||
state = fields.Selection( | ||
[('draft', 'Draft'), | ||
('confirmed', 'Confirmed'), | ||
('cancelled', 'Cancelled')], | ||
required=True, | ||
default='draft', | ||
track_visibility='onchange', | ||
) | ||
line_ids = fields.One2many( | ||
comodel_name='account.move.budget.line', | ||
inverse_name='budget_id', | ||
copy=True, | ||
) | ||
company_id = fields.Many2one( | ||
comodel_name='res.company', | ||
string='Company', | ||
default=_default_company, | ||
) | ||
|
||
@api.multi | ||
def copy(self, default=None): | ||
self.ensure_one() | ||
if default is None: | ||
default = {} | ||
if 'name' not in default: | ||
default['name'] = _("%s (copy)") % self.name | ||
return super(AccountMoveBudget, self).copy(default=default) | ||
|
||
@api.onchange('date_range_id') | ||
def _onchange_date_range(self): | ||
for rec in self: | ||
if rec.date_range_id: | ||
rec.date_from = rec.date_range_id.date_start | ||
rec.date_to = rec.date_range_id.date_end | ||
|
||
@api.onchange('date_from', 'date_to') | ||
def _onchange_dates(self): | ||
for rec in self: | ||
if rec.date_range_id: | ||
if rec.date_from != rec.date_range_id.date_start or \ | ||
rec.date_to != rec.date_range_id.date_end: | ||
rec.date_range_id = False | ||
|
||
@api.multi | ||
def action_draft(self): | ||
for rec in self: | ||
rec.state = 'draft' | ||
|
||
@api.multi | ||
def action_cancel(self): | ||
for rec in self: | ||
rec.state = 'cancelled' | ||
|
||
@api.multi | ||
def action_confirm(self): | ||
for rec in self: | ||
rec.state = 'confirmed' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Copyright 2019 Eficent Business and IT Consulting Services, S.L. | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import _, api, fields, models | ||
from odoo.exceptions import ValidationError | ||
|
||
|
||
class AccountMoveBudgetLine(models.Model): | ||
_name = "account.move.budget.line" | ||
_description = "Account Move Budget Line" | ||
_order = "date desc, id desc" | ||
|
||
budget_id = fields.Many2one( | ||
comodel_name='account.move.budget', | ||
string="Budget", | ||
required=True, | ||
ondelete='cascade', | ||
index=True, | ||
) | ||
name = fields.Char(string="Label") | ||
debit = fields.Monetary( | ||
default=0.0, | ||
currency_field='company_currency_id', | ||
) | ||
credit = fields.Monetary( | ||
default=0.0, | ||
currency_field='company_currency_id' | ||
) | ||
balance = fields.Monetary( | ||
compute='_compute_store_balance', | ||
store=True, | ||
currency_field='company_currency_id', | ||
help="Technical field holding the debit - " | ||
"credit in order to open meaningful " | ||
"graph views from reports", | ||
) | ||
company_currency_id = fields.Many2one( | ||
'res.currency', | ||
related='company_id.currency_id', | ||
string="Company Currency", | ||
readonly=True, | ||
help='Utility field to express amount currency', | ||
store=True, | ||
) | ||
account_id = fields.Many2one( | ||
'account.account', | ||
string='Account', | ||
required=True, | ||
index=True, | ||
ondelete="cascade", | ||
domain=[('deprecated', '=', False)], | ||
default=lambda self: self._context.get('account_id', False), | ||
) | ||
date = fields.Date( | ||
string='Date', | ||
index=True, | ||
required=True, | ||
) | ||
analytic_account_id = fields.Many2one( | ||
'account.analytic.account', | ||
string='Analytic Account', | ||
) | ||
company_id = fields.Many2one( | ||
'res.company', | ||
related='account_id.company_id', | ||
string='Company', | ||
store=True, | ||
readonly=True, | ||
) | ||
partner_id = fields.Many2one( | ||
'res.partner', | ||
string='Partner', | ||
ondelete='restrict', | ||
) | ||
|
||
@api.depends('debit', 'credit') | ||
def _compute_store_balance(self): | ||
for line in self: | ||
line.balance = line.debit - line.credit | ||
|
||
@api.constrains('date') | ||
def _constraint_date(self): | ||
for rec in self: | ||
if rec.budget_id.date_from > rec.date or \ | ||
rec.budget_id.date_to < rec.date: | ||
raise ValidationError(_('The date must be within the ' | ||
'budget period.')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* Eficent Business and IT Consulting Services, S.L. (https://www.eficent.com) | ||
* Hector Villarreal <hector.villarreal@eficent.com> | ||
* Jordi Ballester Alomar <jordi.ballester@eficent.com> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
This module allows to define accounting budgets. | ||
|
||
These budgets can then be used in MIS Builder reports, as an alternate | ||
source. | ||
|
||
The difference between the MIS Builder Budget and this module is that | ||
this module defines budgets irrespective of the MIS Builder Template. The | ||
budget is thus agnostic of the reporting format. | ||
|
||
For example, the budgeted data can be used in a general Profit & Loss report | ||
and at the same time can be used in a department or project expenses report. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
In order to set up the budget items go to | ||
*Invoicing / Adviser / Accounting Entries / Account Move Budgets*. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_account_move_budget,access_account_move_budget,model_account_move_budget,account.group_account_user,1,0,0,0 | ||
access_account_move_budget_manager,access_account_move_budget_manager,model_account_move_budget,account.group_account_manager,1,1,1,1 | ||
access_account_move_budget_line,access_account_move_budget_line,model_account_move_budget_line,account.group_account_user,1,0,0,0 | ||
access_account_move_budget_line_manager,access_account_move_budget_line_manager,model_account_move_budget_line,account.group_account_manager,1,1,1,1 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.