-
-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] account_analytic_line_split: add new module
- Loading branch information
1 parent
924b249
commit 5af8ce6
Showing
19 changed files
with
992 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,98 @@ | ||
=========================== | ||
Account Analytic Line Split | ||
=========================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:51841c6908ca68e10fec816309262b08de0c26c69a85b25e60ade24c8b007b58 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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--analytic-lightgray.png?logo=github | ||
:target: https://github.com/OCA/account-analytic/tree/14.0/account_analytic_line_split | ||
:alt: OCA/account-analytic | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/account-analytic-14-0/account-analytic-14-0-account_analytic_line_split | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-analytic&target_branch=14.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows to split analytic lines in two or more lines. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
To split an analytic line: | ||
|
||
#. Go to Invoicing > Configuration > Management > Analytic Items. | ||
#. Open an Anlytic Entry. | ||
#. Click on "Split Line" button to open the wizard. | ||
#. Create the lines setting the Analytic Account and Percentage of the amount. | ||
#. The new lines will be created and displayed in "Child Lines" notebook. | ||
|
||
To split an analytic line directly from the Account Move: | ||
|
||
#. Open one Account Move (a Journal Entry, Bill or Invoice). | ||
#. Go to "Analytic Lines" notebook. | ||
#. Click on "Split Line" button inside the line to open the wizard. | ||
#. Create the lines setting the Analytic Account and Percentage of the amount. | ||
#. The new lines will be created and displayed in notebook. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-analytic/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/account-analytic/issues/new?body=module:%20account_analytic_line_split%0Aversion:%2014.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 | ||
~~~~~~~ | ||
|
||
* Escodoo | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Escodoo <https://escodoo.com.br>`_: | ||
|
||
* Marcel Savegnago <[email protected]> | ||
* Wesley Oliveira <[email protected]> | ||
|
||
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-analytic <https://github.com/OCA/account-analytic/tree/14.0/account_analytic_line_split>`_ 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,2 @@ | ||
from . import models | ||
from . import wizard |
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,20 @@ | ||
# Copyright 2024 - TODAY, Escodoo | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Account Analytic Line Split", | ||
"summary": """ | ||
Account Analytic Line Split""", | ||
"version": "14.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "Escodoo, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/account-analytic", | ||
"depends": ["account", "analytic"], | ||
"data": [ | ||
"views/account_analytic_line.xml", | ||
"views/account_move.xml", | ||
"wizard/analytic_line_split_wizard.xml", | ||
"security/ir.model.access.csv", | ||
], | ||
"demo": [], | ||
} |
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 @@ | ||
from . import account_analytic_line | ||
from . import account_move |
50 changes: 50 additions & 0 deletions
50
account_analytic_line_split/models/account_analytic_line.py
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,50 @@ | ||
# Copyright 2024 - TODAY, Wesley Oliveira <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class AccountAnalyticLine(models.Model): | ||
_inherit = "account.analytic.line" | ||
|
||
parent_id = fields.Many2one( | ||
comodel_name="account.analytic.line", | ||
string="Origin", | ||
ondelete="cascade", | ||
readonly=True, | ||
) | ||
child_ids = fields.One2many( | ||
comodel_name="account.analytic.line", | ||
inverse_name="parent_id", | ||
string="Child Lines", | ||
compute="_compute_child_ids", | ||
store=True, | ||
readonly=True, | ||
) | ||
|
||
@api.depends("parent_id") | ||
def _compute_child_ids(self): | ||
for line in self: | ||
line.child_ids = self.search([("parent_id", "=", line.id)]) | ||
|
||
def action_edit_analytic_line(self): | ||
context = dict(self.env.context) | ||
context["form_view_initial_mode"] = "edit" | ||
action = self.env["ir.actions.act_window"]._for_xml_id( | ||
"analytic.account_analytic_line_action_entries" | ||
) | ||
action["context"] = context | ||
action["views"] = [(False, "form")] | ||
action["res_id"] = self.id | ||
return action | ||
|
||
def action_split_analytic_line(self): | ||
action = self.env["ir.actions.act_window"]._for_xml_id( | ||
"account_analytic_line_split.analytic_line_split_wizard_action" | ||
) | ||
action["context"] = { | ||
"active_id": self.id, | ||
"amount": self.amount, | ||
"account_id": self.account_id.id, | ||
} | ||
return action | ||
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,19 @@ | ||
# Copyright 2024 - TODAY, Wesley Oliveira <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class AccountMove(models.Model): | ||
_inherit = "account.move" | ||
|
||
analytic_line_ids = fields.Many2many( | ||
comodel_name="account.analytic.line", | ||
string="Analytic Lines", | ||
compute="_compute_analytic_line_ids", | ||
) | ||
|
||
@api.depends("line_ids.analytic_line_ids") | ||
def _compute_analytic_line_ids(self): | ||
for move in self: | ||
move.analytic_line_ids = move.line_ids.mapped("analytic_line_ids") | ||
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,4 @@ | ||
* `Escodoo <https://escodoo.com.br>`_: | ||
|
||
* Marcel Savegnago <[email protected]> | ||
* Wesley Oliveira <[email protected]> |
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 @@ | ||
This module allows to split analytic lines in two or more lines. |
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,15 @@ | ||
To split an analytic line: | ||
|
||
#. Go to Invoicing > Configuration > Management > Analytic Items. | ||
#. Open an Anlytic Entry. | ||
#. Click on "Split Line" button to open the wizard. | ||
#. Create the lines setting the Analytic Account and Percentage of the amount. | ||
#. The new lines will be created and displayed in "Child Lines" notebook. | ||
|
||
To split an analytic line directly from the Account Move: | ||
|
||
#. Open one Account Move (a Journal Entry, Bill or Invoice). | ||
#. Go to "Analytic Lines" notebook. | ||
#. Click on "Split Line" button inside the line to open the wizard. | ||
#. Create the lines setting the Analytic Account and Percentage of the amount. | ||
#. The new lines will be created and displayed in notebook. |
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 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_analytic_line_split_wizard,analytic.line.split.wizard,model_analytic_line_split_wizard,analytic.group_analytic_accounting,1,1,1,1 | ||
access_analytic_line_split,analytic.line.split,model_analytic_line_split,analytic.group_analytic_accounting,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.