minor fix in process quantity

This commit is contained in:
Camilo Sarmiento 2020-09-12 11:12:22 -05:00
parent ed03e3bc7c
commit b1c261b85b
2 changed files with 15 additions and 12 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View file

@ -894,11 +894,12 @@ class MainWindow(FrontWindow):
if 1:
quantity = Decimal(eval_value)
# _product = self._sale_line['product']
product_id = self._sale_line['product']['id']
_product, = self.Product.find([('id', '=', product_id)], ctx=self.stock_context)
if _product and _product.get('quantity'):
if not self._check_stock_quantity(_product, quantity):
return False
product_id = self.product_id
if product_id:
_product, = self.Product.find([('id', '=', product_id)], ctx=self.stock_context)
if _product and _product.get('quantity'):
if not self._check_stock_quantity(_product, quantity):
return False
if self._current_line_id:
rec = self.ModSaleLine.faster_set_quantity({
'id': self._current_line_id,
@ -2071,6 +2072,7 @@ class MainWindow(FrontWindow):
self._current_line_id = res['id']
self.add_sale_line(res)
self._sale_line['product'] = product
self.product_id = product_id
self.update_total_amount()
self.set_state('add')
@ -2103,15 +2105,16 @@ class MainWindow(FrontWindow):
rec = self.model_sale_lines.add_record(record)
self.field_amount.setText(rec['amount_w_tax'])
def sale_line_selected(self, product):
def sale_line_selected(self, line):
if self._state == 'cash':
return
self._current_line_id = product['id']
self.label_product.setText(product['product.template.name'])
self.row_field_description.setText(product['description'])
self.row_field_qty.setValue(float(product['quantity']))
self.row_field_price.setText(str(product['unit_price_w_tax']))
# self.row_field_note.setText(str(product['note']))
self._current_line_id = line['id']
self.product_id = line['product']['id']
self.label_product.setText(line['product.template.name'])
self.row_field_description.setText(line['description'])
self.row_field_qty.setValue(float(line['quantity']))
self.row_field_price.setText(str(line['unit_price_w_tax']))
# self.row_field_note.setText(str(line['note']))
self.dialog_product_edit.show()
self.row_field_note.setFocus()