Odoo Help

Welcome!

This community 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.

0

Select lines in sale.order.line

By
John Doe
on 7/6/16, 7:01 AM 297 views

Hello,

I've did a wizard/button which is changing discounts in every line. What I'm trying to do is to change it only in chosen lines? I've created selection boolean field before product name but there is a problem becouse when i click on it it not changing its status to true but opening the product wizard. What can i do to change this?

class add_selection_field_order(osv.osv):
	_inherit ='sale.order.line'
	
        columns ={ 'selection_line':fields.boolean('zaznacz'), } _defaults =         { 'selection_line': False, }

<record
model="ir.ui.view"
id="sale_order_add_selection_field">
    <field name="name">sale.order.line_select_field</field>
    <field name="model">sale.order</field>
    <field name="inherit_id" ref="sale.view_order_form"/>
    <field name="arch" type="xml">
	<xpath expr="//field[@name='th_weight'][@invisible='1']" position="after">
		<field name="selection_line"/>
	</xpath>
    </field>
</record>


1
Nikunj Antala
On 7/6/16, 9:19 AM

Hello Jone,
     For adding field in tree view of sale order line try to use this code:    

<record
model="ir.ui.view"
id="sale_order_add_selection_field">
    <field name="name">sale.order.line_select_field</field>
    <field name="model">sale.order</field>
    <field name="inherit_id" ref="sale.view_order_form"/>
    <field name="arch" type="xml">        
        <xpath expr="//field[@name='order_line']/tree//field[@name='th_weight']" position="after"> <field name="selection_line"/> </xpath>     </field> </record>                   

Hope this help.

It works same as my code

John Doe
on 7/6/16, 9:30 AM

Good. i have little change in xpath

Nikunj Antala
on 7/6/16, 9:33 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/6/16, 7:01 AM
Seen: 297 times
Last updated: 7/6/16, 9:19 AM