Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
222 Widoki

Why doesn't Odoo use Sales Order and Invoice Warning Messages from the Contact Internal Notes to appear when you are creating Tickets in Odoo Helpdesk? If Helpdesk is used for billing this should be considered. Im looking at developing a customization for this

Awatar
Odrzuć
Autor

Tested and confirmed working with Odoo 18 Thanks!

Najlepsza odpowiedź

Hi,


Odoo does not show Sales Order or Invoice warning messages in Helpdesk tickets because the Helpdesk module was designed as a support tool, not as part of the commercial workflow. The warning logic (sale_warn / invoice_warn) is only implemented in Sales Orders and Invoices, so when you select a customer in Helpdesk, those checks are never triggered.


If you need this (for example, when Helpdesk is used for billable services), you can add a customization to extend helpdesk.ticket so that it calls the same partner warning logic used in Sales and Invoicing. This way, when a ticket is created or a customer is selected, the system will display or block based on the customer’s warning settings.


If you want to integrate this (especially if Helpdesk is used for billing or customer agreements), you can extend helpdesk.ticket to check partner warnings on creation/change.


Try the following code,

from odoo import models, api, _

from odoo.exceptions import UserError


class HelpdeskTicket(models.Model):

    _inherit = "helpdesk.ticket"


    @api.onchange("partner_id")

    def _onchange_partner_id_warning(self):

        if not self.partner_id:

            return


        partner = self.partner_id


        # Check Sales Order Warning

        if partner.sale_warn and partner.sale_warn != "no-message":

            warning = {

                "title": _("Sales Warning for %s") % partner.name,

                "message": partner.sale_warn_msg

            }

            if partner.sale_warn == "block":

                self.partner_id = False

                return {"warning": warning}

            return {"warning": warning}


        # Check Invoice Warning

        if partner.invoice_warn and partner.invoice_warn != "no-message":

            warning = {

                "title": _("Invoice Warning for %s") % partner.name,

                "message": partner.invoice_warn_msg

            }

            if partner.invoice_warn == "block":

                self.partner_id = False

                return {"warning": warning}

            return {"warning": warning}


* This mimics the same warning logic as sale.order and account.move.

* The warning pops up when selecting a customer in a ticket.

* If set to Block, it prevents using that customer.



Hope it helps

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
mar 25
1634
0
paź 24
1573
1
wrz 24
1694
1
sie 24
1809
1
lip 24
1631