Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] account_global_discount: Migration to 17.0 #1687

Merged
merged 41 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
fddb91e
[ADD][11.0] account_global_discount: New Module
chienandalu Aug 22, 2019
fb18fc1
[FIX+IMP] account_global_discount: link line taxes to discount move l…
chienandalu Apr 9, 2020
cccbc7d
[FIX] account_global_discount: More on global discount/taxes link
pedrobaeza Jul 3, 2020
f5739c6
[MIG] acount_global_discount: Migration to 12.0
pedrobaeza Jul 8, 2020
e8d3d59
[IMP] account_global_discount: Deprecated use of currency compute
pedrobaeza Jul 20, 2020
93e4772
Added translation using Weblate (Portuguese)
pedrocs-exo Sep 17, 2020
6fd56d3
[FIX] account_global_discount: Fix singleton error in _compute_amount
pedrobaeza Sep 25, 2020
6840693
[FIX][12.0] account_global_discount: sale order templates compatibility
pedrocs-exo Oct 13, 2020
48df2cc
[IMP] account_global_discount: black, isort, prettier
Nov 3, 2020
ad34c78
[MIG] account_global_discount: Migration to 13.0
Nov 5, 2020
afb235e
[FIX] account_global_discount: wrong tax move line discounts on invoi…
Dec 23, 2020
47b3bdc
[FIX] account_global_discount: Compute global discount with 0% taxes
victoralmau Jan 26, 2021
9abbac0
Added translation using Weblate (Dutch)
Jan 29, 2021
e0e73dd
Update translation files
oca-transbot Mar 8, 2021
2c43fc1
Translated using Weblate (Spanish)
anasuarez1 Mar 10, 2021
4f2dd8a
[FIX] account_global_discount: Fix tests
victoralmau Mar 15, 2021
dd96d88
[FIX] account_global_discount: discounts on create
chienandalu Apr 20, 2021
86f13ac
[IMP] account_global_discount: security group
chienandalu Dec 11, 2020
9fc2ab9
[FIX] account_global_discount: Prevent error when add more taxes in m…
victoralmau Jun 22, 2021
a944ab2
[FIX+REF] account_global_discount: Include taxes in global discount m…
pedrobaeza Jul 6, 2021
f5b68b5
[FIX] account_global_discount: Call the proper method on create
pedrobaeza Jul 19, 2021
364f976
[MIG] account_global_discount: Migration to 14.0
omar7r Aug 23, 2021
4941f71
[IMP] account_global_discount: securization for multi-company
omar7r Nov 9, 2021
a7c0936
[IMP] account_global_discount: Global discounts into invoice analysis…
omar7r Jan 11, 2022
abeb25a
Added translation using Weblate (Italian)
francesco-ooops Mar 2, 2022
ec10270
[FIX] *: Change _recompute_tax_lines args according upstream
pedrobaeza Jul 3, 2022
8d5407c
Translated using Weblate (Portuguese)
pedrocs-exo Aug 17, 2022
eba0b0f
[MIG] account_global_discount: Migration to 15.0
kirca Oct 21, 2022
54b42f1
[FIX] account_global_discount: multi-currency
kirca Dec 13, 2022
13f47f1
[FIX] account_global_discount: Make tests resilient
OCA-git-bot Aug 16, 2023
814d2d8
[IMP] account_global_discount, added init hook to avoid memory issues…
ChrisOForgeFlow Apr 26, 2023
feed186
[MIG] account_global_discount: 16.0
ferran-S73 Jan 4, 2023
72350d4
[IMP] account_global_discount: Remake amount global discount
Rferri44-S73 Jun 21, 2023
895fc52
[UPD] Update account_global_discount.pot
May 17, 2024
d516e4a
[BOT] post-merge updates
OCA-git-bot May 17, 2024
144c2d4
[16.0][IMP] account_global_discount: exclude products from global disc
ferran-S73 May 20, 2024
5347952
[BOT] post-merge updates
OCA-git-bot Jun 19, 2024
9f72628
Translated using Weblate (Italian)
mymage Jul 4, 2024
3d76c83
Translated using Weblate (Italian)
mymage Jul 31, 2024
753fac7
[IMP] account_global_discount: pre-commit auto fixes
miguel-S73 Aug 14, 2024
5feaf74
[MIG] account_global_discount: Migration to 17.0
miguel-S73 Aug 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 134 additions & 0 deletions account_global_discount/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
=======================
Account Global Discount
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2ca255fdd44114cd7497a3f2adf9e073832d649ae20b802c09d6ac7dc415050e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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--invoicing-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoicing/tree/17.0/account_global_discount
:alt: OCA/account-invoicing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-invoicing-17-0/account-invoicing-17-0-account_global_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/account-invoicing&target_branch=17.0
:alt: Try me on Runboat

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

Apply global discounts to invoices

**Table of contents**

.. contents::
:local:

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

To configure this module, you need to:

1. Go to *Settings > Parameters > Global Discounts*.
2. Add a new discount percentage.
3. Choose the discount scope (sales or purchases).
4. You can also restrict it to a certain company if needed.

You can assign global discounts to partners as well:

1. Go to a partner that is a company.
2. Go to the *Sales & Purchases* tab.
3. In section sale, you can set sale discounts.
4. In section purchase, you can set purchase discounts.

Usage
=====

To use this module, you need to:

1. Go to *Invoicing > Customers > Invoices*.
2. Create a new sales invoice, choose a customer with a defined global
discount and you will see how the value of the 'Invoice Global
Discounts' field is auto-completed with the global discounts defined
in the customer (See configuration section in this readme), although
you can choose then other global discounts defined in configuration.
3. Add several invoice lines.
4. At the bottom of the form you will see how global discounts affect
the total values.
5. Go to the 'Journal Items' tab (if you have permissions for that).
There you will see how the tax lines have the discount percentage
applied and you will also see the lines that reflect the global
discount applied.
6. In the 'Other info' tab, you can see in the 'Global Discounts' table,
the global discounts applied to each of the invoice lines.

Known issues / Roadmap
======================

- Not all the taxes combination can be compatible with global
discounts, as the generated journal items won't be correct for taxes
declarations. An error is raised in that cases.
- Currently, taxes in invoice lines are mandatory with global
discounts.
- No tax tags are populated for the global discount move lines, only
tax_ids.

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

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

* Tecnativa

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

- `Tecnativa <https://www.tecnativa.com>`__

- Pedro M. Baeza
- David Vidal
- Carlos Dauden
- Rafael Blasco
- Ernesto Tejeda
- Víctor Martínez

- Omar Castiñeira <[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-invoicing <https://github.com/OCA/account-invoicing/tree/17.0/account_global_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 account_global_discount/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import models
from . import report
from .hooks import _pre_init_global_discount_fields
22 changes: 22 additions & 0 deletions account_global_discount/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2019 Tecnativa S.L. - David Vidal
# Copyright 2020-2021 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Account Global Discount",
"version": "17.0.1.0.0",
"category": "Accounting",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-invoicing",
"license": "AGPL-3",
"depends": ["account", "base_global_discount"],
"data": [
"security/ir.model.access.csv",
"security/security.xml",
"views/account_invoice_views.xml",
"views/global_discount_views.xml",
"views/report_account_invoice.xml",
],
"application": False,
"installable": True,
"pre_init_hook": "_pre_init_global_discount_fields",
}
30 changes: 30 additions & 0 deletions account_global_discount/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from odoo.tools.sql import column_exists


def _pre_init_global_discount_fields(env):
if not column_exists(env.cr, "account_move", "amount_global_discount"):
env.cr.execute(
"""
ALTER TABLE "account_move"
ADD COLUMN "amount_global_discount" double precision DEFAULT 0
"""
)
env.cr.execute(
"""
ALTER TABLE "account_move" ALTER COLUMN "amount_global_discount" DROP DEFAULT
"""
)
if not column_exists(
env.cr, "account_move", "amount_untaxed_before_global_discounts"
):
env.cr.execute(
"""
ALTER TABLE "account_move"
ADD COLUMN "amount_untaxed_before_global_discounts" double precision
"""
)
env.cr.execute(
"""
update account_move set amount_untaxed_before_global_discounts = amount_untaxed
"""
)
Empty file.
Loading