Skip to content

Commit

Permalink
[IMP] account_invoice_import: add support for discount
Browse files Browse the repository at this point in the history
Add support for discount on lines in the multi-line create scenario
  • Loading branch information
alexis-via authored and V3st1g3 committed Dec 5, 2024
1 parent 1a1e1e1 commit fafdcf6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion account_invoice_import_invoice2data/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Account Invoice Import Invoice2data
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:30a57a00c9b4505590e39f8952a5b45a0dedbb2a620382eb13ba6e3c53f89400
!! source digest: sha256:c7d1d2a38227a9bf81bc6132091b5285a4afe0b1280bea7541ebab212f57f16a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion account_invoice_import_invoice2data/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
"name": "Account Invoice Import Invoice2data",
"version": "14.0.2.3.0",
"version": "14.0.2.4.0",
"category": "Accounting/Accounting",
"license": "AGPL-3",
"summary": "Import supplier invoices using the invoice2data lib",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -366,7 +367,7 @@ <h1 class="title">Account Invoice Import Invoice2data</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:30a57a00c9b4505590e39f8952a5b45a0dedbb2a620382eb13ba6e3c53f89400
!! source digest: sha256:c7d1d2a38227a9bf81bc6132091b5285a4afe0b1280bea7541ebab212f57f16a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/edi/tree/14.0/account_invoice_import_invoice2data"><img alt="OCA/edi" src="https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/edi-14-0/edi-14-0-account_invoice_import_invoice2data"><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/edi&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module is an extension of the module <em>account_invoice_import</em>: it adds support for regular PDF invoices i.e. PDF invoice that don’t have an embedded XML file. It uses the <a class="reference external" href="https://github.com/invoice-x/invoice2data">invoice2data library</a> which takes care of extracting the text of the PDF invoice, find an existing invoice template and execute the invoice template to extract the useful information from the invoice.</p>
Expand Down Expand Up @@ -589,7 +590,9 @@ <h2><a class="toc-backref" href="#toc-entry-10">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-11">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def test_import_azure_interior_invoice(self):
# self.assertEqual(inv.journal_id.payment_reference, "202309097001")
# self.assertEqual(inv.journal_id.incoterm_id, self.env.ref("account.incoterm_DPU")

self.assertEqual(len(inv.invoice_line_ids), 8)
self.assertEqual(len(inv.invoice_line_ids), 7)
iline = inv.invoice_line_ids[0]
self.assertEqual(iline.name, "--- Non Food ---")
self.assertEqual(iline.display_type, "line_section")
Expand Down Expand Up @@ -205,9 +205,9 @@ def test_import_azure_interior_invoice(self):
iline.product_id,
self.env.ref("account_invoice_import_invoice2data.olive_oil"),
)
# todo test discount, not yet implemented in account_invoice_import
self.assertEqual(float_compare(iline.quantity, 1.0, precision_digits=0), 0)
self.assertEqual(float_compare(iline.price_unit, 1.00, precision_digits=2), 0)
self.assertEqual(float_compare(iline.discount, 10, precision_digits=2), 0)
iline = inv.invoice_line_ids[5]
self.assertEqual(
iline.name, "Our Olive Oil is delivered in a re-usable glass container"
Expand Down

0 comments on commit fafdcf6

Please sign in to comment.