Skip to content

Commit d7e09b1

Browse files
committed
Merge PR #2109 into 16.0
Signed-off-by sergiocorato
2 parents 65014ba + 5d9dd7c commit d7e09b1

File tree

36 files changed

+937
-81
lines changed

36 files changed

+937
-81
lines changed

.copier-answers.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ odoo_test_flavor: Both
1616
odoo_version: 16.0
1717
org_name: Odoo Community Association (OCA)
1818
org_slug: OCA
19-
rebel_module_groups:
20-
- account_invoice_triple_discount,account_invoice_supplierinfo_update_triple_discount
21-
- account_invoice_fixed_discount
19+
rebel_module_groups: []
2220
repo_description: 'TODO: add repo description.'
2321
repo_name: account-invoicing
2422
repo_slug: account-invoicing

.github/workflows/test.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,8 @@ jobs:
3636
matrix:
3737
include:
3838
- container: ghcr.io/oca/oca-ci/py3.10-odoo16.0:latest
39-
include: "account_invoice_triple_discount,account_invoice_supplierinfo_update_triple_discount"
4039
name: test with Odoo
4140
- container: ghcr.io/oca/oca-ci/py3.10-ocb16.0:latest
42-
include: "account_invoice_triple_discount,account_invoice_supplierinfo_update_triple_discount"
43-
name: test with OCB
44-
makepot: "true"
45-
- container: ghcr.io/oca/oca-ci/py3.10-odoo16.0:latest
46-
include: "account_invoice_fixed_discount"
47-
name: test with Odoo
48-
- container: ghcr.io/oca/oca-ci/py3.10-ocb16.0:latest
49-
include: "account_invoice_fixed_discount"
50-
name: test with OCB
51-
makepot: "true"
52-
- container: ghcr.io/oca/oca-ci/py3.10-odoo16.0:latest
53-
exclude: "account_invoice_triple_discount,account_invoice_supplierinfo_update_triple_discount,account_invoice_fixed_discount"
54-
name: test with Odoo
55-
- container: ghcr.io/oca/oca-ci/py3.10-ocb16.0:latest
56-
exclude: "account_invoice_triple_discount,account_invoice_supplierinfo_update_triple_discount,account_invoice_fixed_discount"
5741
name: test with OCB
5842
makepot: "true"
5943
services:
@@ -65,9 +49,6 @@ jobs:
6549
POSTGRES_DB: odoo
6650
ports:
6751
- 5432:5432
68-
env:
69-
INCLUDE: "${{ matrix.include }}"
70-
EXCLUDE: "${{ matrix.exclude }}"
7152
steps:
7253
- uses: actions/checkout@v4
7354
with:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ addon | version | maintainers | summary
4040
[account_invoice_discount_display_amount](account_invoice_discount_display_amount/) | 16.0.1.1.2 | | Show total discount applied and total without discount on invoices.
4141
[account_invoice_fiscal_position_update](account_invoice_fiscal_position_update/) | 16.0.1.0.2 | <a href='https://github.com/alexis-via'><img src='https://github.com/alexis-via.png' width='32' height='32' style='border-radius:50%;' alt='alexis-via'/></a> | Changing the fiscal position of an invoice will auto-update invoice lines
4242
[account_invoice_fixed_discount](account_invoice_fixed_discount/) | 16.0.2.0.0 | | Allows to apply fixed amount discounts in invoices.
43+
[account_invoice_fixed_triple_discount](account_invoice_fixed_triple_discount/) | 16.0.1.0.0 | | Compatibility between fixed and triple discount modules
4344
[account_invoice_force_number](account_invoice_force_number/) | 16.0.1.0.1 | | Allows to force invoice numbering on specific invoices
4445
[account_invoice_google_document_ai](account_invoice_google_document_ai/) | 16.0.1.0.0 | | Allows to import data from document using Google Document AI
4546
[account_invoice_line_default_account](account_invoice_line_default_account/) | 16.0.1.0.0 | | Account Invoice Line Default Account

account_invoice_fixed_discount/README.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
15
======================
26
Account Fixed Discount
37
======================
@@ -13,7 +17,7 @@ Account Fixed Discount
1317
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1418
:target: https://odoo-community.org/page/development-status
1519
:alt: Beta
16-
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
20+
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
1721
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1822
:alt: License: AGPL-3
1923
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github
@@ -33,6 +37,8 @@ amount discounts at invoice line level.
3337

3438
The module also extends the invoice report to show fixed discount.
3539

40+
If the module `account_invoice_triple_discount` is installed and a fixed discount is set, it will take priority over anything set in the triple discount fields.
41+
3642
**Table of contents**
3743

3844
.. contents::

account_invoice_fixed_discount/__manifest__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"application": False,
1313
"installable": True,
1414
"depends": ["account"],
15-
"excludes": ["account_invoice_triple_discount"],
1615
"data": [
1716
"security/res_groups.xml",
1817
"views/account_move_view.xml",

account_invoice_fixed_discount/readme/DESCRIPTION.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ This module extends the functionality of Invoicing to allow you to apply fixed
22
amount discounts at invoice line level.
33

44
The module also extends the invoice report to show fixed discount.
5+
6+
If the module `account_invoice_triple_discount` is installed and a fixed discount is set, it will take priority over anything set in the triple discount fields.

account_invoice_fixed_discount/reports/report_account_invoice.xml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,36 @@
88
t-value="any([l.discount_fixed for l in o.invoice_line_ids])"
99
/>
1010
</xpath>
11-
<xpath expr="//th[@t-if='display_discount']/span" position="attributes">
12-
<attribute name="t-if">not display_discount_fixed</attribute>
11+
<xpath expr="//th[@name='th_price_unit']" position="attributes">
12+
<attribute name="t-if" add="display_discount_fixed" separator=" or " />
13+
</xpath>
14+
<xpath expr="//th[@name='th_price_unit']/span" position="attributes">
15+
<attribute name="t-if" add="not display_discount_fixed" separator=" or " />
1316
</xpath>
1417

15-
<xpath expr="//th[@t-if='display_discount']/span" position="before">
18+
<xpath expr="//th[@name='th_price_unit']/span" position="before">
1619
<t t-if="display_discount_fixed">
1720
<span>Discount Amount (%)</span>
1821
</t>
1922
</xpath>
2023

21-
<span t-field="line.discount" position="before">
22-
<t t-if="display_discount_fixed">
24+
<xpath expr="//span[@t-field='line.discount']/.." position="attributes">
25+
<attribute name="t-if" add="display_discount_fixed" separator=" or " />
26+
</xpath>
27+
<xpath expr="//span[@t-field='line.discount']" position="attributes">
28+
<attribute name="t-if" add="line.discount_fixed" separator=" or " />
29+
</xpath>
30+
<xpath expr="//span[@t-field='line.discount']" position="before">
31+
<t t-if="display_discount_fixed and line.discount_fixed">
2332
<span class="text-nowrap" t-field="line.discount_fixed" /><span
2433
class="text-nowrap"
2534
> (or</span>
2635
</t>
27-
</span>
28-
<span t-field="line.discount" position="after">
29-
<t t-if="display_discount_fixed"><span class="text-nowrap"> %)</span></t>
30-
</span>
36+
</xpath>
37+
<xpath expr="//span[@t-field='line.discount']" position="after">
38+
<t t-if="display_discount_fixed and line.discount_fixed"><span
39+
class="text-nowrap"
40+
> %)</span></t>
41+
</xpath>
3142
</template>
3243
</odoo>

account_invoice_fixed_discount/static/description/index.html

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6-
<title>Account Fixed Discount</title>
6+
<title>README.rst</title>
77
<style type="text/css">
88

99
/*
@@ -360,19 +360,25 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document" id="account-fixed-discount">
364-
<h1 class="title">Account Fixed Discount</h1>
363+
<div class="document">
365364

365+
366+
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367+
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368+
</a>
369+
<div class="section" id="account-fixed-discount">
370+
<h1>Account Fixed Discount</h1>
366371
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
367372
!! This file is generated by oca-gen-addon-readme !!
368373
!! changes will be overwritten. !!
369374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370375
!! source digest: sha256:9888c4df69bac53c42cd1ea2d99cdbd559258cf8fa888b0547e7fe0fcaa949d7
371376
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-invoicing/tree/16.0/account_invoice_fixed_discount"><img alt="OCA/account-invoicing" src="https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-account_invoice_fixed_discount"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
377+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-invoicing/tree/16.0/account_invoice_fixed_discount"><img alt="OCA/account-invoicing" src="https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-account_invoice_fixed_discount"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373378
<p>This module extends the functionality of Invoicing to allow you to apply fixed
374379
amount discounts at invoice line level.</p>
375380
<p>The module also extends the invoice report to show fixed discount.</p>
381+
<p>If the module <cite>account_invoice_triple_discount</cite> is installed and a fixed discount is set, it will take priority over anything set in the triple discount fields.</p>
376382
<p><strong>Table of contents</strong></p>
377383
<div class="contents local topic" id="contents">
378384
<ul class="simple">
@@ -388,12 +394,12 @@ <h1 class="title">Account Fixed Discount</h1>
388394
</ul>
389395
</div>
390396
<div class="section" id="installation">
391-
<h1><a class="toc-backref" href="#toc-entry-1">Installation</a></h1>
397+
<h2><a class="toc-backref" href="#toc-entry-1">Installation</a></h2>
392398
<p><strong>Warning</strong>: This module is incompatible with
393399
<tt class="docutils literal">account_invoice_triple_discount</tt> which also belongs to <a class="reference external" href="https://github.com/OCA/account-invoicing">OCA/account-invoicing</a>.</p>
394400
</div>
395401
<div class="section" id="usage">
396-
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
402+
<h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
397403
<p>To use this module, you need to:</p>
398404
<ol class="arabic simple">
399405
<li>Go to <em>Settings</em> and <em>Activate the developer mode</em></li>
@@ -402,23 +408,23 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
402408
</ol>
403409
</div>
404410
<div class="section" id="bug-tracker">
405-
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
411+
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
406412
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-invoicing/issues">GitHub Issues</a>.
407413
In case of trouble, please check there if your issue has already been reported.
408414
If you spotted it first, help us to smash it by providing a detailed and welcomed
409415
<a class="reference external" href="https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_invoice_fixed_discount%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
410416
<p>Do not contact contributors directly about support or help with technical issues.</p>
411417
</div>
412418
<div class="section" id="credits">
413-
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
419+
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
414420
<div class="section" id="authors">
415-
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
421+
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
416422
<ul class="simple">
417423
<li>ForgeFlow</li>
418424
</ul>
419425
</div>
420426
<div class="section" id="contributors">
421-
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
427+
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
422428
<ul class="simple">
423429
<li>Lois Rilo &lt;<a class="reference external" href="mailto:lois.rilo&#64;forgeflow.com">lois.rilo&#64;forgeflow.com</a>&gt;</li>
424430
<li>Jordi Ballester &lt;<a class="reference external" href="mailto:jordi.ballester&#64;forgeflow.com">jordi.ballester&#64;forgeflow.com</a>&gt;</li>
@@ -428,7 +434,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
428434
</ul>
429435
</div>
430436
<div class="section" id="maintainers">
431-
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
437+
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
432438
<p>This module is maintained by the OCA.</p>
433439
<a class="reference external image-reference" href="https://odoo-community.org">
434440
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
@@ -441,5 +447,6 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
441447
</div>
442448
</div>
443449
</div>
450+
</div>
444451
</body>
445452
</html>

account_invoice_fixed_discount/tests/test_account_fixed_discount.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ def test_01_discounts_fixed_single_unit(self):
100100
# Force the fixed discount as the onchange does not
101101
# handle the context properly
102102
line.discount_fixed = 0.0
103-
line.discount = 20.0
104103

104+
self.invoice.invoice_line_ids[0].discount = 20.0
105105
self.assertEqual(self.invoice.invoice_line_ids.discount_fixed, 0.0)
106106
self.assertEqual(self.invoice.invoice_line_ids.discount, 20.0)
107107
self.assertEqual(self.invoice.amount_total, 176.0)
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
5+
=============================
6+
Account Fixed Triple Discount
7+
=============================
8+
9+
..
10+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11+
!! This file is generated by oca-gen-addon-readme !!
12+
!! changes will be overwritten. !!
13+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14+
!! source digest: sha256:146d6ec09dd55edb8f963aab0c8cca98d2dd89e7340350c6633070022a3e026a
15+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16+
17+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
18+
:target: https://odoo-community.org/page/development-status
19+
:alt: Beta
20+
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
21+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
22+
:alt: License: AGPL-3
23+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github
24+
:target: https://github.com/OCA/account-invoicing/tree/16.0/account_invoice_fixed_triple_discount
25+
:alt: OCA/account-invoicing
26+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27+
:target: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-account_invoice_fixed_triple_discount
28+
:alt: Translate me on Weblate
29+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&target_branch=16.0
31+
:alt: Try me on Runboat
32+
33+
|badge1| |badge2| |badge3| |badge4| |badge5|
34+
35+
Glue module between `account_invoice_fixed_discount` and `account_invoice_triple_discount`.
36+
When both are used on the same line a warning will appear to alert the user that the fixed discount will take priority and it's recommended to only use one.
37+
38+
**Table of contents**
39+
40+
.. contents::
41+
:local:
42+
43+
Bug Tracker
44+
===========
45+
46+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoicing/issues>`_.
47+
In case of trouble, please check there if your issue has already been reported.
48+
If you spotted it first, help us to smash it by providing a detailed and welcomed
49+
`feedback <https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_invoice_fixed_triple_discount%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
50+
51+
Do not contact contributors directly about support or help with technical issues.
52+
53+
Credits
54+
=======
55+
56+
Contributors
57+
~~~~~~~~~~~~
58+
59+
* Ethan Hildick <hildickethan@gmail.com>
60+
61+
Maintainers
62+
~~~~~~~~~~~
63+
64+
This module is maintained by the OCA.
65+
66+
.. image:: https://odoo-community.org/logo.png
67+
:alt: Odoo Community Association
68+
:target: https://odoo-community.org
69+
70+
OCA, or the Odoo Community Association, is a nonprofit organization whose
71+
mission is to support the collaborative development of Odoo features and
72+
promote its widespread use.
73+
74+
This module is part of the `OCA/account-invoicing <https://github.com/OCA/account-invoicing/tree/16.0/account_invoice_fixed_triple_discount>`_ project on GitHub.
75+
76+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

0 commit comments

Comments
 (0)