Skip to Content
Menu
This question has been flagged
279 Views

In France, it's legally required to include the customer's purchase order reference ("numéro de bon de commande") on confirmed sales orders. We need to collect this information during the signature process in the portal.


I'm trying to add a required `client_order_ref` field to the signature modal in sale orders, but the `SignatureForm` widget only transmits `name` and `signature` parameters to the server.


Currently I'm working on

- **Odoo Version**: Community 16.0

- **Module**: Custom signature_advanced module

- **Goal**: Add required customer PO reference field to signature modal


I've tried 


 1. Template Inheritance

```xml

<template id="portal_signature_client_ref" inherit_id="sale.sale_order_portal_template">

    <xpath expr="//div[@id='modalaccept']//main[@id='sign-dialog']/p" position="after">

        <div class="form-group mb-3">

            <label for="client_order_ref">Customer PO Reference *</label>

            <input type="text" name="client_order_ref" id="client_order_ref"

                   class="form-control" required="required"/>

        </div>

    </xpath>

</template>

```


 2. JavaScript Widget Extension

```javascript

publicWidget.registry.SignatureForm.include({

    _onClickSignSubmit: function (ev) {

        var clientRef = $('#modalaccept #client_order_ref').val();

        if (clientRef) {

            this.rpcParams.client_order_ref = clientRef;

        }

        return this._super.apply(this, arguments);

    },

});

```


 3. Controller Override

```python

@http.route(["/my/orders/<int:order_id>/accept"], type="json", auth="public", website=True)

def portal_quote_accept(self, order_id, access_token=None, **kw):

    client_order_ref = kw.get('client_order_ref')  # Always None

    # ... rest of processing

```


The problem remains that the field appears in the modal and validation works, but `client_order_ref` never reaches the controller. Server logs show only `name` and `signature` in received parameters.


Questions

1. **How does the `SignatureForm` widget determine which fields to include in the RPC call?**

2. **What's the proper way to extend it to include custom fields from the modal?**

3. **Is there a better approach than overriding the widget?**


Additional Context

- Field validation works (JavaScript detects the value)

- DOM contains the field with correct value

- Only RPC transmission fails

- Need solution that survives module updates


Any guidance on the correct approach would be greatly appreciated. 

This seems like a common requirement for B2B scenarios.


BTW, using

- Python 3.13, PostgreSQL 17

- Custom module extends `sale`, `portal`

- Using `publicWidget.registry.SignatureForm.include()`


Thank you for any insights!
Cheers

Avatar
Discard
Related Posts Replies Views Activity
0
Nov 16
3441
2
Jul 25
1309
1
May 25
844
2
Feb 25
9697
2
Oct 24
1599