minor fix

This commit is contained in:
Camilo Sarmiento 2020-08-14 17:11:46 -05:00
parent cdeb770e9f
commit 1ccb56fa75
2 changed files with 10 additions and 6 deletions

View file

@ -7,10 +7,10 @@ from decimal import Decimal
from PyQt5.QtCore import Qt, QThread, pyqtSignal, QDate
from .tools import get_icon, to_float, to_numeric
from .dialogs import (Help, SearchSale, SearchParty, SearchProduct, Position,
Comment, DialogPayment, DialogSalesman, DialogVoucher, DialogPrintInvoice,
DialogGlobalDiscount, DialogPaymentTerm, DialogStock, DialogOrder,
DialogForceAssign, DialogTaxes, DialogCancelInvoice, SaleLine, DialogAgent,
DialogConsumer, DialogManageTables)
Comment, DialogPayment, DialogSalesman, DialogVoucher, DialogPrintInvoice,
DialogGlobalDiscount, DialogPaymentTerm, DialogStock, DialogOrder,
DialogForceAssign, DialogTaxes, DialogCancelInvoice, SaleLine, DialogAgent,
DialogConsumer, DialogManageTables)
from datetime import datetime, timedelta, date
from collections import OrderedDict
# from PyQt5.QtGui import QTouchEvent
@ -1882,13 +1882,14 @@ class MainWindow(FrontWindow):
self._current_line_id = res['id']
self.add_sale_line(res)
self._sale_line['product'] = product
print(product)
self._products[product['id']] = product
self.update_total_amount()
self.set_state('add')
def _check_stock_quantity(self, product, request_qty=None):
if not isinstance(product['quantity'], (str, int, float, Decimal)):
return True
qty_ = Decimal(product['quantity'])
if self._password_admin:
if (request_qty and qty_ < request_qty) or (qty_ <= 0):

View file

@ -82,7 +82,10 @@ class FastModel(object):
route = self.get_route('model_method')
data = json.dumps(args_, default=encoder)
res = requests.post(route, data=data)
data = res.json()
try:
data = res.json()
except ValueError:
print(res.text)
return data