I'm currently working on a automation and this is my code
First the automation will be triggered via webhook and will receive this
template_id = int(payload.get('template_id'))
partner_id = int(payload.get('partner_id'))
Then it will create 2 records in sign.item model so client can input their signature and date of signing
item_signature = {
"template_id" : template_id,
"type_id": 1, # 1 = signature item
"required" : True,
"responsible_id" : 1, # 1 = customer role
"page": 9,
"posX": 0.344,
"posY": 0.156,
"width" : 0.189,
"height" : 0.024,
"name": "Signature"
}
env['sign.item'].create(item_signature)
item_sign_date = {
"template_id" : template_id,
"type_id": 12, # 12 = date item
"required" : True,
"responsible_id" : 1, # 1 = customer role
"page": 9,
"posX": 0.302,
"posY": 0.228,
"width" : 0.150,
"height" : 0.015,
"name" : "Date"
}
env['sign.item'].create(item_sign_date)
Now I wanted to send a sign request to client by creating a record in sign.send.request
send_request_data = {
"template_id": template_id,
"subject": "Test Subject",
"filename": "test.pdf",
}
send_request = env["sign.send.request"].create(send_request_data)
Then i have to add a record in model sign.send.request.signer in which i can append it to the "send_request" above
signer_data = [{
"role_id": 1, # 1 = customer role
"partner_id": partner_id,
"sign_send_request_id": send_request.id
}]
signer = env["sign.send.request.signer"].create(signer_data)
To send the request i have to run this
send_request.send_request()
But odoo will throw an error to me everytime
"odoo.exceptions.ValidationError: You must specify one signer for each role of your sign template"
I don't understand why I'm getting this error. I have already ensure the the signature item and date item will be filled by customer. Then I have added a signer with role of "customer".
When I check in sign module, a record was actually create, but the signer was set to "Public User" even though it should not.
Please help me know the reason why I'm getting this error and possible solutions. Thanks in advance