콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
456 화면

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

아바타
취소
관련 게시물 답글 화면 활동
0
11월 16
3554
2
7월 25
1558
1
5월 25
1053
2
2월 25
9864
2
10월 24
1724