Odoo Help


How to add a custom bonus quantity field in Sale order line?

on 5/3/15, 3:06 AM 1,158 views

I have a custom product quantity (bonus_field) in sale order line,


I want to give bonus to all customers as product like 

When  I sell X  product I want to give  Y of 2,3,.4 or  etc.. will give as Bonus product.Also I need to reduce the inventory of this bonus product


eg. Product A quantity 100 already in stock

when I sell A of 50 ,I want to give 2  A product as  bonus.

Then I need to reduce 52 from stock(50 product+2 bonus prodcut,this 2 product dont have price it will go as free).

I have added code like below.................

class SaleOrderLine(osv.osv):


    Sale Order Line


    _inherit = "sale.order.line"


    _columns = {




  <record model="ir.ui.view" id="view_account_promo_form">

            <field name="name">account.order.promo.form</field>

            <field name="model">account.invoice</field>

            <field name="type">form</field>

            <field name="inherit_id" ref="account.invoice_form" />

            <field name="arch" type="xml">

               <!--  <xpath expr="/form/sheet/notebook/page/group/group/field[@name='origin']" position="after">

                    <field name="coupon_code" />

                </xpath> -->


                <xpath expr="/form/header/button[@name='invoice_open']" position="after">

                    <button name="apply_promotions" type="object" states="draft" string="Click For Bonus" />





                    expr="//field[@name='invoice_line']/tree/field[@name='product_id']" position="after">


                      <field name="bonus_new"/>





do this code work???

Baiju KS
on 5/3/15, 7:29 AM


on 5/3/15, 7:31 AM

Hi Baiju I am trying to add a functionality..Bu its not working

on 5/3/15, 7:32 AM

can you please post the code for additional functionality..

Baiju KS
on 5/3/15, 1:37 PM

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

1 follower(s)


Asked: 5/3/15, 3:06 AM
Seen: 1158 times
Last updated: 5/3/15, 1:51 PM