minor fix

This commit is contained in:
wilson gomez 2021-10-09 10:35:44 -05:00
parent 072b579248
commit 1a61dd6a4d
1 changed files with 3 additions and 2 deletions

View File

@ -778,7 +778,7 @@ class AppWindow(FrontWindow):
else:
eval_value = (1 - (value / price_w_tax)) * 100
if self.discount_method == 'fixed':
eval_value = price_w_tax - value
eval_value = price_w_tax - (value/Decimal(line['quantity']))
discount_valid = self.set_discount(eval_value)
if not discount_valid:
self.message_bar.set('discount_not_valid')
@ -1463,7 +1463,7 @@ class AppWindow(FrontWindow):
('id', '=', line_id)
])
price_w_tax = sale_line['product']['sale_price_w_tax']
price = price_w_tax - discount
price = price_w_tax - (discount/Decimal(line['quantity']))
if price < 0:
price = 0
res = self.set_unit_price(price)
@ -2735,6 +2735,7 @@ class AppWindow(FrontWindow):
def set_discount(self, eval_value, lines_ids=[], type_='percentage'):
res = False
print(lines_ids, type_, 'set_discount')
try:
value = round(float(str(eval_value)), 6)
except ValueError: