mirror of
https://bitbucket.org/presik/presik_pos.git
synced 2023-12-14 06:03:00 +01:00
minor fix
This commit is contained in:
parent
22c737d824
commit
79acee9322
1 changed files with 13 additions and 8 deletions
21
app/main.py
21
app/main.py
|
@ -776,7 +776,7 @@ class AppWindow(FrontWindow):
|
|||
def _process_price(self, text, line=None):
|
||||
discount_valid = True
|
||||
eval_value = text.replace(',', '')
|
||||
value = float(eval_value)
|
||||
value = Decimal(eval_value)
|
||||
if not line:
|
||||
line_id = self._current_line_id
|
||||
else:
|
||||
|
@ -796,14 +796,14 @@ class AppWindow(FrontWindow):
|
|||
sale_line, = self.SaleLine.find([
|
||||
('id', '=', line_id)
|
||||
])
|
||||
price_w_tax = sale_line['product']['sale_price_w_tax']
|
||||
if price_w_tax <= Decimal(value):
|
||||
price_w_tax = Decimal(sale_line['product']['sale_price_w_tax'])
|
||||
qty = Decimal(sale_line['quantity'])
|
||||
if price_w_tax <= (value/qty):
|
||||
discount_valid = self.set_unit_price(value, discount=False)
|
||||
else:
|
||||
# eval_value = (1 - (value / price_w_tax)) * 100
|
||||
# if self.discount_method == 'fixed':
|
||||
eval_value = Decimal(price_w_tax) - \
|
||||
(Decimal(value)/Decimal(sale_line['quantity']))
|
||||
eval_value = price_w_tax - (value/qty)
|
||||
discount_valid = self.set_discount(eval_value, type_='fixed')
|
||||
if not discount_valid:
|
||||
self.message_bar.set('discount_not_valid')
|
||||
|
@ -3136,7 +3136,9 @@ class AppWindow(FrontWindow):
|
|||
self.set_unit_price(v, discount=False)
|
||||
else:
|
||||
self._sign = '/'
|
||||
self.set_discount(current_unit_price - float(v), type_='fixed')
|
||||
value = current_unit_price - float(v)
|
||||
print(value, 'final')
|
||||
self.set_discount(value, type_='fixed')
|
||||
# self._process_price(v, line)
|
||||
self._sign = None
|
||||
elif k == 'quantity' and v != previous_qty:
|
||||
|
@ -3148,8 +3150,11 @@ class AppWindow(FrontWindow):
|
|||
elif k == 'update_base_price' and current_unit_price != base_price:
|
||||
self.set_unit_price(base_price, discount=False)
|
||||
|
||||
_record = self.SaleLine.write([data['id']], to_write)
|
||||
|
||||
self.SaleLine.write([data['id']], to_write)
|
||||
_record, = self.SaleLine.find([
|
||||
('id', '=', data['id'])
|
||||
])
|
||||
print(_record)
|
||||
return _record
|
||||
|
||||
def save_consumer(self, consumer):
|
||||
|
|
Loading…
Reference in a new issue