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

If we face the support from the client to update the Quotation Date in the  sale module, when the fields was in readonly, is there any options in odoo to do that without the DB access and SSH access, only with the admin username and password.

Is it possible in odoo ? if it's there  any options means, let me know the proper way to update the data.

아바타
취소
작성자

Thanks Ray

베스트 답변

1. Use Odoo's Debug Mode

Enable Developer Mode:


Go to your Odoo instance.

Add ?debug=1 to the URL or use the developer tools from the settings menu.

Modify Field Properties Temporarily:


Navigate to the form where the field is readonly.

Use the developer tools to locate the field (Inspect Field option).

Temporarily remove the readonly attribute in the view by duplicating the view and editing it via the "Edit View: Form" menu.

Example:


Locate the XML snippet in the view:

xml

Copy code

<field name="quotation_date" readonly="1"/>

Remove readonly="1" or set it conditionally:

xml

Copy code

<field name="quotation_date" attrs="{'readonly': [('state', '=', 'done')]}"/>

Save and Reload:


After saving the view, reload the form. The field will now be editable.


2. Use Automated Actions

If modifying the field directly is not an option, you can use an automated action to update the field value programmatically.


Steps:

Go to Settings > Technical > Automated Actions.


Create a New Automated Action:


Model: Select the model you want to update (eg, sale.order).

Trigger: Choose On Update or On Time-Based Conditions.

Action: Add Python code to update the field.

Example:


python

Copy code

if record.id == your_record_id:

    record.quotation_date = '2023-12-01'

아바타
취소
작성자

Thanks Nikhil

베스트 답변

The Quotation date is only readonly once the Quotation has been confirmed into a Sales Order.

Assuming you want to update the Order Date (date_order) of a Sales Order (which is updated to the Date the Quotation was confirmed) you can do this in a Server Action.

Activate Developer Mode


Create a Server Action


sale_order = env['sale.order'].search([('name','=','S00019')])

if sale_order:
    sale_order['date_order'] = '2024-12-01'


Using Server Action as the model allows you to see the RUN button so you can execute the code. 


 - this approach can bypass business logic​, so only do it if you know what the impact of your changes will be (and test first in a duplicate database) and only do this on simple fields - you can't back date transactions impacting inventory or accounting transactions for example.

아바타
취소
관련 게시물 답글 화면 활동
1
4월 25
434
0
4월 25
362
2
3월 25
721
0
2월 25
637
1
2월 25
849