add option collection in retail
This commit is contained in:
parent
c20446576c
commit
ad64eac790
|
@ -63,6 +63,10 @@ class StartButtons(QVBoxLayout):
|
|||
['button_reports', 'REPORTES', 'action_reports', 'reports'],
|
||||
['button_historic_sales', 'HISTORIAL', 'action_historic_sales', 'sales_history'],
|
||||
])
|
||||
if parent.enviroment == 'retail':
|
||||
values_extend([
|
||||
['button_collection', 'RECAUDO', 'action_collection', 'collection']
|
||||
])
|
||||
|
||||
values_extend([
|
||||
['button_help', 'AYUDA', 'action_help', 'help'],
|
||||
|
|
190
app/dialogs.py
190
app/dialogs.py
|
@ -37,7 +37,7 @@ __all__ = [
|
|||
'DialogCancelInvoice', 'DialogForceAssign', 'CombineProduct',
|
||||
'DialogReports', 'DialogFixedDiscounts', 'DialogFixedDiscountsManual',
|
||||
'DialogExpenses', 'DialogInfoProduct', 'DialogAdvance',
|
||||
'DialogDeleteProduct'
|
||||
'DialogDeleteProduct', 'DialogCollection'
|
||||
]
|
||||
|
||||
WIZARDS = {
|
||||
|
@ -1658,7 +1658,7 @@ class DialogInfoProduct(QuickDialog):
|
|||
'write_date'])
|
||||
|
||||
if not products:
|
||||
self.message_bar.set('product_not_found')
|
||||
self._parent.message_bar.set('product_not_found')
|
||||
return False
|
||||
elif len(products) > 1:
|
||||
self.products = products
|
||||
|
@ -1718,3 +1718,189 @@ class DialogInfoProduct(QuickDialog):
|
|||
def dialog_accepted(self):
|
||||
self.clear()
|
||||
super(DialogInfoProduct, self).dialog_accepted()
|
||||
|
||||
|
||||
class DialogCollection(QuickDialog):
|
||||
def __init__(self, parent):
|
||||
self._parent = parent
|
||||
self.parties = []
|
||||
self.party_id = None
|
||||
self.statements = {}
|
||||
vbox = QVBoxLayout()
|
||||
grid = QGridLayout()
|
||||
|
||||
label_filter = QLabel('FILTRO:')
|
||||
label_filter.setObjectName('label_collection_filter')
|
||||
grid.addWidget(label_filter, 1, 1)
|
||||
self.input_filter = QLineEdit()
|
||||
self.input_filter.setObjectName('input_collection_filter')
|
||||
self.input_filter.editingFinished.connect(lambda: self.search())
|
||||
self.input_filter.returnPressed.connect(lambda: self.search())
|
||||
|
||||
grid.addWidget(self.input_filter, 1, 2)
|
||||
|
||||
label_id_number = QLabel('DOCUMENTO:')
|
||||
label_id_number.setObjectName('label_party_id_number')
|
||||
grid.addWidget(label_id_number, 2, 1)
|
||||
self.input_id_number = QLineEdit()
|
||||
self.input_id_number.setReadOnly(True)
|
||||
self.input_id_number.setObjectName('input_party_id_number')
|
||||
grid.addWidget(self.input_id_number, 2, 2)
|
||||
|
||||
label_name = QLabel('NOMBRE:')
|
||||
label_name.setObjectName('label_party_name')
|
||||
grid.addWidget(label_name, 3, 1)
|
||||
self.input_name = QLineEdit()
|
||||
self.input_name.setReadOnly(True)
|
||||
self.input_name.setObjectName('input_party_name')
|
||||
grid.addWidget(self.input_name, 3, 2)
|
||||
|
||||
label_amount = QLabel('VALOR:')
|
||||
label_amount.setObjectName('label_collection_amount')
|
||||
grid.addWidget(label_amount, 4, 1)
|
||||
self.input_amount = QLineEdit()
|
||||
self.input_amount.setObjectName('input_collection_amount')
|
||||
grid.addWidget(self.input_amount, 4, 2)
|
||||
|
||||
label_payment_method = QLabel('MODO DE PAGO:')
|
||||
label_payment_method.setObjectName('label_collection_payment_method')
|
||||
grid.addWidget(label_payment_method, 5, 1)
|
||||
self.combobox_payment_method = ComboBox(
|
||||
parent, 'payment_method', {'values': self.get_payment_methods()}
|
||||
)
|
||||
grid.addWidget(self.combobox_payment_method, 5, 2)
|
||||
|
||||
label_voucher_number = QLabel('NUMERO COMPROBANTE:')
|
||||
label_voucher_number.setObjectName('label_collection_voucher_number')
|
||||
grid.addWidget(label_voucher_number, 6, 1)
|
||||
self.input_voucher_number = QLineEdit()
|
||||
self.input_voucher_number.setObjectName('input_collection_voucher_number')
|
||||
grid.addWidget(self.input_voucher_number, 6, 2)
|
||||
|
||||
vbox.addLayout(grid)
|
||||
super(DialogCollection, self).__init__(parent, 'help', widgets=[vbox])
|
||||
self.setWindowTitle('RECAUDO')
|
||||
self.ok_button.setDefault(False)
|
||||
width, height = get_screen()
|
||||
self.setGeometry(0, 0, int(width * 0.4), int(height * 0.5))
|
||||
self.input_filter.setFocus()
|
||||
|
||||
def fill(self, values):
|
||||
self.input_id_number.setText(values['id_number'])
|
||||
self.input_name.setText(values['name'])
|
||||
self.party_id = values['id']
|
||||
|
||||
def get_payment_methods(self):
|
||||
domain = [
|
||||
["sale_device", "=", self._parent.device['id']],
|
||||
["state", "=", "draft"]
|
||||
]
|
||||
statements = self._parent.Statement.find(domain,
|
||||
fields=['rec_name', 'journal.require_voucher'])
|
||||
records = [('', '')]
|
||||
statements_ = {}
|
||||
print(statements, 'validate statement')
|
||||
for st in statements:
|
||||
statements_[st['id']] = st
|
||||
records.append((st['id'], st['rec_name']))
|
||||
self.statements = statements_
|
||||
return records
|
||||
|
||||
def search(self, values=None):
|
||||
self.ok_button.setDefault(False)
|
||||
filter = self.input_filter.text()
|
||||
if not filter:
|
||||
return
|
||||
|
||||
domain = ['OR',
|
||||
('id_number', 'ilike', '%' + filter + '%'),
|
||||
('name', 'ilike', '%' + filter + '%'),
|
||||
]
|
||||
|
||||
parties = self._parent.Party.find(domain,
|
||||
fields=['name', 'id_number'])
|
||||
|
||||
if not parties:
|
||||
self.create_dialog_message('TERCERO NO ENCONTRADO..!', 'error')
|
||||
return False
|
||||
elif len(parties) > 1:
|
||||
self.parties = parties
|
||||
self.create_dialog_select_item(parties)
|
||||
else:
|
||||
party = parties[0]
|
||||
if party:
|
||||
self.fill(party)
|
||||
|
||||
def on_selected_party(self, row=None):
|
||||
id_number = row[0]
|
||||
for party in self.parties:
|
||||
if party['id_number'] == id_number:
|
||||
self.fill(party)
|
||||
self.dialog_select_item.hide()
|
||||
break
|
||||
|
||||
def create_dialog_select_item(self, parties):
|
||||
parent = self._parent
|
||||
width, height = get_screen()
|
||||
grid = QGridLayout()
|
||||
_sizes = (160, 320)
|
||||
fields = (
|
||||
{'label': 'DOCUMENTO', 'type': 'char', 'readonly': False},
|
||||
{'label': 'NOMBRE', 'type': 'char', 'readonly': False},
|
||||
)
|
||||
self.model = TableEdit(self, [], fields)
|
||||
self.table = TableView('model_party', self.model, _sizes, editable=False, method_selected_row=self.on_selected_party)
|
||||
self.table.setFixedSize(int(width * 0.35), int(height * 0.4))
|
||||
grid.addWidget(self.table, 1, 0, 1, 2)
|
||||
self.dialog_select_item = QuickDialog(parent, 'action', widgets=[grid], readonly=True, buttons=True)
|
||||
self.dialog_select_item.setWindowTitle('TERCEROS')
|
||||
self.load(parties)
|
||||
self.dialog_select_item.show()
|
||||
|
||||
def load(self, parties):
|
||||
if not parties:
|
||||
return
|
||||
for rec in parties:
|
||||
data = [
|
||||
rec['id_number'],
|
||||
rec['name'],
|
||||
]
|
||||
self.model.add_record(data)
|
||||
|
||||
def show(self):
|
||||
super(DialogCollection, self).show()
|
||||
self.input_filter.setFocus()
|
||||
|
||||
def clear(self):
|
||||
self.input_filter.setText('')
|
||||
self.input_id_number.setText('')
|
||||
self.input_name.setText('')
|
||||
self.input_amount.setText('')
|
||||
self.combobox_payment_method.set_none()
|
||||
self.input_voucher_number.setText('')
|
||||
self.party_id = None
|
||||
|
||||
def dialog_accepted(self):
|
||||
args = {
|
||||
'party': self.party_id,
|
||||
'amount': self.input_amount.text(),
|
||||
'statement': self.combobox_payment_method.get_id(),
|
||||
'voucher_number': self.input_voucher_number.text()
|
||||
}
|
||||
require_voucher = self.statements[int(args['statement'])]['journal.']['require_voucher']
|
||||
if not args.get('voucher_number') and require_voucher:
|
||||
self.create_dialog_message('REQUIERE COMPROBANTE', 'info')
|
||||
return False
|
||||
rec = self._parent.Statement.apply_payment_collection(args)
|
||||
if rec.get('status') and rec.get('status') == 'ok':
|
||||
self.create_dialog_message(rec['message'], 'info')
|
||||
else:
|
||||
self.create_dialog_message(rec['message'], 'error')
|
||||
|
||||
self.clear()
|
||||
super(DialogCollection, self).dialog_accepted()
|
||||
|
||||
def create_dialog_message(self, message, kind):
|
||||
parent = self._parent
|
||||
width, height = get_screen()
|
||||
self.dialog_message = QuickDialog(parent, kind, string=message, readonly=True, buttons=True)
|
||||
|
|
|
@ -23,7 +23,7 @@ from .dialogs import (
|
|||
DialogDeliveryParty, TipAmount, DeliveryAmount, DialogSalesmanCode,
|
||||
DialogFixedDiscounts, DialogFixedDiscountsManual, DialogComboProduct,
|
||||
DialogSplitSale, DialogExpenses, DialogInfoProduct, DialogAdvance,
|
||||
DialogDeleteProduct
|
||||
DialogDeleteProduct, DialogCollection
|
||||
)
|
||||
from .constants import DIALOG_REPLY_YES
|
||||
from .version import __version__
|
||||
|
@ -208,6 +208,8 @@ class FrontWindow(QMainWindow):
|
|||
self.dialog_sale_form = DialogSaleForm(self)
|
||||
self.dialog_consumer = DialogConsumer(self)
|
||||
self.dialog_manage_tables = DialogManageTables(self)
|
||||
else:
|
||||
self.dialog_collection = DialogCollection(self)
|
||||
|
||||
def action_help(self):
|
||||
Help(self).show()
|
||||
|
|
|
@ -1421,6 +1421,9 @@ class AppWindow(FrontWindow):
|
|||
def action_info_product(self):
|
||||
self.dialog_info_product.show()
|
||||
|
||||
def action_collection(self):
|
||||
self.dialog_collection.show()
|
||||
|
||||
def action_add_advance(self):
|
||||
if self.type_pos_user not in ('cashier', 'frontend_admin'):
|
||||
self.dialog('user_without_permission')
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<svg viewBox="0 0 511 511.99978" xmlns="http://www.w3.org/2000/svg"><path d="m235.792969 347.265625c3.902343-3.910156 3.902343-10.238281 0-14.148437-3.90625-3.898438-10.234375-3.898438-14.144531 0-3.898438 3.910156-3.898438 10.238281 0 14.148437 3.910156 3.898437 10.238281 3.898437 14.144531 0zm0 0"/><path d="m188.449219 109.96875c0 60.636719 49.332031 109.972656 109.96875 109.972656s109.96875-49.335937 109.96875-109.972656-49.332031-109.96875-109.96875-109.96875-109.96875 49.332031-109.96875 109.96875zm199.945312 0c0 49.613281-40.363281 89.976562-89.976562 89.976562s-89.976563-40.363281-89.976563-89.976562c0-49.609375 40.363282-89.972656 89.976563-89.972656s89.976562 40.363281 89.976562 89.972656zm0 0"/><path d="m115.652344 509.042969c3.875 3.90625 10.183594 3.949219 14.109375.082031l48.46875-47.75c8.234375-8.234375 10.738281-20.425781 7.117187-31.023438l10.425782-10.054687c5.613281-5.421875 13.003906-8.410156 20.816406-8.410156h132.902344c23.578124 0 45.863281-9.054688 62.757812-25.496094.695312-.675781-5.277344 6.359375 90.667969-108.3125 14.230469-16.835937 12.101562-42.117187-4.75-56.363281-16.746094-14.113282-41.832031-12.085938-56.101563 4.460937l-58.992187 60.632813c-7.449219-9.167969-18.808594-14.882813-31.082031-14.882813h-111.480469c-15.863281-6.636719-32.695313-9.996093-50.0625-9.996093-48.140625 0-90.175781 22.234374-112.734375 63.921874-9.503906-1.800781-19.527344 1.074219-26.738282 8.285157l-47.558593 47.699219c-3.882813 3.894531-3.890625 10.195312-.015625 14.101562zm74.792968-227.121094c15.3125 0 30.117188 3.082031 44.011719 9.160156 1.265625.554688 2.628907.839844 4.007813.839844h113.527344c10.839843 0 19.996093 8.839844 19.996093 19.992187 0 11.027344-8.96875 19.996094-19.996093 19.996094h-81.566407c-5.519531 0-9.996093 4.476563-9.996093 9.996094 0 5.523438 4.476562 9.996094 9.996093 9.996094h81.566407c22.050781 0 39.988281-17.9375 39.988281-39.988282 0-1.757812-.125-3.5-.351563-5.226562 57.066406-58.660156 65.113282-66.902344 65.457032-67.3125 7.125-8.410156 19.773437-9.476562 28.1875-2.382812 8.421874 7.121093 9.488281 19.761718 2.34375 28.21875l-89.667969 107.195312c-13.09375 12.570312-30.285157 19.488281-48.457031 19.488281h-132.902344c-13.023438 0-25.351563 4.980469-34.703125 14.015625l-8.496094 8.199219-78.320313-78.316406c18.304688-34.339844 52.652344-53.871094 95.375-53.871094zm-125.320312 66.34375c3.296875-3.296875 8.359375-3.890625 12.378906-1.40625 1.730469 1.054687-3.238281-3.46875 86.589844 86.234375 3.996094 3.996094 3.78125 10.363281.054688 14.089844l-41.320313 40.707031-98.230469-98.980469zm0 0"/><path d="m286.421875 49.988281v11.714844c-11.636719 4.125-19.996094 15.238281-19.996094 28.273437 0 16.535157 13.453125 29.992188 29.992188 29.992188 5.511719 0 9.996093 4.484375 9.996093 9.996094 0 5.511718-4.484374 9.996094-9.996093 9.996094-4.269531 0-8.882813-2.683594-12.980469-7.5625-3.554688-4.226563-9.859375-4.769532-14.085938-1.21875-4.226562 3.554687-4.773437 9.859374-1.21875 14.085937 5.34375 6.355469 11.628907 10.785156 18.289063 13.019531v11.667969c0 5.523437 4.476563 9.996094 9.996094 9.996094s9.996093-4.472657 9.996093-9.996094v-11.714844c11.636719-4.128906 19.996094-15.242187 19.996094-28.273437 0-16.539063-13.453125-29.992188-29.992187-29.992188-5.511719 0-9.996094-4.484375-9.996094-9.996094 0-5.511718 4.484375-10 9.996094-10 3.542969 0 7.28125 1.808594 10.8125 5.226563 3.96875 3.839844 10.296875 3.734375 14.136719-.230469 3.839843-3.96875 3.734374-10.296875-.230469-14.136718-5.074219-4.910157-10.152344-7.6875-14.722657-9.203126v-11.644531c0-5.523437-4.476562-10-9.996093-10s-9.996094 4.476563-9.996094 10zm0 0"/></svg>
|
After Width: | Height: | Size: 3.5 KiB |
|
@ -33,6 +33,8 @@ class StackMessages(QWidget):
|
|||
'missing_journal_device': ('error', 'FALTA EL DIARIO EN EL TERMINAL!'),
|
||||
'statement_closed': ('error', 'NO HAY ESTADOS DE CUENTA ABIERTOS!'),
|
||||
'product_not_found': ('warning', 'PRODUCTO NO ENCONTRADO!'),
|
||||
'party_not_found': ('warning', 'TERCERO NO ENCONTRADO!'),
|
||||
'require_voucher': ('warning', 'REQUIERE NUMERO DE COMPROBANTE'),
|
||||
'must_load_or_create_sale': ('warning', 'PRIMERO DEBE CREAR/CARGAR UNA VENTA!'),
|
||||
'new_sale': ('warning', 'DESEA CREAR UNA NUEVA VENTA?'),
|
||||
'cancel_sale': ('question', 'DESEA CANCELAR LA VENTA?'),
|
||||
|
|
|
@ -1 +1 @@
|
|||
__version__ = "6.0.9"
|
||||
__version__ = "6.0.10"
|
||||
|
|
Loading…
Reference in New Issue