Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
4654 Vistas

I'm trying to send an email with sign request with API XMLM/RPC in Python client


For this, I implement 5 calls to the API:

1. Upload file with Method sign.template and method upload_template, send the PDF file and got the Document ID

2. Update contract sign, update pdf file with the field or fields to fill with user data (name, company sign..).

3. Create the email request with message data (receiver, pdf file, text message).

4. Some method required to check the email before send:  

    Model sign.send.request method: read, and Model sign.send.request.signer method read

5. Send email with model sign.send.request and method send_request with args the email template created before, like this:

request_sign = api.execute_kw(database, uid, api_key, "sign.send.request","send_request", [template_email_id])

template created before, like this: All steps executes well, but the last one gives me this:
 

xmlrpc.client.Fault:
...
line 534, in dump_nil\n raise TypeError("cannot marshal None unless allow_none is enabled")\nTypeError: cannot marshal None unless allow_none is enabled\n'>

I declare the connection with allow_none = True:

api = client.ServerProxy("%s/xmlrpc/2/object" % self.url, allow_none=True)

I don't know what Am I doing wrong with the method call.

Avatar
Descartar
Autor

Thank you for your answers.

I migrate the code to use OdooRPC module and can prepare the email to send later.

# Prepare email request

sign_email =self.odoo.env['sign.send.request']

email_id = sign_email.create(request_fields)

request_sign = sign_email.send_request(email_id)

The email is created in Odoo but is not delivered to the recipients.

You have to setup your Outgoing Mail Server

Mejor respuesta

Hi,

I'm working on the same kind of project but with API XMLM/RPC in PHP client.

I manage to create partners, upload documents, create sign template and email template but I'm stuck on the creation of signers.

When I try with $models->execute_kw($db, $uid, $password, 'sign.send.request.signer', 'create', array(array('role_id'=>'2','partner_id'=>'7')));

It returns the following error :

TypeError: SignSendRequestSigner.create() missing 1 required positional argument: \'vals_list\'

I've check that partner_id 7 exists and it's the only required field along with role_id

Does anybody knows what am I doing wrong ?

Regards,

Avatar
Descartar

Ok, I found the right syntax / missing positional argument to create signer_ids :

$signer_ids = array([0, 'client_signature', ['role_id'=> 2, 'partner_id'=> $client_id]],[0, 'employee_signature', ['role_id'=> 3, 'partner_id'=> $employee_id]]);

Mejor respuesta

It looks like the issue is with the send_request method in the sign.send.request model. The error message indicates that the method is trying to marshal a None value, but the allow_none option is not enabled.

To fix this issue, you can try enabling the allow_none option when calling the send_request method. You can do this by passing the allow_none=True option as an argument to the send_request method, like this:

request_sign = api.execute_kw(database, uid, api_key, "sign.send.request", "send_request", [template_email_id], allow_none=True)

Alternatively, you can try setting the allow_none option to True when creating the ServerProxy object, like this:

api = client.ServerProxy("%s/xmlrpc/2/object" % self.url, allow_none=True)
request_sign = api.execute_kw(database, uid, api_key, "sign.send.request", "send_request", [template_email_id])

Either of these approaches should fix the issue and allow the send_request method to be called successfully.

Avatar
Descartar
Mejor respuesta

Hi @Juan Botero Tech

Hope you are doing well

Even if the allow_none is True if the method that you are calling doesn't return anything or None it will throw the error.
As a workaround, inherit the method and add return True at the end after calling super.

I hope this will be helpful.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
jul 24
3781
3
ene 23
7536
1
mar 22
5396
1
feb 22
5542
1
jul 20
9371