Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ addon | version | maintainers | summary
[account_edi_ubl_cii_additional_document](account_edi_ubl_cii_additional_document/) | 16.0.1.0.0 | | Extends account_edi_ubl_cii to import all attachments from UBL invoices (not only PDFs) and link them to the vendor bill.
[account_edi_ubl_cii_check_total](account_edi_ubl_cii_check_total/) | 16.0.1.0.0 | <a href='https://github.com/sbejaoui'><img src='https://github.com/sbejaoui.png' width='32' height='32' style='border-radius:50%;' alt='sbejaoui'/></a> | This addon extends the UBL invoice import process to automatically populate the suppliers check total field based on the value found in the XML file.
[account_edi_ubl_cii_invoice_line_name_enhance](account_edi_ubl_cii_invoice_line_name_enhance/) | 16.0.1.0.0 | | This module improves invoice line label generation when importing UBL vendor bills by including the product name when it is not already present.
[account_edi_ubl_cii_purchase_match](account_edi_ubl_cii_purchase_match/) | 16.0.1.0.0 | <a href='https://github.com/sbejaoui'><img src='https://github.com/sbejaoui.png' width='32' height='32' style='border-radius:50%;' alt='sbejaoui'/></a> | Extend UBL vendor bill import to automatically match and link bill lines to purchase order lines using the OrderReference and product label.
[account_edi_ubl_cii_retrieve_tax](account_edi_ubl_cii_retrieve_tax/) | 16.0.1.0.0 | <a href='https://github.com/sbejaoui'><img src='https://github.com/sbejaoui.png' width='32' height='32' style='border-radius:50%;' alt='sbejaoui'/></a> <a href='https://github.com/jbaudoux'><img src='https://github.com/jbaudoux.png' width='32' height='32' style='border-radius:50%;' alt='jbaudoux'/></a> | Match taxes on UBL import using UNECE tax codes
[account_edi_ubl_cii_supplier_invoice_number](account_edi_ubl_cii_supplier_invoice_number/) | 16.0.1.0.0 | | This addon extends the UBL invoice import process to automatically populate the suppliers invoice number based on the value found in the XML file.
[account_edi_ubl_move_line_uom_and_packaging_unece](account_edi_ubl_move_line_uom_and_packaging_unece/) | 16.0.1.0.0 | | Adds UNECE-based detection of UoM and packaging on invoice lines during UBL import.
[account_einvoice_generate](account_einvoice_generate/) | 16.0.1.1.0 | <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> | Technical module to generate PDF invoices with embedded XML file
[account_invoice_download](account_invoice_download/) | 16.0.1.1.0 | <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> | Auto-download supplier invoices and import them
[account_invoice_download_ovh](account_invoice_download_ovh/) | 16.0.1.0.0 | <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> | Get OVH Invoice via the API
Expand Down
190 changes: 190 additions & 0 deletions account_edi_ubl_cii_purchase_match/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==================================
Account Edi Ubl Cii Purchase Match
==================================

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

.. |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/license-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%2Fedi-lightgray.png?logo=github
:target: https://github.com/OCA/edi/tree/16.0/account_edi_ubl_cii_purchase_match
:alt: OCA/edi
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/edi-16-0/edi-16-0-account_edi_ubl_cii_purchase_match
: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/edi&target_branch=16.0
:alt: Try me on Runboat

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

This module extends the UBL vendor bill import process to improve how
vendor bill lines are linked to purchase order lines.

Instead of replacing the imported UBL lines with the purchase order
lines (standard behavior), this module:

1. **Reads the OrderReference** in the UBL document.

2. **Identifies the corresponding Purchase Order** using the vendor
reference (``partner_ref``) or the purchase order ref.

3. **Matches each UBL line** with a purchase order line based on:

- product name,
- supplier product name

4. **Links the vendor bill line** to the matched PO line

5. When a user manually selects a purchase order line from the bill:

- the system stores the supplier product name,
- future imports will auto-match using that supplier information.

This ensures accurate line-level linking while preserving the supplier’s
invoice data.

**Table of contents**

.. contents::
:local:

Use Cases / Context
===================

In the standard behavior, when importing a vendor bill from a UBL
document:

- If a Purchase Order is found, **all imported UBL lines are replaced**
by the Purchase Order lines.
- This causes a **loss of original UBL data**, such as:

- line-level descriptions,
- quantities,
- pricing,
- tax information received from the supplier.

- Additionally, the standard flow performs **no matching based on
product labels**, so incorrect PO lines may be added if PO content
does not reflect what is actually on the invoice.

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

No configuration is required to use this module.

However, for optimal matching:

- Ensure that *OrderReference* in the vendor UBL document corresponds to
the Purchase Order Ref or the **Vendor Reference** (``partner_ref``).
- Maintain consistent **product names** or **supplier product names** so
that UBL line descriptions can be matched to the correct purchase
order line.

Optional but recommended:

- Define supplier product names (``product.supplierinfo``) to improve
matching accuracy.

Usage
=====

1. Import a vendor bill in UBL format through: Accounting / Vendors /
Bills / Upload
2. The module will automatically:

- Extract the OrderReference from the UBL.
- Find the matching purchase order via ``partner_ref`` or purchase
order ref.
- Attempt to match each UBL line with the correct purchase order line
using:

- product name,
- supplier product name

3. When a match is found: the vendor bill line is linked to the purchase
order line.
4. If no match is found:

- Click "Select purchase line" button in invoice line
- Select a purchase order and a purchase order line

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

This module implements custom purchase order line matching and replaces
the standard behavior of linking vendor bills to purchase orders via
UBL.

Before migrating to future versions, it is recommended to verify
whether:

- Odoo natively supports precise line-level matching,
- supplier product names and UBL descriptions are matched out of the
box,
- and the original UBL lines are preserved.

If the standard behavior evolves to fully cover this business
requirement, this module may become unnecessary.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/edi/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/edi/issues/new?body=module:%20account_edi_ubl_cii_purchase_match%0Aversion:%2016.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
-------

* ACSONE SA/NV

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

- Souheil Bejaoui souheil.bejaoui@acsone.eu

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.

.. |maintainer-sbejaoui| image:: https://github.com/sbejaoui.png?size=40px
:target: https://github.com/sbejaoui
:alt: sbejaoui

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-sbejaoui|

This module is part of the `OCA/edi <https://github.com/OCA/edi/tree/16.0/account_edi_ubl_cii_purchase_match>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions account_edi_ubl_cii_purchase_match/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizards
21 changes: 21 additions & 0 deletions account_edi_ubl_cii_purchase_match/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2025 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Account Edi Ubl Cii Purchase Match",
"summary": """Extend UBL vendor bill import to automatically match and link bill
lines to purchase order lines using the OrderReference and product label.""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/edi",
"depends": ["account_edi_ubl_cii", "purchase"],
"data": [
"security/account_move_line_select_purchase_line_wizard.xml",
"wizards/account_move_line_select_purchase_line_wizard.xml",
"views/account_move.xml",
"views/purchase_order_line.xml",
],
"demo": [],
"maintainers": ["sbejaoui"],
}
Loading
Loading