Test add fields to search

This commit is contained in:
Oscar Alvarez 2020-12-14 22:51:28 -05:00
parent 6d9dc3c047
commit 2b2d8b6f04
3 changed files with 9 additions and 4 deletions

View File

@ -41,6 +41,10 @@ from .constants import (
)
MINIMUM_DATE = QDate(0, 1, 1)
SALE_FIELDS = [
'id', 'number', 'invoice_number', 'party.name', 'sale_date',
'salesman.name', 'position', 'total_amount_cache',
]
class MainWindow(FrontWindow):
@ -1543,7 +1547,7 @@ class MainWindow(FrontWindow):
def action_search_sale(self):
# if self._state in ['cash']:
# return
delta = str(datetime.now() - timedelta(2))
delta = str(datetime.now() - timedelta(4))
if self.type_pos_user == 'cashier':
dom = ['OR', [
('create_date', '>=', delta),
@ -1564,9 +1568,9 @@ class MainWindow(FrontWindow):
('create_date', '>=', delta),
]
sales = self.ModSale.find(dom, order=[('id', 'DESC')])
sales = self.ModSale.find(dom, fields=SALE_FIELDS, order=[('id', 'DESC')])
self.dialog_search_sales.set_from_values(sales)
print(sales[0])
if self.enviroment == 'retail':
dom_draft = [
('create_date', '>=', delta),

View File

@ -30,7 +30,7 @@ class FastModel(object):
self.method = name
return self
def find(self, domain, order=None, limit=1000, ctx=None):
def find(self, domain, order=None, limit=1000, ctx=None, fields=None):
if ctx:
self.ctx.update(ctx)
route = self.get_route('search')
@ -39,6 +39,7 @@ class FastModel(object):
'domain': domain,
'order': order,
'limit': limit,
'fields': fields,
'context': self.ctx,
}
data = json.dumps(args_, default=encoder)

BIN
lp0

Binary file not shown.