Skip to Content
Menú
This question has been flagged
1 Respondre
2393 Vistes

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
Best Answer

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
Related Posts Respostes Vistes Activitat
1
de juny 25
914
1
de set. 25
1646
2
de jul. 24
1996
1
de juny 24
1835
0
de des. 23
1451