Quote

Dealing Readonly attributes with onchange function – Odoo

Dear Readers,

Coming back with great functionality, which is strenuous task for odoo developers i.e is dealing with readonly fields in onchange method of odoo.

Being an odoo consultant, came across the situation where I had to change field value on onchange function and keep some field(s) readonly. With inbuilt framework, it’s not possible to edit that field, hence either we have to make those field(s) as a function or related field(s).

To solve this problem, ASCONE SA/NV came as rescuer for those who were struggling for such functionality, with their module Read Only Bypass. This module provides a solution to the problem of the interaction between ‘readonly’ and ‘on_change’ attributes when used together.

How to use this functionality:

  1. Install the module
  2. To change that behavior you have to set context in xml file on “ir.actions.act_window“:<record id=”sale.action_quotations” model=”ir.actions.act_window”>
    <field name=”context”>{‘readonly_by_pass’: True}</field>
    </record>

    or by setting fields with additional readonly_by_pass parameter:
    <record id=”sale.action_quotations” model=”ir.actions.act_window”>
    <field name=”context”>
    {‘readonly_by_pass’: [‘readonly_field_1’, ‘readonly_field_2’,]}
    </field>
    </record>

    On one2many field(s), you can also pass the context in the field definition:
    <field name=”one2many_field” context=”{‘readonly_by_pass’: True}”/>

I believe this functionality will be very much useful for odoo developers. For any queries just drop in a line, will be happy to assist.

Hope you found this article helpful.

Regards,
Bharat R. Devnani
ERP Consultant – Odoo

Odoo – Different sequence numbers for Sales Quotation and Order

Dear Readers,

By default odoo manages single sequence number for both Sales Quotation and Confirmed Order.

Today we will go through the module sale_quotation_number which provides the functionality to generate two different sequence for Sales Quotation and Confirmed Order.

As this module provides 2 different sequence for 2 different document, it gives clear and quick distinction between the documents to look for.

Sequences

Quotations

Order

You can find the module here. Hope this post helps.

Thanks & Regards,
Devnani Bharat R.