Skip to content

Commit

Permalink
[ADD] account_compensate_advance: add new module
Browse files Browse the repository at this point in the history
  • Loading branch information
kaynnan committed Jun 4, 2024
1 parent 7c83e72 commit 087d367
Show file tree
Hide file tree
Showing 23 changed files with 1,370 additions and 0 deletions.
96 changes: 96 additions & 0 deletions account_compensate_advance/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
===============
Account Advance
===============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b31048a0d09e9bb80e5a67333760d5339ecf9df289bb9d7d742276a8ac6d79b5
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-Escodoo%2Faccount--addons-lightgray.png?logo=github
:target: https://github.com/Escodoo/account-addons/tree/14.0/account_compensate_advance
:alt: Escodoo/account-addons

|badge1| |badge2| |badge3|

The Account Compensate Advance enhances the accounting functionality in Odoo by enabling advanced handling of advances for suppliers and customers. This module streamlines the process of creating, managing, and compensating advances, ensuring accurate financial.

**Table of contents**

.. contents::
:local:

Configuration
=============

After installing the module, follow these steps to configure it for the desired company:

#. Go to Invoice > Configuration > Journals.
#. Select an existing journal or create a new one of type Miscellaneous.
#. In the journal view, click on the Advance Journal tab.
#. Set the journal type to Advance.
#. Specify the Advance Account Type (Supplier or Customer).
#. Specify the Account where the advance will be recorded.

Usage
=====

To use this module:

#. Ensure you have a Miscellaneous type journal configured as an Advance Journal with the appropriate settings.
#. Select the type of invoice to be created/used (In Invoice or Out Invoice).
#. In the Supplier/Customer menu, access the Advance submenu.
#. Create an advance through the Advance menu.
#. Create or select an invoice for the partner specified in the advance.
#. Once the invoice status is posted, a button to Compensate the Advance will appear at the top of the screen.
#. Select an Advance Journal.
#. Select the created advance for that journal.
#. Select the invoice line to be compensated.
#. The amount will be displayed according to the invoice line, allowing modifications as long as it is not less than 0 or more than the line amount.
#. The Entry Date corresponds to the invoice line date but can be changed to another date.
#. After filling in the necessary fields, click Compensate.
#. You will be redirected back to the invoice with the payment status updated to either Partial or Paid, depending on the amount entered.
#. To view advances, go to Supplier/Customer > Advance > Advances. The movements will be displayed in a tree view, and compensations will be separated by the advance reference when created.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/Escodoo/account-addons/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/Escodoo/account-addons/issues/new?body=module:%20account_compensate_advance%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://www.escodoo.com.br>`_:

* Marcel Savegnago <[email protected]>
* Kaynnan Lemes <[email protected]>
* Douglas Custodio <[email protected]>

Maintainers
~~~~~~~~~~~

This module is part of the `Escodoo/account-addons <https://github.com/Escodoo/account-addons/tree/14.0/account_compensate_advance>`_ project on GitHub.

You are welcome to contribute.
2 changes: 2 additions & 0 deletions account_compensate_advance/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizard
19 changes: 19 additions & 0 deletions account_compensate_advance/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2024 - TODAY, Escodoo
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Account Advance",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "Escodoo",
"website": "https://github.com/Escodoo/account-addons",
"depends": ["account"],
"data": [
"security/ir.model.access.csv",
"views/account_move_views.xml",
"views/account_menuitem.xml",
"views/account_journal.xml",
"wizard/account_create_advance_journal.xml",
"wizard/account_compensate_advance_journal.xml",
],
}
2 changes: 2 additions & 0 deletions account_compensate_advance/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import account_move
from . import account_journal
50 changes: 50 additions & 0 deletions account_compensate_advance/models/account_journal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright 2024 - TODAY, Kaynnan Lemes <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, api, fields, models

ACCOUNT_TYPES = [
("supplier", _("Supplier")),
("customer", _("Customer")),
]
DOMAIN_ADVANCE_ACCOUNT = [
("user_type_id.type", "!=", "payable"),
("user_type_id.type", "!=", "receivable"),
("reconcile", "=", True),
]


class AccountJournal(models.Model):

_inherit = "account.journal"

is_advance_journal = fields.Boolean(
string="Is Advance Journal",
help="Check this box if this journal is for advances",
)

advance_account_type = fields.Selection(
selection=ACCOUNT_TYPES,
string="Advance Account Type",
help="Select the type of advance account to be filled",
default="supplier",
)

advance_account_supplier_id = fields.Many2one(
"account.account",
string="Advance Account for Suppliers",
domain=DOMAIN_ADVANCE_ACCOUNT,
help="Advance account for supplier payments",
)

advance_account_customer_id = fields.Many2one(
"account.account",
string="Advance Account for Customers",
domain=DOMAIN_ADVANCE_ACCOUNT,
help="Advance account for customer payments",
)

@api.onchange("advance_account_type", "is_advance_journal")
def _onchange_clear_advance_account_info(self):
self.advance_account_supplier_id = False
self.advance_account_customer_id = False
28 changes: 28 additions & 0 deletions account_compensate_advance/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2024 - TODAY, Kaynnan Lemes <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, fields, models


class AccountMove(models.Model):

_inherit = "account.move"

is_advance_move = fields.Boolean(
string="Advance Move",
)

def action_compensate_advance(self):

return {
"name": _("Compensate Advance"),
"res_model": "account.compensate.advance.journal",
"view_mode": "form",
"context": {
"active_model": "account.move",
"active_ids": self.ids,
"default_move_type": self.env.context.get("default_move_type"),
},
"target": "new",
"type": "ir.actions.act_window",
}
8 changes: 8 additions & 0 deletions account_compensate_advance/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
After installing the module, follow these steps to configure it for the desired company:

#. Go to Invoice > Configuration > Journals.
#. Select an existing journal or create a new one of type Miscellaneous.
#. In the journal view, click on the Advance Journal tab.
#. Set the journal type to Advance.
#. Specify the Advance Account Type (Supplier or Customer).
#. Specify the Account where the advance will be recorded.
5 changes: 5 additions & 0 deletions account_compensate_advance/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* `Escodoo <https://www.escodoo.com.br>`_:

* Marcel Savegnago <[email protected]>
* Kaynnan Lemes <[email protected]>
* Douglas Custodio <[email protected]>
1 change: 1 addition & 0 deletions account_compensate_advance/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The Account Compensate Advance enhances the accounting functionality in Odoo by enabling advanced handling of advances for suppliers and customers. This module streamlines the process of creating, managing, and compensating advances, ensuring accurate financial.
16 changes: 16 additions & 0 deletions account_compensate_advance/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
To use this module:

#. Ensure you have a Miscellaneous type journal configured as an Advance Journal with the appropriate settings.
#. Select the type of invoice to be created/used (In Invoice or Out Invoice).
#. In the Supplier/Customer menu, access the Advance submenu.
#. Create an advance through the Advance menu.
#. Create or select an invoice for the partner specified in the advance.
#. Once the invoice status is posted, a button to Compensate the Advance will appear at the top of the screen.
#. Select an Advance Journal.
#. Select the created advance for that journal.
#. Select the invoice line to be compensated.
#. The amount will be displayed according to the invoice line, allowing modifications as long as it is not less than 0 or more than the line amount.
#. The Entry Date corresponds to the invoice line date but can be changed to another date.
#. After filling in the necessary fields, click Compensate.
#. You will be redirected back to the invoice with the payment status updated to either Partial or Paid, depending on the amount entered.
#. To view advances, go to Supplier/Customer > Advance > Advances. The movements will be displayed in a tree view, and compensations will be separated by the advance reference when created.
3 changes: 3 additions & 0 deletions account_compensate_advance/security/ir.model.access.csv
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_account_create_advance,account.create.advance.journal,model_account_create_advance_journal,account.group_account_invoice,1,1,1,1
access_account_compensate_advance,account.compensate.advance.journal,model_account_compensate_advance_journal,account.group_account_invoice,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.
Loading

0 comments on commit 087d367

Please sign in to comment.