Odoo Help


Is there a way to modify a field property without affecting the others?

Jairo Llopis
on 7/8/14, 3:55 AM 884 views

For example, I want to modify the domain of `sale.order.order_line`, and I have to copy all code and add the domain:

class SaleOrder(orm.Model):
    _name = _inherit = "sale.order"
    _columns = {
        # Copied from the original, but with domain
        'order_line': fields.one2many(
            'Order Lines', 
            domain=[("optional", "=", False)],
            states={'draft': [('readonly', False)], 
                    'sent': [('readonly', False)]}),

But I want to know if there is any way to just declare what I want to modify, and leave the rest as is. Something similar to:

class SaleOrder(orm.Model):
    _name = _inherit = "sale.order"

    _columns = {
        'order_line': {
            "domain": [("optional", "=", False)],

Is it possible?


Ludo - 21South

--Ludo - 21South--
| 2 2 5
Zwijndrecht, Netherlands
--Ludo - 21South--


Ludo - 21South
On 7/8/14, 8:50 AM

I don't think that is possible. If you create a field that alreasy exists in the original module, you will completely redefine the field. So yes, if you only wanted to add "required=True" to a field, you have to copy the entire field and add that attribute unfortunately.

Perhaps this will be different with the new API, but for now I think it is not possible.

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: 7/8/14, 3:55 AM
Seen: 884 times
Last updated: 3/16/15, 8:10 AM