This question has been flagged

Hi guys,

i'm searching a way to get two different disounts; one should affect the sale order line (standard Odoo discount is OK) and the other should affect the entire sale order (let's say, i want to give the whole sale order an extra 5% discount)... Discount should be applied before tax computation (both on the lines and the entire SO)....

Has anyone got an idea about this?

Avatar
Discard
Best Answer

why 2 discounts , i think you can make 2 discounts using one, (just do the math , and make one global fixed discount amount ).

However , there's always a way to do this kind of stuff using code ,

first , you have to seperate the global discount and per line discount ,

make 2 sepearate selections fields foreach type of discounts ,

discount1 = fields.Selection(['globalFix','Global Fix'],['globalPourcentage','Global %'])

discount2 = fields.Selection(['perLineFix','per Line Fix'],['perLinePourcentage','per line %'])

then using the onchage method
@api.onchange('discount1','discount2')

def onchange_discount(self):

if self.discount1 == 'globalFix':

     your calculations ()

if self.discount2 == 'per line' :

your calculations ()

Avatar
Discard