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>

    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’,]}

    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.

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.




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

Thanks & Regards,
Devnani Bharat R.


Odoo – Managing Multiple Unit of Measures (UOM’s)

Dear Readers,

Today we will see how to mange Multiple Unit of Measures in Odoo.

We have to consider 3 things while working with different UoM’s.

  1. UoM Category
  2. Type, and
  3. Ratio

The UoM Category should always be the same between corresponding UoM’s. Here we take example of UoM which belongs to Category Weight.

  • Ton
  • Kilo Gram and
  • Gram

Units of Measure(1)Here, as we want to manage and stock the product Grain in Kilo Gram, so we set Type as Reference Unit of Measure for this category. And as the UoM Ton is bigger than Kilo Gram, so following option has to be selected for the Type with appropriate Ratio.

Units of Measure(2)And same for the UoM Gram with respect to UoM Kilo Gram.

Units of Measure(3)So once UoM’s are configured, we plan to purchase the product in Ton’s, sale in Grams and maintain in Kilo Gram within warehouse. So we have to configure the product as depicted in following images.

Products(1) Products(2)Products(3)So lets purchase the product, once you will select the product system will automatically propose UoM in Ton with converted pricing.

Requests for QuotationEven the incoming shipment will be in Ton, though while receiving the system will convert into Kilo Gram as we have configured it as a Default UoM.

TransfersSo once received, lets check the stock of that product.                                               1 Ton = 1000 Kilo Gram as per UoM configuration.

Products kanbanThe same thing will be applied while selling the product, though the system will not automatically propose Gram in Unit of Measure field, but it will in UoS, so we have to change Gram in UoM and the system will convert the Unit Price of the product accordingly.

Sales OrdersSo, hope this article helps you in getting insights on different Unit of Measures.

Thanks.                                                                                                                                 Bharat