How to set default value from 'on delivery order' to 'on demand' in create invoice field in quotations in odoo?
<p>I am trying to set default value from <code>'on delivery order'</code> to <code>'on demand'</code> in create invoice field in quotation's other information tab in odoo. But its not setting as default value to on demand. Can anyone help me out how to set default value of create invoice in 'on demand'. </p>

<p><strong>This is the default odoo code i am posting.</strong></p>

<pre><code>'order_policy': fields.selection([
                        ('manual', 'On Demand'),
                        ('picking', 'On Delivery Order'),
                        ('prepaid', 'Before Delivery'),
                    ],
                    'Create Invoice',
                    required=True,
                    readonly=True,
                    states={
                        'draft': [('readonly', False)],
                        'sent':  [('readonly', False)]
                    },
                ),
</code></pre>

<p><strong>and this is default value code i am writing.</strong></p>

<pre><code>_defaults = {
        'order_policy': 'manual',
}
</code></pre>

<p>You can do it by two way.</p>

<p>1). As @KHELILI Hamza suggested you should redefine that field and set default value.</p>

<p>2). You need to override default_get method.</p>

<p><strong>Solution:</strong></p>

<pre><code>def default_get(self, cr, uid, fields, context=None):
    res = super(class_name, self).default_get(cr, uid, fields, context=context)
    res.update({'order_policy': 'manual'})
    return res
</code></pre>

<p>If you want to set the default value conditionally then you can manage in that code easily.</p>

python openerp default odoo-8 default-value