Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
6467 Vistas

class SaleOrder(models.Model):

    _inherit = "sale.order"

    ...

    picking_state = fields.Selection(string="Picking State", related="picking_id.state")

    # this are a states from "stock.picking" model


    warehouse_id = fields.Many2one(

        'stock.warehouse', string='Warehouse',

        required=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},

        default=_default_warehouse_id)

# at the moment the "readonly" of warehouse_id depends on states from "sale.order"


How to include condition:   readonly=True   when     picking_state == "done"  ?

Avatar
Descartar
Mejor respuesta

Hi,
You can make the field 'warehouse_id' readonly based on 'picking_state' in the xml part  

<field name="warehouse_id" attrs="{'readonly': [('picking_state', '=', 'done')]}"/>

Regards

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
oct 22
4900
1
sept 17
5184
1
feb 16
4691
2
jun 17
4131
5
may 17
5411