Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
7 Odpowiedzi
20059 Widoki

Now discount is entered as percentage in sales order line

How can be set sales order discount as a fixed amount. Is there any way to make this possible without editing the sale.py file.

Awatar
Odrzuć

Best you explain what you want to do a little more. Do you want a fixed percentage over price or a fixed amount over the price irrespective of total?

Autor

Overall discount for a sale order bill is possible or not in Openerp v7.0.? If it is possible then how can i add discount as an amount (willl vary on each sale order ) not as percentage..

I believe you know the solution. You will have to create a module that deduct a value from the total on the sales order. This value will then have to overwrite the current total so that is can be used on the invoice.

Autor

Any other way to implement it through Openerp interface.

I can't think of any at the moment. A work around is to create price lists with a fixed percentage across all the products and assign these to your client as required so that you get the same percentage on the total overall. But if you want something dynamic that allows you to give different discounts every time, then you will need a custom module.

Najlepsza odpowiedź

Use the calculator feature of the discount (or any numeric) field. 

=35/125 

This would calculate the percentage equivalent to a $35 discount on a $125 item

Awatar
Odrzuć
Najlepsza odpowiedź

Yes of course their is a way.. BUT I made this in Customer Invoice i think you can use this as a guide for your sale order.. but i will translate it to sale order line . By he way i use this in Openerp v 7

In your .py

class sale_order_line(osv.osv):
     _inherit = 'sale.order.line'
     def _amount_line(self, cr, uid, ids, field_name, arg, context=None):
       tax_obj = self.pool.get('account.tax')
       cur_obj = self.pool.get('res.currency')
       res = {}
      if context is None:
        context = {}
    for line in self.browse(cr, uid, ids, context=context):
        if line.amount_discount:
            price = **Here you will put your code on how will you compute your discount by amount**
            taxes =  **And also here.. because it will be affected based on your code in PRICE**
            res[line.id] = taxes['total']
            if line.invoice_id:
                    cur = line.invoice_id.currency_id
                    res[line.id] = cur_obj.round(cr, uid, cur, res[line.id])  
        else:
        price = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
        taxes = tax_obj.compute_all(cr, uid, line.tax_id, price, line.product_uom_qty, line.product_id, line.order_id.partner_id)
        cur = line.order_id.pricelist_id.currency_id
        res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])
    return res
 _columns = {

     'amount_discount': fields.float('Discount (Amount)', digits_compute= dp.get_precision('Discount')),    
     'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal', type="float",digits_compute= dp.get_precision('Account'), store=True),   
     'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Product Price')),    
     'discount': fields.float('Discount (%)', digits_compute= dp.get_precision('Discount')),       
            }
 sale_order_line()

In your .xml

<record id="name_you_want" model="ir.ui.view">
        <field name="name">name.you.want</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='discount']" position="after">
                    <field name ="amount_discount"/>
                    </xpath> 
        </field>
  </record>

I will leave to you how to compute discount by amount.. I know you can do that.. Good luck :D I hope that it will be a big help to you :D

Awatar
Odrzuć

pls post with full explain

Autor

AttributeError: "Field 'invoice_id' does not exist in object 'browse_record(sale.order.line, 32)'" This error raise while updating the total amount field

Najlepsza odpowiedź

Hi,

My client wanted the same feature. I have implemented 6.1 for him. I would like to show you the image of the sale order form. But I dont have enough karma to upload link or image.

But I have used a module to fulfill his requirement. That requirement seems to be common for US industries. OpenERP is more of Europe Industry Standards

Thanks

Awatar
Odrzuć
Autor

hi. which module did u used for him. Is it possible to add a dynamic amount(not %) as discount for a sale order

Yes. We can. Do you want it for 6.1 or 7?

Autor

i want it for version 7.0

Sorry. I dont know if OpenERP has added that feature for 7.0. But I can do that for you. you contact me on skype: vivekrajanvits. For your question, this comment will be the final answer. What Markus said is one way of doing. another way is what I implemented for my client. But I doubt if it is available in 7.

Autor

ok thanks vivekrajan.

You are welcome. you can upvote my post if my answer helped you. I can use vote to upload links and images.

hey thanks Charles for your vote. and I am sorry that I gave you wrong skype id. it is vivekrajan.vits

Najlepsza odpowiedź

Hello

I have developed one module which set a discount on whole sale order and customer invoice with fixed and percentage vise. when your quote will move to invoice that same discount and total will move to the invoice I think this module feature will helps you more.

you can see on : http://www.youtube.com/watch?v=RTRB0xq9Y38&feature=youtu.be

To get the module can contact me: dsouzajoseph199@gmail.com

Awatar
Odrzuć
Autor

ok i will contact you.

Najlepsza odpowiedź

The best way to solve this, add a new sale.order.line to your sale.order with a product "discount" (Product Type Consumable) and add a negative price.

So you have. MyProduct: 199€ Discount: -10€ Sum: 189€

Awatar
Odrzuć
Autor

thanks for the reply Markus.

Najlepsza odpowiedź

Hello,

We have developed a module which allow users to apply discount (Fixed Amount, Percentage) on Sales and Customer Invoice.

The module also allow user to display the discount on Sales and Invoice report.

Once you Validate the invoice, the module generate the Journal Entries. You can track the discount on P/L report by creating a separate account for the discount which you just have to configure in the company. This account will be used to post the entries of the discount account.

Hope this module will ease everyone's life.

For now, the module is developed for v7 only and we are on the way to migrate it in v8 and v9 as well.

Download: https://apps.odoo.com/apps/modules/7.0/discount_sale_invoice/

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

Yes, you can do it through Price List

Awatar
Odrzuć