Skip to content
Open
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
88 changes: 88 additions & 0 deletions account_edi_no_autocreate_partner/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=================================
Account Edi No Autocreate Partner
=================================

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

.. |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/19.0/account_edi_no_autocreate_partner
:alt: OCA/edi
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/edi-19-0/edi-19-0-account_edi_no_autocreate_partner
: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=19.0
:alt: Try me on Runboat

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

This module modifies the invoice import process so that no longer
partners are auto-created when no matching is found.

Instead, imported invoices that cannot be linked to an existing partner
are automatically assigned to a dedicated fallback partner named
"Partner Not Found".

This prevents uncontrolled partner creation and allows users to manually
review and correct partner information before posting invoices.

**Table of contents**

.. contents::
:local:

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_no_autocreate_partner%0Aversion:%2019.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.

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

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

{
"name": "Account Edi No Autocreate Partner",
"summary": """Prevents auto-creation of partners during invoice import by
assigning unmatched invoices to a protected “Partner Not Found” contact.""",
"version": "19.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/edi",
"depends": ["account_edi"],
"data": ["data/res_partner.xml"],
"demo": [],
}
12 changes: 12 additions & 0 deletions account_edi_no_autocreate_partner/data/res_partner.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2025 ACSONE SA/NV
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="partner_not_found" model="res.partner">
<field name="name">Partner Not Found</field>
<field name="active" eval="False" />
<field name="comment">
Fallback partner used when a vendor cannot be matched during UBL import.
</field>
</record>
</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_edi_no_autocreate_partner
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \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: account_edi_no_autocreate_partner
#: model:ir.model,name:account_edi_no_autocreate_partner.model_res_partner
msgid "Contact"
msgstr ""

#. module: account_edi_no_autocreate_partner
#: model:ir.model,name:account_edi_no_autocreate_partner.model_account_edi_format
msgid "EDI format"
msgstr ""

#. module: account_edi_no_autocreate_partner
#: model:ir.model,name:account_edi_no_autocreate_partner.model_account_move
msgid "Journal Entry"
msgstr ""

#. module: account_edi_no_autocreate_partner
#. odoo-python
#: code:addons/account_edi_no_autocreate_partner/models/res_partner.py:0
#, python-format
msgid ""
"You cannot activate the fallback 'Partner Not Found' contact used for "
"invoice imports."
msgstr ""

#. module: account_edi_no_autocreate_partner
#. odoo-python
#: code:addons/account_edi_no_autocreate_partner/models/res_partner.py:0
#, python-format
msgid ""
"You cannot delete the fallback 'Partner Not Found' contact used for invoice "
"imports."
msgstr ""

#. module: account_edi_no_autocreate_partner
#. odoo-python
#: code:addons/account_edi_no_autocreate_partner/models/account_move.py:0
#, python-format
msgid ""
"You must assign a proper vendor before posting this invoice. The fallback "
"'Partner Not Found' partner cannot be used on posted moves."
msgstr ""
66 changes: 66 additions & 0 deletions account_edi_no_autocreate_partner/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_edi_no_autocreate_partner
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2026-01-05 20:43+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.10.4\n"

#. module: account_edi_no_autocreate_partner
#: model:ir.model,name:account_edi_no_autocreate_partner.model_res_partner
msgid "Contact"
msgstr "Contatto"

#. module: account_edi_no_autocreate_partner
#: model:ir.model,name:account_edi_no_autocreate_partner.model_account_edi_format
msgid "EDI format"
msgstr "Formato EDI"

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

#. module: account_edi_no_autocreate_partner
#. odoo-python
#: code:addons/account_edi_no_autocreate_partner/models/res_partner.py:0
#, python-format
msgid ""
"You cannot activate the fallback 'Partner Not Found' contact used for "
"invoice imports."
msgstr ""
"Non è possibile attivare il contatto alternativo \"Partner non trovato\" "
"utilizzato per l'importazione delle fatture."

#. module: account_edi_no_autocreate_partner
#. odoo-python
#: code:addons/account_edi_no_autocreate_partner/models/res_partner.py:0
#, python-format
msgid ""
"You cannot delete the fallback 'Partner Not Found' contact used for invoice "
"imports."
msgstr ""
"Non è possibile attivare il contatto alternativo \"Partner non trovato\" "
"utilizzato per l'importazione delle fatture."

#. module: account_edi_no_autocreate_partner
#. odoo-python
#: code:addons/account_edi_no_autocreate_partner/models/account_move.py:0
#, python-format
msgid ""
"You must assign a proper vendor before posting this invoice. The fallback "
"'Partner Not Found' partner cannot be used on posted moves."
msgstr ""
"È necessario assegnare un fornitore corretto prima di registrare questa "
"fattura. Il partner alternativo \"Partner non trovato\" non può essere "
"utilizzato per i movimenti registrati."
2 changes: 2 additions & 0 deletions account_edi_no_autocreate_partner/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import res_partner
from . import account_move
24 changes: 24 additions & 0 deletions account_edi_no_autocreate_partner/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2025 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models
from odoo.exceptions import UserError


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

def action_post(self):
partner_not_found = self.env.ref(
"account_edi_no_autocreate_partner.partner_not_found"
)
for move in self:
if move.partner_id == partner_not_found:
raise UserError(
self.env._(
"You must assign a proper vendor before posting this invoice. "
"The fallback 'Partner Not Found' partner cannot be used on "
"posted moves."
)
)
return super().action_post()
49 changes: 49 additions & 0 deletions account_edi_no_autocreate_partner/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2025 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models
from odoo.exceptions import UserError


class ResPartner(models.Model):
_inherit = "res.partner"

@api.ondelete(at_uninstall=False)
def _prevent_no_autocreate_partner_unlink(self):
partner_not_found = self.env.ref(
"account_edi_no_autocreate_partner.partner_not_found"
)
if partner_not_found in self:
raise UserError(
self.env._(
"You cannot delete the fallback 'Partner Not Found' contact "
"used for invoice imports."
)
)
return super().unlink()

def write(self, vals):
if "active" in vals and vals["active"]:
partner_not_found = self.env.ref(
"account_edi_no_autocreate_partner.partner_not_found"
)
if partner_not_found in self:
raise UserError(
self.env._(
"You cannot activate the fallback 'Partner Not Found' "
"contact used for invoice imports."
)
)
return super().write(vals)

def _retrieve_partner(
self, name=None, phone=None, email=None, vat=None, domain=None, company=None
):
partner = super()._retrieve_partner(
name=name, phone=phone, email=email, vat=vat, domain=domain, company=company
)
if not partner:
partner = self.env.ref(
"account_edi_no_autocreate_partner.partner_not_found"
)
return partner
3 changes: 3 additions & 0 deletions account_edi_no_autocreate_partner/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions account_edi_no_autocreate_partner/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Souheil Bejaoui <souheil.bejaoui@acsone.eu>
9 changes: 9 additions & 0 deletions account_edi_no_autocreate_partner/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This module modifies the invoice import process so that no longer partners are
auto-created when no matching is found.

Instead, imported invoices that cannot be linked to an existing partner
are automatically assigned to a dedicated fallback partner named
"Partner Not Found".

This prevents uncontrolled partner creation and allows users to manually
review and correct partner information before posting invoices.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading