Our company pays commissions based on the discount given on a line by line basis. I am trying to show this commission amount on the invoice copy we send to the sales rep.
I am using Odoo studio in v12.0 and created a field x_studio_field_dakHb labeled "Commission Amount" that appears in account.invoice.line model.
I have checked the "Readonly" and "Stored" boxes. In "Dependencies" field I have "discount, price_subtotal".
In the "Advanced Properties" section I have:
def compute_commission_amount(self):
for record in self:
if (discount >= 55.0):
x_studio_field_dakHb = (price_subtotal * .05)
elif (discount >= 45.0):
x_studio_field_dakHb = (price_subtotal * .10)
elif (discount >= 30.0):
x_studio_field_dakHb = (price_subtotal * .15)
elif (discount >= 25.0):
x_studio_field_dakHb = (price_subtotal * .20)
elif (discount >= 0.0):
x_studio_field_dakHb = (price_subtotal * .25)
I am not getting any errors, but the field is not not calculating as I anticipated.
An example of what I am expecting would be as follows:
Is there something I am missing in my code to get it to calculate properly?