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

@ -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)
try:
data = res.json()
except ValueError:
print(res.text)
return data