add field party in history and check permission discount

This commit is contained in:
wilsongomez 2022-05-11 11:55:41 -05:00
parent 0190ee3ca4
commit 610baa5cef
4 changed files with 22 additions and 4 deletions

View File

@ -321,6 +321,8 @@ class FieldNumeric(QLineEdit):
self.value_changed = True
def text_changed(self, amount):
if amount == '':
return
amount = amount.replace(',', '')
text = "{0:,.2f}".format(float(amount))
self.setText(text)

View File

@ -507,7 +507,7 @@ class DialogHistoricSales(QuickDialog):
vbox_.addSpacing(10)
super(DialogHistoricSales, self).__init__(parent, 'action', widgets=[vbox_])
self.setWindowTitle('-- VENTA --')
self.setFixedSize(int(width * 0.6), int(height * 0.7))
self.setFixedSize(int(width * 0.8), int(height * 0.7))
class DialogSaleForm(QuickDialog):

View File

@ -840,7 +840,7 @@ class AppWindow(FrontWindow):
def _process_pay(self, text):
if not self.validate_done_sale():
return
cash_received = Decimal(text.replace(',', ''))
cash_received = Decimal(text)
if self._commission_activated and self.enviroment == 'retail':
if not self.journal:
@ -1507,6 +1507,9 @@ class AppWindow(FrontWindow):
def action_global_discount(self, sale_id=None):
if self._state in ('accept', 'checkout', 'payment'):
return
if self.enviroment == 'restaurant' and self.type_pos_user not in ('cashier', 'frontend_admin'):
self.dialog('user_without_permission')
return
self.dialog_global_discount.exec_()
discount = self.field_global_discount_ask.text()
if discount and discount.isdigit():
@ -1724,7 +1727,7 @@ class AppWindow(FrontWindow):
if not self._sale_historic:
delta = str(datetime.now() - timedelta(30))
delta = str(datetime.now() - timedelta(2))
dom = [
('create_date', '>=', delta),
('state', 'in', ['processing', 'done']),
@ -2678,6 +2681,12 @@ class AppWindow(FrontWindow):
'description': 'CONSUMIDOR',
'width': 330
}
party = {
'name': 'party.name',
'align': alignLeft,
'description': 'CLIENTE',
'width': 330
}
sale_date = {
'name': 'sale_date',
'align': alignCenter,
@ -2693,7 +2702,7 @@ class AppWindow(FrontWindow):
}
self.fields_sales_query = [
number, invoice_number, sale_date, consumer, total_amount_cache
number, invoice_number, sale_date, consumer, party, total_amount_cache
]
self.model_sale_historic = TableModel(
'sale.sale', self.fields_sales_query)
@ -2761,11 +2770,17 @@ class AppWindow(FrontWindow):
self.table_sale_lines.moved_selection(key)
def action_discount_line(self, record):
if self.enviroment == 'restaurant' and self.type_pos_user not in ('cashier', 'frontend_admin'):
self.dialog('user_without_permission')
return
self.dialog_fixed_discount.exec_()
if self.enviroment == 'restaurant':
self.dialog_combine_product.close()
def action_discount_bono_line(self, record):
if self.enviroment == 'restaurant' and self.type_pos_user not in ('cashier', 'frontend_admin'):
self.dialog('user_without_permission')
return
self.field_bono_discount_manual.setText('')
self.dialog_fixed_discount_manual.exec_()
if self.enviroment == 'restaurant':

View File

@ -57,4 +57,5 @@ class StackMessages(QWidget):
'select_products_to_split': ('question', 'SELECCIONE LOS PRODUCTOS A DIVIDIR!'),
'fail_send_invoice': ('info', 'FALLO LA VALIDACION DE LA FACTURA ELECTRONICA!'),
'release_table': ('question', 'DESEA LIBERAR LA MESA?'),
'user_without_permission': ('info', 'USUARIO NO AUTORIZADO!'),
}