Odoo Help


How to get value order line sales order before saving form?

Ajeng Shilvie
on 1/11/15, 11:42 PM 791 views

i want to insert approve boolean field in order_line sales order  . using this code :

class sales_order_line(osv.osv):
    _inherit = 'sale.order.line'
    _columns = {
                'approve' : fields.boolean('Approve')

then, i want to insert approve all boolean field in header of sales order . it has a method to make all approve field in order line checked/true but it didn't work at all. how can i loop every order_line before i hit button create ? all i know that i can get order_line value if i already hit button save , is there any way?

class wtc_sales_order(osv.osv):
    _inherit = 'sale.order'
    _columns = {
                'approve_all' : fields.boolean('Approve all order line')
    def _onchange_approve(self, cr, uid, ids, approve_all):
        if approve_all:
             for rec in order_line :
                 x[rec.approve] = True
         return {'value':x}

here xml code :

        <record model="ir.ui.view" id="wtc_sales_order_form_view">
            <field name="name">wtc_sales_order_form_view</field>
            <field name="model">sale.order</field>
            <field name="inherit_id" ref="sale.view_order_form"/>
            <field name="arch" type="xml">
                <field name="warehouse_id" position="after">
                    <field name="approve_all" on_change="_onchange_approve(approve_all)"/>
                <field name="price_subtotal" position="after">
                    <field name="approve"></field>
                <field name="address_allotment_id" position="after">
                    <field name="approve"></field>


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

2 follower(s)


Asked: 1/11/15, 11:42 PM
Seen: 791 times
Last updated: 3/16/15, 8:10 AM