简体   繁体   中英

How to change the domain of the Many2one field by inheritance?

What I mean is that;

Model with name "stock.return.picking" has "location_id" field.

When I click on the return button , I want to see all the location_id. But location_id has domain:

location_id = fields.Many2one(
    comodel_name='stock.location',
    string='Return Location',
    domain="['|', ('id', '=', original_location_id),'&', ('return_location', '=', True), ('id', 'child_of',     parent_location_id)]"
)

How can I change this domain?

You have to redefine the location_id field, inheriting from stock.return.picking model. You could do something like this:

location_id = fields.Many2one(
    comodel_name='stock.location',
    domain="[('id', '!=', 0)]",
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM