This question has been flagged
1 Reply
3191 Views

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

Scenario..

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 = {

               'bonus_new':fields.integer('Bonus')

    }

.......................................................


  <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" />

                </xpath>

                

                

                 <xpath

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

                     

                      <field name="bonus_new"/>

                      

                </xpath>

                

            </field>   


Avatar
Discard
Author

do this code work???

Author

No

Author

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

can you please post the code for additional functionality..