Skip to content

Commit

Permalink
[ADD] l10n_it_reverse_charge_triple_discount: added new module for ma…
Browse files Browse the repository at this point in the history
…nager triple discount on reverse charge
  • Loading branch information
Borruso committed Oct 18, 2024
1 parent 92535f0 commit 4e38718
Show file tree
Hide file tree
Showing 15 changed files with 649 additions and 1 deletion.
7 changes: 6 additions & 1 deletion l10n_it_reverse_charge/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,11 +545,16 @@ def button_draft(self):
self_purchase_invoice.button_draft()
return super(AccountMove, new_self).button_draft()

def get_discount_for_rc(self, line):
"""Hook for compute discount correctly"""
return line.discount

def get_tax_amount_added_for_rc(self):
res = 0
for line in self.invoice_line_ids:
if line.rc:
price_unit = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
discount = self.get_discount_for_rc(line)
price_unit = line.price_unit * (1 - (discount or 0.0) / 100.0)
taxes = line.tax_ids.compute_all(
price_unit,
self.currency_id,
Expand Down
82 changes: 82 additions & 0 deletions l10n_it_reverse_charge_triple_discount/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
=======================================================
ITA - Inversione contabile - Integrazione sconto triplo
=======================================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:8e1a3f23dc53cc4761c9e57d6b28a292c4b0c02ce2f035466d0858cfbfecad1f
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_reverse_charge_triple_discount
:alt: OCA/l10n-italy
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_reverse_charge_triple_discount
: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/l10n-italy&target_branch=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

**Italiano**

Questo modulo consente di gestire correttamente l'inversione contabile quando il modulo account_invoice_triple_discount è installato.

**English**

The module allows to manage correctly the reverse charge when the module account_invoice_triple_discount is installed.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/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/l10n-italy/issues/new?body=module:%20l10n_it_reverse_charge_triple_discount%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
~~~~~~~

* Giuseppe Borruso

Contributors
~~~~~~~~~~~~

* Giuseppe Borruso <[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/l10n-italy <https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_reverse_charge_triple_discount>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions l10n_it_reverse_charge_triple_discount/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright 2024 Giuseppe Borruso - Dinamiche Aziendali srl

from . import models
18 changes: 18 additions & 0 deletions l10n_it_reverse_charge_triple_discount/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024 Giuseppe Borruso - Dinamiche Aziendali srl
# License LGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

{
"name": "ITA - Inversione contabile - Integrazione sconto triplo",
"version": "14.0.1.0.0",
"category": "Localization/Italy",
"summary": "Modulo ponte tra inversione contabile e sconto triplo",
"author": "Giuseppe Borruso, Odoo Community Association (OCA)",
"license": "LGPL-3",
"website": "https://github.com/OCA/l10n-italy",
"depends": [
"l10n_it_reverse_charge",
"account_invoice_triple_discount",
],
"data": [],
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_it_reverse_charge_triple_discount
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-01 14:07+0000\n"
"PO-Revision-Date: 2024-07-01 14:07+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: l10n_it_reverse_charge_triple_discount
#: model:ir.model.fields,field_description:l10n_it_reverse_charge_triple_discount.field_account_move__display_name
msgid "Display Name"
msgstr "Nome visualizzato"

#. module: l10n_it_reverse_charge_triple_discount
#: model:ir.model.fields,field_description:l10n_it_reverse_charge_triple_discount.field_account_move__id
msgid "ID"
msgstr ""

#. module: l10n_it_reverse_charge_triple_discount
#: model:ir.model,name:l10n_it_reverse_charge_triple_discount.model_account_move
msgid "Journal Entry"
msgstr "Registrazione contabile"

#. module: l10n_it_reverse_charge_triple_discount
#: model:ir.model.fields,field_description:l10n_it_reverse_charge_triple_discount.field_account_move____last_update
msgid "Last Modified on"
msgstr "Ultima modifica il"
3 changes: 3 additions & 0 deletions l10n_it_reverse_charge_triple_discount/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright 2024 Giuseppe Borruso - Dinamiche Aziendali srl

from . import account_move
24 changes: 24 additions & 0 deletions l10n_it_reverse_charge_triple_discount/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2024 Giuseppe Borruso - Dinamiche Aziendali srl

import functools

from odoo import models


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

def rc_inv_line_vals(self, line):
line_vals = super().rc_inv_line_vals(line)
line_vals["discount2"] = line.discount2
line_vals["discount3"] = line.discount3
return line_vals

def get_discount_for_rc(self, line):
discount_values = [
1 - (line.discount or 0.0) / 100.0,
1 - (line.discount2 or 0.0) / 100.0,
1 - (line.discount3 or 0.0) / 100.0,
]
res = (1 - functools.reduce((lambda x, y: x * y), discount_values)) * 100
return res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Giuseppe Borruso <[email protected]>
7 changes: 7 additions & 0 deletions l10n_it_reverse_charge_triple_discount/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**Italiano**

Questo modulo consente di gestire correttamente l'inversione contabile quando il modulo account_invoice_triple_discount è installato.

**English**

The module allows to manage correctly the reverse charge when the module account_invoice_triple_discount is installed.
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 4e38718

Please sign in to comment.