fix payment delivery or tip
This commit is contained in:
parent
77b9778886
commit
b2eea4ea88
|
@ -339,6 +339,8 @@ class FrontWindow(QMainWindow):
|
|||
self.default_payment_term = self.shop['payment_term.']
|
||||
self._password_admin = self._config.get('password_admin_pos')
|
||||
self._password_force_assign = self._config.get('password_force_assign')
|
||||
self.printers_shop = None
|
||||
self.products_printers = None
|
||||
if self.environment == 'restaurant':
|
||||
self._sale_pos_restaurant = 'sale_pos_frontend_rest' in self.modules
|
||||
if self._sale_pos_restaurant:
|
||||
|
|
50
app/main.py
50
app/main.py
|
@ -654,12 +654,20 @@ class AppWindow(FrontWindow):
|
|||
'color': label_color,
|
||||
}),
|
||||
('change', {
|
||||
'name': 'CAMBIO',
|
||||
'readonly': True,
|
||||
'type': 'money',
|
||||
'size': screen,
|
||||
'color': self.label_color_2 or 'orange'
|
||||
}),
|
||||
('residual_amount', {
|
||||
'name': 'PENDIENTE',
|
||||
'readonly': True,
|
||||
'type': 'money',
|
||||
'size': screen,
|
||||
'color': self.label_color_2 or 'orange'
|
||||
})
|
||||
}),
|
||||
|
||||
]
|
||||
_fields_amounts_insert = _fields_amounts.insert
|
||||
if self.environment == 'restaurant':
|
||||
|
@ -929,7 +937,11 @@ class AppWindow(FrontWindow):
|
|||
return False
|
||||
|
||||
if res['residual_amount'] <= 0:
|
||||
self.grid_amounts.label_change.setText('CAMBIO')
|
||||
self.grid_amounts.label_residual_amount.hide()
|
||||
self.field_residual_amount.hide()
|
||||
self.grid_amounts.label_change.show()
|
||||
self.field_change.setVisible(True)
|
||||
# self.grid_amounts.label_change.setText('CAMBIO')
|
||||
self._done_sale()
|
||||
return True
|
||||
|
||||
|
@ -1205,6 +1217,7 @@ class AppWindow(FrontWindow):
|
|||
self.store.update({'salesman': salesman})
|
||||
|
||||
def action_tip(self):
|
||||
print(self._state,'validate this state')
|
||||
if self._state in ['finished']:
|
||||
return
|
||||
|
||||
|
@ -1231,6 +1244,9 @@ class AppWindow(FrontWindow):
|
|||
else:
|
||||
res = self.store.update({'tip_amount': value})
|
||||
self.set_amounts(res)
|
||||
if self._state == 'payment' and self.store.store['residual_amount'] == 0:
|
||||
self.Sale.reconcile_invoice({'sale_id': self.sale_id})
|
||||
self._done_sale()
|
||||
|
||||
def action_delivery(self):
|
||||
if self._state in ['finished']:
|
||||
|
@ -1252,6 +1268,10 @@ class AppWindow(FrontWindow):
|
|||
res = self.store.update({'delivery_amount': value})
|
||||
self.set_amounts(res)
|
||||
|
||||
if self._state == 'payment' and self.store.store['residual_amount'] == 0:
|
||||
self.Sale.reconcile_invoice({'sale_id': self.sale_id})
|
||||
self._done_sale()
|
||||
|
||||
def action_salesman_code(self):
|
||||
if self._state in ['checkout']:
|
||||
return
|
||||
|
@ -2295,10 +2315,10 @@ class AppWindow(FrontWindow):
|
|||
self.menu_dash.setDisabled(False)
|
||||
self.set_state('payment')
|
||||
|
||||
def set_change_amount(self):
|
||||
amount_paid = self.table_payment_lines.get_sum('amount')
|
||||
res = amount_paid - self._get_total_amount()
|
||||
self.field_change.setText(res)
|
||||
# def set_change_amount(self):
|
||||
# amount_paid = self.table_payment_lines.get_sum('amount')
|
||||
# res = amount_paid - self._get_total_amount()
|
||||
# self.field_change.setText(res)
|
||||
|
||||
def set_amount_received(self, cash_received=ZERO):
|
||||
pass
|
||||
|
@ -2645,6 +2665,11 @@ class AppWindow(FrontWindow):
|
|||
self.field_tax_amount.zero()
|
||||
self.field_total_amount.zero()
|
||||
self.field_change.zero()
|
||||
self.field_residual_amount.zero()
|
||||
self.field_residual_amount.setVisible(True)
|
||||
self.grid_amounts.label_residual_amount.show()
|
||||
self.grid_amounts.label_change.hide()
|
||||
self.field_change.hide()
|
||||
self.field_paid_amount.zero()
|
||||
self.field_discount.zero()
|
||||
self.table_payment_lines.reset()
|
||||
|
@ -2725,17 +2750,17 @@ class AppWindow(FrontWindow):
|
|||
self._clear_invoice_number = True
|
||||
last_invoice_number = self.store.get('invoice_number')
|
||||
self.store.clear(
|
||||
exception=['change', 'total_amount', 'net_amount', 'paid_amount']
|
||||
exception=['change', 'total_amount', 'net_amount', 'paid_amount', 'residual_amount']
|
||||
)
|
||||
self.journal = {}
|
||||
self._consumer = {}
|
||||
self.set_state('add')
|
||||
self.input_text_changed('')
|
||||
self.amount_text_changed('0')
|
||||
self.clear_sign()
|
||||
change = self.field_change.text()
|
||||
# self.input_text_changed('')
|
||||
# self.amount_text_changed('0')
|
||||
# change = self.field_change.text()
|
||||
# self.field_change.setText(change.replace(',', ''))
|
||||
self.clear_right_panel()
|
||||
self.field_change.setText(change.replace(',', ''))
|
||||
self.show_right_panel(True)
|
||||
self.payment_ctx = {}
|
||||
self.table_sale_lines.setEnabled(True)
|
||||
|
@ -2861,7 +2886,8 @@ class AppWindow(FrontWindow):
|
|||
if self._clear_invoice_number:
|
||||
self.field_invoice_number.setText('')
|
||||
self._clear_invoice_number = False
|
||||
self.grid_amounts.label_change.setText('PENDIENTE')
|
||||
# self.grid_amounts.label_residual_amount.hide()
|
||||
# self.grid_amounts.label_change.setText('PENDIENTE')
|
||||
product_id = record['id'] if record else None
|
||||
if not product_id and code:
|
||||
# REMOVE ME THIS OPTION IS FOR BARCODE
|
||||
|
|
Loading…
Reference in New Issue