Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
2348 Vistas

Hello,

I want to use the Rental with Sign so that I can have the customer sign before confirming a Rental Order. From my testing, the only time the "sign documents" appears is AFTER the Rental Quotation is confirmed. To my mind, it would make more sense to have the agreement signed BEFORE the RO is confimed - or even prevent an quotation from being confirmed if a signed rental agreement is required. 

Additionally, I would like to email the customer a link to Sign. It seems that currently the customer needs to be physically with the sales person to Sign.

Am I mis-understanding something here? or does anyone know how I can make the workflow work correctly?

I'm testing in Odoo 17 Enterprise.

Thank you very much for reading,

Avatar
Descartar
Mejor respuesta

Hi,

Option 1: Python constraint

from odoo import models, fields, api

from odoo.exceptions import ValidationError


class RentalOrder(models.Model):

    _inherit = 'rentals.order'


    @api.constrains('state', 'signed_document_ids')

    def _check_signed_before_confirm(self):

        for order in self:

            if order.state == 'draft' and order.requires_signature and not order.signed_document_ids:

                raise ValidationError("You must have the customer sign the rental agreement before confirming.")


This prevents confirmation until a signature is attached.


Option 2: Automated Action

Trigger on write or confirm of rental orders.

Check if the signature exists; if not, prevent confirmation.



Hope it helps



Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
jun 25
838
1
sept 25
1539
2
jul 24
1959
1
jun 24
1783
0
dic 23
1413