-
-
Notifications
You must be signed in to change notification settings - Fork 132
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
612df64
commit 976534c
Showing
34 changed files
with
1,878 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,177 @@ | ||
================ | ||
TMS - Accounting | ||
================ | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:db45d1c10ff3e81a786462d23541170716b867d6c2a502a5a6358c7a19af5841 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Alpha | ||
.. |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%2Fstock--logistics--transport-lightgray.png?logo=github | ||
:target: https://github.com/OCA/stock-logistics-transport/tree/17.0/tms_account | ||
:alt: OCA/stock-logistics-transport | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/stock-logistics-transport-17-0/stock-logistics-transport-17-0-tms_account | ||
: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/stock-logistics-transport&target_branch=17.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
The TMS - Accounting manages the accounting processes for the TMS | ||
modules. This module enables features such as purchase orders invoicing, | ||
sale order invoicing and analytic accounting. | ||
|
||
.. IMPORTANT:: | ||
This is an alpha version, the data model and design can change at any time without warning. | ||
Only for development or testing purpose, do not use in production. | ||
`More details on development status <https://odoo-community.org/page/development-status>`_ | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Installation | ||
============ | ||
|
||
There are two ways of installing the module: | ||
|
||
Transport settings | ||
------------------ | ||
|
||
1. Go to Transport app. | ||
2. Go to Configuration > Settings. | ||
3. In the Trips block, enable the "Manage Trips Accounting" setting. | ||
|
||
Apps list | ||
--------- | ||
|
||
1. Go to Apps. | ||
2. Search for TMS - Accounting module. | ||
3. Install the module. | ||
|
||
Configuration | ||
============= | ||
|
||
Analytic Distribution | ||
--------------------- | ||
|
||
1. Go to Transport module. | ||
2. Go to Configuration > Settings. | ||
3. In the trips block, check the "Analytic Accounting" setting. | ||
4. Check the "Trips" box to create analytic accounts for each trip using | ||
this plan. | ||
5. If routes are enabled, check the "Routes" box to create analytic | ||
accounts for each route using this plan. | ||
|
||
Usage | ||
===== | ||
|
||
Create sale order invoices | ||
-------------------------- | ||
|
||
1. Go to Sale module. | ||
2. Create a new sale quotation. | ||
3. Add the trips to the Products page in the order. | ||
4. When saving, the trips are created as drafts. | ||
5. In the trips, check the "Create invoices and bills when completed?" | ||
box. | ||
6. Change the state of the trip to "Completed" and the invoices will be | ||
generated (Sale order needs to be confirmed). | ||
|
||
Create purchase bill | ||
-------------------- | ||
|
||
1. Go to Transport module. | ||
2. Create or select a trip. | ||
3. Add purchases to the Purchase page. | ||
4. Check the "Create invoices and bills when completed?" box. | ||
5. Change the state of the trip to "Completed" and the bills will be | ||
generated (Purchase order needs to be confirmed). | ||
|
||
Analytic Accounting | ||
------------------- | ||
|
||
1. When adding trips to sale orders, the analytic account will be set by | ||
default with the trip account and the route account (Depending on | ||
which plans are enabled in the configration). | ||
2. When adding purchase orders to trips, the analytic account will be | ||
set by default with the trip account and the route account (Depending | ||
on which plans are enabled in the configration). | ||
3. When adding expenses to trips, the analytic account will be set by | ||
default with the trip account and the route account (Depending on | ||
which plans are enabled in the configration). | ||
4. In the section of Transport > Reporting, the total revenue can be | ||
seen for each trip and route according to the analytic accounts. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-transport/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/stock-logistics-transport/issues/new?body=module:%20tms_account%0Aversion:%2017.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 | ||
------- | ||
|
||
* Open Source Integrators | ||
|
||
Contributors | ||
------------ | ||
|
||
- Santiago Rodriguez srodriguez@opensourceintegrators.com | ||
- Edgar Martinez emartinez@opensourceintegrators.com | ||
- Maxime Chambreuil mchambreuil@opensourceintegrators.com | ||
|
||
Other credits | ||
------------- | ||
|
||
- Open Source Integrators https://opensourceintegrators.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. | ||
|
||
.. |maintainer-max3903| image:: https://github.com/max3903.png?size=40px | ||
:target: https://github.com/max3903 | ||
:alt: max3903 | ||
.. |maintainer-santiagordz| image:: https://github.com/santiagordz.png?size=40px | ||
:target: https://github.com/santiagordz | ||
:alt: santiagordz | ||
.. |maintainer-EdgarRetes| image:: https://github.com/EdgarRetes.png?size=40px | ||
:target: https://github.com/EdgarRetes | ||
:alt: EdgarRetes | ||
|
||
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-max3903| |maintainer-santiagordz| |maintainer-EdgarRetes| | ||
|
||
This module is part of the `OCA/stock-logistics-transport <https://github.com/OCA/stock-logistics-transport/tree/17.0/tms_account>`_ 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 @@ | ||
# Copyright (C) 2024 Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
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 (C) 2024 Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "TMS - Accounting", | ||
"summary": "Track invoices linked to TMS orders", | ||
"version": "17.0.1.0.0", | ||
"category": "Field Service", | ||
"author": "Open Source Integrators, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/stock-logistics-transport", | ||
"depends": ["tms", "tms_sale", "tms_expense", "tms_purchase", "account_usability"], | ||
"data": [ | ||
"security/res_groups.xml", | ||
"data/analytic_plan.xml", | ||
"views/res_config_settings.xml", | ||
"views/account_move.xml", | ||
"views/account_analytic_plan.xml", | ||
"views/tms_order.xml", | ||
"views/tms_route.xml", | ||
], | ||
"license": "AGPL-3", | ||
"development_status": "Alpha", | ||
"maintainers": ["max3903", "santiagordz", "EdgarRetes"], | ||
} |
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,12 @@ | ||
<odoo noupdate="1"> | ||
|
||
<record id="tms_route_analytic_plan" model="account.analytic.plan"> | ||
<field name="name">Routes</field> | ||
<field name="tms_flag">True</field> | ||
</record> | ||
<record id="tms_order_analytic_plan" model="account.analytic.plan"> | ||
<field name="name">Trips</field> | ||
<field name="tms_flag">True</field> | ||
</record> | ||
|
||
</odoo> |
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,12 @@ | ||
from . import account_analytic_plan | ||
from . import res_config_settings | ||
from . import tms_order | ||
from . import analytic_account | ||
from . import tms_route | ||
from . import account_move | ||
from . import account_move_line | ||
from . import purchase_order_line | ||
from . import hr_expense | ||
from . import sale_order_line | ||
from . import sale_order | ||
from . import account_analytic_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,24 @@ | ||
# Copyright (C) 2024 Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from odoo import api, models | ||
|
||
|
||
class AccountAnalyticLine(models.Model): | ||
_inherit = "account.analytic.line" | ||
|
||
@api.model | ||
def create(self, vals): | ||
line = super().create(vals) | ||
if "x_plan3_id" in vals: | ||
amount = line.amount | ||
if amount < 0: | ||
line.x_plan3_id.trip_id.total_expenses += abs(amount) | ||
else: | ||
line.x_plan3_id.trip_id.total_income += amount | ||
if "x_plan2_id" in vals: | ||
amount = line.amount | ||
if amount < 0: | ||
line.x_plan2_id.route_id.total_expenses += abs(amount) | ||
else: | ||
line.x_plan2_id.route_id.total_income += amount | ||
return 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,14 @@ | ||
# Copyright (C) 2024 Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from odoo import fields, models | ||
|
||
|
||
class AccountAnalyticPlan(models.Model): | ||
_inherit = "account.analytic.plan" | ||
|
||
tms_flag = fields.Boolean( | ||
string="Used for Transports?", | ||
help="""This plan is used as a default in the Transport application. | ||
""", | ||
readonly=True, | ||
) |
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,31 @@ | ||
# Copyright (C) 2024 Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from odoo import api, fields, models | ||
|
||
|
||
class AccountMove(models.Model): | ||
_inherit = "account.move" | ||
|
||
has_tms_order = fields.Boolean(readonly=True, compute="_compute_has_trip") | ||
|
||
@api.depends("line_ids") | ||
def _compute_has_trip(self): | ||
for record in self: | ||
if record.line_ids.sale_line_ids.order_id.tms_order_ids: | ||
record.has_tms_order = True | ||
else: | ||
record.has_tms_order = False | ||
|
||
def action_view_tms_orders(self): | ||
self.ensure_one() | ||
tms_orders = self.line_ids.sale_line_ids.order_id.tms_order_ids | ||
action = self.env["ir.actions.act_window"]._for_xml_id( | ||
"tms.action_tms_dash_order" | ||
) | ||
if len(tms_orders) > 1: | ||
action["domain"] = [("id", "in", tms_orders.ids)] | ||
else: | ||
action["views"] = [(self.env.ref("tms.tms_order_view_form").id, "form")] | ||
action["res_id"] = tms_orders.id | ||
|
||
return action | ||
Oops, something went wrong.