Skip to content

Odoo onChange Discount Bug #59

@akshaybirajdar

Description

@akshaybirajdar

def onchange_order_line(self):

The none type of discount should set the discount amount and discount percentage to zero.

def onchange_discount(self):
    amount_total = self.amount_untaxed + self.amount_tax
    if self.chargeable_amount:
        if self.discount_type == 'none' and self.chargeable_amount:
            self.discount_type = 'fixed'
            discount = amount_total - self.chargeable_amount
            self.discount_percentage = (discount / amount_total) * 100
        else:
            if self.discount_type == 'none':
                self.discount_percentage = 0
                self.discount = 0
            if self.discount:
                self.discount_percentage = (self.discount / amount_total) * 100
            if self.discount_percentage:
                self.discount = amount_total * self.discount_percentage / 100

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions