v5.0.48 add option copy table search window
This commit is contained in:
parent
c9b9ae488a
commit
e4eaa7a063
|
@ -1,14 +1,15 @@
|
|||
import os
|
||||
from operator import itemgetter
|
||||
from datetime import timedelta, datetime
|
||||
from PyQt5.Qt import QApplication, QClipboard
|
||||
from PyQt5.QtCore import (
|
||||
Qt, QVariant, QAbstractTableModel, pyqtSignal, QModelIndex
|
||||
)
|
||||
from PyQt5.QtWidgets import (
|
||||
QTableView, QVBoxLayout, QAbstractItemView, QLineEdit, QDialog, QLabel,
|
||||
QHBoxLayout, QItemDelegate
|
||||
QHBoxLayout, QItemDelegate, QMenu, QAction
|
||||
)
|
||||
from PyQt5.QtGui import QPixmap, QIcon
|
||||
from PyQt5.QtGui import QPixmap, QIcon, QCursor
|
||||
|
||||
from .buttons import ActionButton
|
||||
from ..tools import get_screen
|
||||
|
@ -22,6 +23,7 @@ DIR = os.path.abspath(os.path.normpath(os.path.join(__file__,
|
|||
ICONS = {
|
||||
'image': os.path.join(DIR, 'share/icon-camera.svg'),
|
||||
'stock': os.path.join(DIR, 'share/icon-stock.svg'),
|
||||
'copy': os.path.join(DIR, 'share/icon-copy.svg'),
|
||||
}
|
||||
|
||||
|
||||
|
@ -277,6 +279,29 @@ class SearchWindow(QDialog):
|
|||
pass
|
||||
super(SearchWindow, self).keyPressEvent(event)
|
||||
|
||||
def contextMenuEvent(self, event):
|
||||
self.menu = QMenu(self)
|
||||
|
||||
pix_copy = QPixmap()
|
||||
pix_copy.load(ICONS['copy'])
|
||||
icon_copy = QIcon()
|
||||
icon_copy.addPixmap(pix_copy)
|
||||
|
||||
copyAction = QAction(icon_copy, 'copy', self)
|
||||
copyAction.triggered.connect(lambda: self.copySlot(event))
|
||||
self.menu.addAction(copyAction)
|
||||
# add other required actions
|
||||
self.menu.popup(QCursor.pos())
|
||||
|
||||
def copySlot(self, event):
|
||||
# get the selected cell
|
||||
selected = self.table_view.currentIndex()
|
||||
clipboard = QApplication.clipboard()
|
||||
clipboard.setText(selected.data())
|
||||
# get the selected row and column
|
||||
# row = selected.row()
|
||||
# col = selected.column()
|
||||
|
||||
|
||||
class TableModel(QAbstractTableModel):
|
||||
sigItem_selected = pyqtSignal(str)
|
||||
|
|
|
@ -251,6 +251,7 @@ class SearchParty(SearchWindow):
|
|||
methods = {
|
||||
'on_selected_method': 'on_selected_party',
|
||||
'on_return_method': 'on_search_party',
|
||||
# 'street': parent.on_selected_street_party
|
||||
}
|
||||
super(SearchParty, self).__init__(parent, headers, None, methods,
|
||||
filter_column=[], cols_width=[60, 120, 270, 190, 90],
|
||||
|
|
|
@ -3142,6 +3142,7 @@ class AppWindow(FrontWindow):
|
|||
self.dialog_product_edit.clear()
|
||||
|
||||
def edit_line_sale(self, data, line):
|
||||
print('ingresa a edit line')
|
||||
current_unit_price = float(str(round(line['unit_price_w_tax'], 0)))
|
||||
sale_line, = self.SaleLine.find([
|
||||
('id', '=', line['id'])
|
||||
|
@ -3154,9 +3155,12 @@ class AppWindow(FrontWindow):
|
|||
if k in ['description', 'note']:
|
||||
to_write[k] = v
|
||||
elif k == 'unit_price' and float(v) != current_unit_price:
|
||||
print('uno')
|
||||
if float(v) > base_price:
|
||||
print('ingresa a set uni')
|
||||
self.set_unit_price(v, discount=False)
|
||||
else:
|
||||
print('discount')
|
||||
self._sign = '/'
|
||||
value = current_unit_price - float(v)
|
||||
self.set_discount(value, type_='fixed')
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><g id="Layer_100" data-name="Layer 100"><path d="M44.84,10.5H24.9a5,5,0,0,0-5,5V42.8a5,5,0,0,0,5,5H44.84a5,5,0,0,0,5-5V15.46A5,5,0,0,0,44.84,10.5Zm2,32.3a2,2,0,0,1-2,2H24.9a2,2,0,0,1-2-2V15.46a2,2,0,0,1,2-2H44.84a2,2,0,0,1,2,2Z"/><path d="M39.07,50.5H19.18a2,2,0,0,1-2-2V21.23a1.5,1.5,0,0,0-3,0V48.51a5,5,0,0,0,5,5H39.07A1.5,1.5,0,0,0,39.07,50.5Z"/></g></svg>
|
After Width: | Height: | Size: 419 B |
|
@ -1 +1 @@
|
|||
__version__ = "5.0.47"
|
||||
__version__ = "5.0.48"
|
Loading…
Reference in New Issue