Odoo Help


Change Base Field Properties in a New Module:

Nigel Butler
on 3/11/16, 9:22 AM 2,328 views

I would like to know how to change the properties of a base field to change it from Read-Only to Not Read Only.

The field in question if requested_date, part of the sale,order model. It was created by the sale_order_date module. When you have a quote the requested date can be varied, but once the order is confirmed the value becomes read only and this date cannot be changed. 

I want to be able to edit this requested_date value, even after the order is confirmed

It is created in sales_order_dates.py

'requested_date': fields.datetime('Requested Date', readonly=True, states={'draft': [('readonly', False)],  'sent': [('readonly', False)]}, copy=False,

If I just change this file to read readonly=False, then it works, but I want to do this from my custom module. I can add new fields easily in the my_module.py file:

class sale_order_template(models.Model):

_name = 'sale.order'

_inherit = 'sale.order'

new_field= fields.Char('New Field', required = False, readonly=false)

But how am I able to edit the attributes of an existing field, i.e. required_date?

Thanks in advance.




Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 




Sudhir Arya
ERP Harbor Consulting Services
Sudhir Arya (ERP Harbor Consulting Services)
On 3/12/16, 6:27 AM

Hello Nigel,

You just have to override that field which is in a sale.order object and change the attribute value.


'requested_date': fields.datetime('Requested Date', readonly=False, states={'draft': [('readonly', False)],  'sent': [('readonly', False)]}, copy=False)

I also suggest you to remove the _name from your class as you already have inherited the sale.order object.

Hope that helps you.


Thank you for the reply, When I put this code into my models.py file and restart the odoo server it gives the following error: 'ERROR HIPTest werkzeug: Error on request: Traceback (most recent call last):' and 'ImportError: cannot import name controllers'

Nigel Butler
on 3/14/16, 4:49 AM
On 1/17/18, 11:56 AM

Hi All

Any way to change the "requested date" of a confirmed order? 

I did find this code, and changed the underline code below from True to False; 

'requested_date': fields.datetime('Requested Date', readonly=False, states={'draft': [('readonly', False)],  'sent': [('readonly', False)]}, copy=False)
--Jignesh Mehta--

Jignesh Mehta
On 3/12/16, 5:54 AM

Hello Nigel,

Try this :-

class sale_order_template(models.Model):

    _name = 'sale.order'

    _inherit = 'sale.order'

    'requested_date': fields.datetime('Requested Date')

From this, the requested field is now simple datetime field so you can easily edit it in any state.

Hope it will works you.


Thanks for the reply, this seems to give a similar error to the answer above: "werkzeug: Error on request: Traceback (most recent call last):" then "TypeError: an integer is required"

Nigel Butler
on 3/14/16, 8:45 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 3/11/16, 9:22 AM
Seen: 2328 times
Last updated: 1/17/18, 11:56 AM