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
30 changes: 30 additions & 0 deletions crm_claim_extra_ref_dependency/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

==============================
Crm claim extra ref dependency
==============================

* Before deleting a purchase order, sales order, or picking, verify that they
are not referenced in any claims.


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

Bugs are tracked on `GitHub Issues
<https://github.com/avanzosc/crm-addons/issues>`_. In case of trouble,
please check there if your issue has already been reported. If you spotted
it first, help us smash it by providing detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

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

* Ana Juaristi <[email protected]>
* Alfredo de la Fuente <[email protected]>
1 change: 1 addition & 0 deletions crm_claim_extra_ref_dependency/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import model
14 changes: 14 additions & 0 deletions crm_claim_extra_ref_dependency/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2026 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "CRM Claim Extra Ref Dependency",
"version": "16.0.1.0.0",
"author": "AvanzOSC",
"category": "CRM Claim",
"license": "AGPL-3",
"website": "https://github.com/avanzosc/crm-addons",
"depends": ["crm_claim_extra_ref", "purchase", "sale", "stock"],
"data": [],
"installable": True,
"auto_install": True,
}
58 changes: 58 additions & 0 deletions crm_claim_extra_ref_dependency/i18n/ca_ES.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_claim_extra_ref_dependency
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-01-28 12:22+0000\n"
"PO-Revision-Date: 2026-01-28 12:22+0000\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: crm_claim_extra_ref_dependency
#: model:ir.model,name:crm_claim_extra_ref_dependency.model_purchase_order
msgid "Purchase Order"
msgstr "Comanda de compra"

#. module: crm_claim_extra_ref_dependency
#: model:ir.model,name:crm_claim_extra_ref_dependency.model_sale_order
msgid "Sales Order"
msgstr "Comanda de venda"

#. module: crm_claim_extra_ref_dependency
#: model:ir.model,name:crm_claim_extra_ref_dependency.model_stock_picking
msgid "Transfer"
msgstr "Transferència"

#. module: crm_claim_extra_ref_dependency
#. odoo-python
#: code:addons/crm_claim_extra_ref_dependency/model/stock_picking.py:0
#, python-format
msgid ""
"You cannot delete the picking: %(picking_name)s, because it is being used in"
" the claim: %(claim_name)s."
msgstr ""

#. module: crm_claim_extra_ref_dependency
#. odoo-python
#: code:addons/crm_claim_extra_ref_dependency/model/purchase_order.py:0
#, python-format
msgid ""
"You cannot delete the purchase order: %(purchase_name)s, because it is being"
" used in the claim: %(claim_name)s."
msgstr ""

#. module: crm_claim_extra_ref_dependency
#. odoo-python
#: code:addons/crm_claim_extra_ref_dependency/model/sale_order.py:0
#, python-format
msgid ""
"You cannot delete the sale order: %(sale_name)s, because it is being used in"
" the claim: %(claim_name)s."
msgstr ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_claim_extra_ref_dependency
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-01-28 12:21+0000\n"
"PO-Revision-Date: 2026-01-28 12:21+0000\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: crm_claim_extra_ref_dependency
#: model:ir.model,name:crm_claim_extra_ref_dependency.model_purchase_order
msgid "Purchase Order"
msgstr ""

#. module: crm_claim_extra_ref_dependency
#: model:ir.model,name:crm_claim_extra_ref_dependency.model_sale_order
msgid "Sales Order"
msgstr ""

#. module: crm_claim_extra_ref_dependency
#: model:ir.model,name:crm_claim_extra_ref_dependency.model_stock_picking
msgid "Transfer"
msgstr ""

#. module: crm_claim_extra_ref_dependency
#. odoo-python
#: code:addons/crm_claim_extra_ref_dependency/model/stock_picking.py:0
#, python-format
msgid ""
"You cannot delete the picking: %(picking_name)s, because it is being used in"
" the claim: %(claim_name)s."
msgstr ""

#. module: crm_claim_extra_ref_dependency
#. odoo-python
#: code:addons/crm_claim_extra_ref_dependency/model/purchase_order.py:0
#, python-format
msgid ""
"You cannot delete the purchase order: %(purchase_name)s, because it is being"
" used in the claim: %(claim_name)s."
msgstr ""

#. module: crm_claim_extra_ref_dependency
#. odoo-python
#: code:addons/crm_claim_extra_ref_dependency/model/sale_order.py:0
#, python-format
msgid ""
"You cannot delete the sale order: %(sale_name)s, because it is being used in"
" the claim: %(claim_name)s."
msgstr ""
58 changes: 58 additions & 0 deletions crm_claim_extra_ref_dependency/i18n/en_US.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_claim_extra_ref_dependency
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-01-28 12:22+0000\n"
"PO-Revision-Date: 2026-01-28 12:22+0000\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: crm_claim_extra_ref_dependency
#: model:ir.model,name:crm_claim_extra_ref_dependency.model_purchase_order
msgid "Purchase Order"
msgstr ""

#. module: crm_claim_extra_ref_dependency
#: model:ir.model,name:crm_claim_extra_ref_dependency.model_sale_order
msgid "Sales Order"
msgstr ""

#. module: crm_claim_extra_ref_dependency
#: model:ir.model,name:crm_claim_extra_ref_dependency.model_stock_picking
msgid "Transfer"
msgstr ""

#. module: crm_claim_extra_ref_dependency
#. odoo-python
#: code:addons/crm_claim_extra_ref_dependency/model/stock_picking.py:0
#, python-format
msgid ""
"You cannot delete the picking: %(picking_name)s, because it is being used in"
" the claim: %(claim_name)s."
msgstr ""

#. module: crm_claim_extra_ref_dependency
#. odoo-python
#: code:addons/crm_claim_extra_ref_dependency/model/purchase_order.py:0
#, python-format
msgid ""
"You cannot delete the purchase order: %(purchase_name)s, because it is being"
" used in the claim: %(claim_name)s."
msgstr ""

#. module: crm_claim_extra_ref_dependency
#. odoo-python
#: code:addons/crm_claim_extra_ref_dependency/model/sale_order.py:0
#, python-format
msgid ""
"You cannot delete the sale order: %(sale_name)s, because it is being used in"
" the claim: %(claim_name)s."
msgstr ""
64 changes: 64 additions & 0 deletions crm_claim_extra_ref_dependency/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_claim_extra_ref_dependency
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-01-28 12:22+0000\n"
"PO-Revision-Date: 2026-01-28 12:22+0000\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: crm_claim_extra_ref_dependency
#: model:ir.model,name:crm_claim_extra_ref_dependency.model_purchase_order
msgid "Purchase Order"
msgstr "Pedido de compra"

#. module: crm_claim_extra_ref_dependency
#: model:ir.model,name:crm_claim_extra_ref_dependency.model_sale_order
msgid "Sales Order"
msgstr "Órdenes de venta"

#. module: crm_claim_extra_ref_dependency
#: model:ir.model,name:crm_claim_extra_ref_dependency.model_stock_picking
msgid "Transfer"
msgstr "Transferir"

#. module: crm_claim_extra_ref_dependency
#. odoo-python
#: code:addons/crm_claim_extra_ref_dependency/model/stock_picking.py:0
#, python-format
msgid ""
"You cannot delete the picking: %(picking_name)s, because it is being used in"
" the claim: %(claim_name)s."
msgstr ""
"No puede borrar el albarán: %(picking_name)s, porque está siendo usado en"
" la reclamación: %(claim_name)s."

#. module: crm_claim_extra_ref_dependency
#. odoo-python
#: code:addons/crm_claim_extra_ref_dependency/model/purchase_order.py:0
#, python-format
msgid ""
"You cannot delete the purchase order: %(purchase_name)s, because it is being"
" used in the claim: %(claim_name)s."
msgstr ""
"No puede borrar el pedido de compra: %(purchase_name)s, porque está"
" siendo usado en la reclamación: %(claim_name)s."

#. module: crm_claim_extra_ref_dependency
#. odoo-python
#: code:addons/crm_claim_extra_ref_dependency/model/sale_order.py:0
#, python-format
msgid ""
"You cannot delete the sale order: %(sale_name)s, because it is being used in"
" the claim: %(claim_name)s."
msgstr ""
"No puede borrar el pedido de venta: %(sale_name)s, porque está siendo usado"
" en la reclamación: %(claim_name)s."
58 changes: 58 additions & 0 deletions crm_claim_extra_ref_dependency/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_claim_extra_ref_dependency
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-01-28 12:22+0000\n"
"PO-Revision-Date: 2026-01-28 12:22+0000\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: crm_claim_extra_ref_dependency
#: model:ir.model,name:crm_claim_extra_ref_dependency.model_purchase_order
msgid "Purchase Order"
msgstr "Bon de commande"

#. module: crm_claim_extra_ref_dependency
#: model:ir.model,name:crm_claim_extra_ref_dependency.model_sale_order
msgid "Sales Order"
msgstr "Bon de commande"

#. module: crm_claim_extra_ref_dependency
#: model:ir.model,name:crm_claim_extra_ref_dependency.model_stock_picking
msgid "Transfer"
msgstr "Transfert"

#. module: crm_claim_extra_ref_dependency
#. odoo-python
#: code:addons/crm_claim_extra_ref_dependency/model/stock_picking.py:0
#, python-format
msgid ""
"You cannot delete the picking: %(picking_name)s, because it is being used in"
" the claim: %(claim_name)s."
msgstr ""

#. module: crm_claim_extra_ref_dependency
#. odoo-python
#: code:addons/crm_claim_extra_ref_dependency/model/purchase_order.py:0
#, python-format
msgid ""
"You cannot delete the purchase order: %(purchase_name)s, because it is being"
" used in the claim: %(claim_name)s."
msgstr ""

#. module: crm_claim_extra_ref_dependency
#. odoo-python
#: code:addons/crm_claim_extra_ref_dependency/model/sale_order.py:0
#, python-format
msgid ""
"You cannot delete the sale order: %(sale_name)s, because it is being used in"
" the claim: %(claim_name)s."
msgstr ""
3 changes: 3 additions & 0 deletions crm_claim_extra_ref_dependency/model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import purchase_order
from . import sale_order
from . import stock_picking
26 changes: 26 additions & 0 deletions crm_claim_extra_ref_dependency/model/purchase_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2026 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import _, exceptions, models


class PurchaseOrder(models.Model):
_inherit = "purchase.order"

def unlink(self):
claim_obj = self.env["crm.claim"]
for purchase in self:
ref = ("purchase.order,%(purchase_id)s") % {
"purchase_id": purchase.id,
}
claim = claim_obj.search([("model_ref_id", "=", ref)])
if not claim:
claim = claim_obj.search([("ref2", "=", ref)])
if not claim:
claim = claim_obj.search([("ref3", "=", ref)])
if claim:
error = _(
"You cannot delete the purchase order: %(purchase_name)s, "
"because it is being used in the claim: %(claim_name)s."
) % {"purchase_name": purchase.name, "claim_name": claim.code}
raise exceptions.ValidationError(error)
return super().unlink()
Loading