Skip to content

Commit

Permalink
[16.0][ADD] account_move_line_related_taxes_amount:
Browse files Browse the repository at this point in the history
  • Loading branch information
Berezi committed Jan 21, 2025
1 parent fea1f23 commit 15e9eae
Show file tree
Hide file tree
Showing 10 changed files with 153 additions and 0 deletions.
29 changes: 29 additions & 0 deletions account_move_line_related_taxes_amount/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

======================================
Account move line related taxes amount
======================================

* Field in account move line that calculates the account credit amount.

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

Bugs are tracked on `GitHub Issues
<https://github.com/avanzosc/odoo-addons/issues>`_. In case of trouble,
please check there if your issue has already been reported. If you spotted
it first, help us smash it by providing detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Contributors
------------

* Berezi Amubieta <[email protected]>
* Ana Juaristi <[email protected]>

1 change: 1 addition & 0 deletions account_move_line_related_taxes_amount/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions account_move_line_related_taxes_amount/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 Berezi Amubieta - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Account Move Line Related Taxes Amount",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"depends": [
"account",
],
"author": "AvanzOSC",
"website": "https://github.com/avanzosc/odoo-addons",
"category": "Accounting",
"data": [
"views/account_move_view.xml",
],
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_line_related_taxes_amount
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-21 12:16+0000\n"
"PO-Revision-Date: 2025-01-21 12:16+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: account_move_line_related_taxes_amount
#: model:ir.model,name:account_move_line_related_taxes_amount.model_account_move_line
msgid "Journal Item"
msgstr ""

#. module: account_move_line_related_taxes_amount
#: model:ir.model.fields,field_description:account_move_line_related_taxes_amount.field_account_move_line__related_taxes_amount
msgid "Related Taxes Amount"
msgstr ""
26 changes: 26 additions & 0 deletions account_move_line_related_taxes_amount/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_line_related_taxes_amount
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-21 12:16+0000\n"
"PO-Revision-Date: 2025-01-21 12:16+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: account_move_line_related_taxes_amount
#: model:ir.model,name:account_move_line_related_taxes_amount.model_account_move_line
msgid "Journal Item"
msgstr "Apunte contable"

#. module: account_move_line_related_taxes_amount
#: model:ir.model.fields,field_description:account_move_line_related_taxes_amount.field_account_move_line__related_taxes_amount
msgid "Related Taxes Amount"
msgstr "Saldo cuenta"
1 change: 1 addition & 0 deletions account_move_line_related_taxes_amount/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_move_line
34 changes: 34 additions & 0 deletions account_move_line_related_taxes_amount/models/account_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2024 Berezi Amubieta - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models


class AccountMoveLine(models.Model):
_inherit = "account.move.line"

related_taxes_amount = fields.Float(
compute="_compute_related_taxes_amount",
)

@api.depends(
"account_id",
"account_id.related_taxes_amount",
"debit",
"credit",
"move_id.invoice_line_ids",
"move_id.invoice_line_ids.credit",
"move_id.invoice_line_ids.account_id",
)
def _compute_related_taxes_amount(self):
for line in self:
amount = 0
if line.account_id:
amount = line.account_id.related_taxes_amount
debit = line.debit
same_account_lines = line.move_id.invoice_line_ids.filtered(
lambda c: c.account_id == line.account_id
)
credit = sum(same_account_lines.mapped("credit"))
amount = amount - debit - credit
line.related_taxes_amount = amount
12 changes: 12 additions & 0 deletions account_move_line_related_taxes_amount/views/account_move_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_move_form" model="ir.ui.view">
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form" />
<field name="arch" type="xml">
<button name="action_automatic_entry" position="before">
<field name="related_taxes_amount" optional="show" />
</button>
</field>
</record>
</odoo>
6 changes: 6 additions & 0 deletions setup/account_move_line_related_taxes_amount/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit 15e9eae

Please sign in to comment.