From 3a10a4bcb7cfcfd675dd9ea680a5f42a4ccdf0fc Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 11 Nov 2021 13:37:10 -0600 Subject: [PATCH 0001/1183] Improve error handling when executing a custorder batch --- tailbone/templates/custorders/create.mako | 23 ++++++++++------------- tailbone/views/custorders/orders.py | 10 +++++++--- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/tailbone/templates/custorders/create.mako b/tailbone/templates/custorders/create.mako index a78eed6c..cfbc4894 100644 --- a/tailbone/templates/custorders/create.mako +++ b/tailbone/templates/custorders/create.mako @@ -483,7 +483,8 @@ @click="showAddItemDialog()"> Add Item - Add Past Item @@ -1239,6 +1240,9 @@ type: 'is-danger', duration: 2000, // 2 seconds }) + if (failure) { + failure(response) + } }) }, @@ -1250,20 +1254,13 @@ } this.submitBatchData(params, response => { - if (response.data.error) { - this.$buefy.toast.open({ - message: "Submit failed: " + response.data.error, - type: 'is-danger', - duration: 2000, // 2 seconds - }) - this.submittingOrder = false + if (response.data.next_url) { + location.href = response.data.next_url } else { - if (response.data.next_url) { - location.href = response.data.next_url - } else { - location.reload() - } + location.reload() } + }, response => { + this.submittingOrder = false }) }, diff --git a/tailbone/views/custorders/orders.py b/tailbone/views/custorders/orders.py index 79753c50..49280d96 100644 --- a/tailbone/views/custorders/orders.py +++ b/tailbone/views/custorders/orders.py @@ -779,9 +779,13 @@ class CustomerOrderView(MasterView): 'batch': self.normalize_batch(batch)} def submit_new_order(self, batch, data): - result = self.execute_new_order_batch(batch, data) - if not result: - return {'error': "Batch failed to execute"} + try: + result = self.execute_new_order_batch(batch, data) + except Exception as error: + return {'error': six.text_type(error)} + else: + if not result: + return {'error': "Batch failed to execute"} next_url = None if isinstance(result, model.CustomerOrder): From 426ba0ea344aa0bb352648e0f9117eed0a02f117 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 11 Nov 2021 17:42:59 -0600 Subject: [PATCH 0002/1183] Fix "download results" support for Products it is not enabled by default, but still should work when it is --- tailbone/templates/products/index.mako | 1 + tailbone/views/products.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/tailbone/templates/products/index.mako b/tailbone/templates/products/index.mako index 06b1e7e0..3f65cd68 100644 --- a/tailbone/templates/products/index.mako +++ b/tailbone/templates/products/index.mako @@ -76,6 +76,7 @@ <%def name="grid_tools()"> + ${parent.grid_tools()} % if label_profiles and request.has_perm('products.print_labels'): diff --git a/tailbone/views/products.py b/tailbone/views/products.py index 351dd832..2f7bf02d 100644 --- a/tailbone/views/products.py +++ b/tailbone/views/products.py @@ -732,6 +732,16 @@ class ProductView(MasterView): return row + def download_results_normalize(self, product, fields, **kwargs): + data = super(ProductView, self).download_results_normalize( + product, fields, **kwargs) + + if 'upc' in data: + if isinstance(data['upc'], GPC): + data['upc'] = six.text_type(data['upc']) + + return data + def get_instance(self): key = self.request.matchdict['uuid'] product = Session.query(model.Product).get(key) From 901dacf038c81cff0bdc0a7214b119d7e69fa1e8 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 11 Nov 2021 18:38:44 -0600 Subject: [PATCH 0003/1183] Update changelog --- CHANGES.rst | 8 ++++++++ tailbone/_version.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 0499965e..32eea392 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,6 +2,14 @@ CHANGELOG ========= +0.8.173 (2021-11-11) +-------------------- + +* Improve error handling when executing a custorder batch. + +* Fix "download results" support for Products. + + 0.8.172 (2021-11-11) -------------------- diff --git a/tailbone/_version.py b/tailbone/_version.py index c36160ae..e081e8ca 100644 --- a/tailbone/_version.py +++ b/tailbone/_version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8; -*- -__version__ = '0.8.172' +__version__ = '0.8.173' From a7b91b5b31acd691ae7871e7af792a8dd499beda Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 13 Nov 2021 15:05:45 -0600 Subject: [PATCH 0004/1183] Expose the "sync users" flag for Roles --- tailbone/views/roles.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tailbone/views/roles.py b/tailbone/views/roles.py index 2ce48f0d..78389d5d 100644 --- a/tailbone/views/roles.py +++ b/tailbone/views/roles.py @@ -53,10 +53,15 @@ class RoleView(PrincipalMasterView): has_versions = True touchable = True + labels = { + 'sync_me': "Sync Attrs & Perms", + } + grid_columns = [ 'name', 'session_timeout', 'sync_me', + 'sync_users', 'node_type', 'notes', ] @@ -66,6 +71,7 @@ class RoleView(PrincipalMasterView): 'session_timeout', 'notes', 'sync_me', + 'sync_users', 'node_type', 'users', 'permissions', @@ -178,10 +184,11 @@ class RoleView(PrincipalMasterView): elif role is guest_role(self.Session()): include = False if not include: - f.remove('sync_me', 'node_type') + f.remove('sync_me', 'sync_users', 'node_type') else: if not self.has_perm('edit_node_sync'): f.set_readonly('sync_me') + f.set_readonly('sync_users') f.set_readonly('node_type') # notes From f385aab44a64865986055309fd65833ac8496af8 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 14 Nov 2021 13:27:13 -0600 Subject: [PATCH 0005/1183] Update changelog --- CHANGES.rst | 6 ++++++ tailbone/_version.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 32eea392..dab12a4f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,6 +2,12 @@ CHANGELOG ========= +0.8.174 (2021-11-14) +-------------------- + +* Expose the "sync users" flag for Roles. + + 0.8.173 (2021-11-11) -------------------- diff --git a/tailbone/_version.py b/tailbone/_version.py index e081e8ca..586e661e 100644 --- a/tailbone/_version.py +++ b/tailbone/_version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8; -*- -__version__ = '0.8.173' +__version__ = '0.8.174' From 0fa888efafba732f9de7450f795d3f072227d944 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 16 Nov 2021 17:23:56 -0600 Subject: [PATCH 0006/1183] Fix bug when product has empty suggested price --- tailbone/views/products.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tailbone/views/products.py b/tailbone/views/products.py index 2f7bf02d..a59df32f 100644 --- a/tailbone/views/products.py +++ b/tailbone/views/products.py @@ -558,8 +558,10 @@ class ProductView(MasterView): def render_suggested_price(self, product, column): text = self.render_price(product, column) + if not text: + return - if text and self.show_price_effective_dates(): + if self.show_price_effective_dates(): history = self.get_suggested_price_history(product) if history: date = localtime(self.rattail_config, history[0]['changed'], from_utc=True).date() From b8f1b7bd84fc57ccd30269391503834bff88f1c2 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 17 Nov 2021 14:57:10 -0600 Subject: [PATCH 0007/1183] Show ordered quantity when viewing costing batch row --- tailbone/views/purchasing/costing.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tailbone/views/purchasing/costing.py b/tailbone/views/purchasing/costing.py index 71b99cf2..d790fbc1 100644 --- a/tailbone/views/purchasing/costing.py +++ b/tailbone/views/purchasing/costing.py @@ -129,6 +129,8 @@ class CostingBatchView(PurchasingBatchView): 'size', 'department_name', 'case_quantity', + 'cases_ordered', + 'units_ordered', 'cases_shipped', 'units_shipped', 'cases_received', From e8828efae3b6a3bdf51fe13050535ca2e36ce1fb Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 17 Nov 2021 15:12:54 -0600 Subject: [PATCH 0008/1183] Update changelog --- CHANGES.rst | 8 ++++++++ tailbone/_version.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index dab12a4f..607d6443 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,6 +2,14 @@ CHANGELOG ========= +0.8.175 (2021-11-17) +-------------------- + +* Fix bug when product has empty suggested price. + +* Show ordered quantity when viewing costing batch row. + + 0.8.174 (2021-11-14) -------------------- diff --git a/tailbone/_version.py b/tailbone/_version.py index 586e661e..79b5759b 100644 --- a/tailbone/_version.py +++ b/tailbone/_version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8; -*- -__version__ = '0.8.174' +__version__ = '0.8.175' From 03dad826636c520168acfbbfcf034e50e4262aba Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 25 Nov 2021 16:50:13 -0600 Subject: [PATCH 0009/1183] Add basic support for receiving from PO with invoice --- tailbone/views/purchasing/receiving.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tailbone/views/purchasing/receiving.py b/tailbone/views/purchasing/receiving.py index ead0abed..ccc97d9a 100644 --- a/tailbone/views/purchasing/receiving.py +++ b/tailbone/views/purchasing/receiving.py @@ -457,7 +457,7 @@ class ReceivingBatchView(PurchasingBatchView): f.set_widget('store_uuid', dfwidget.HiddenWidget()) # purchase - if (self.creating and workflow == 'from_po' + if (self.creating and workflow in ('from_po', 'from_po_with_invoice') and self.purchase_order_fieldname == 'purchase'): if use_buefy: f.replace('purchase', 'purchase_uuid') @@ -507,6 +507,11 @@ class ReceivingBatchView(PurchasingBatchView): 'invoice_file', 'invoice_parser_key') + elif workflow == 'from_po_with_invoice': + f.remove('truck_dump_batch_uuid') + f.set_required('invoice_file') + f.set_required('invoice_parser_key') + elif workflow == 'truck_dump_children_first': f.remove('truck_dump_batch_uuid', 'invoice_file', @@ -561,6 +566,9 @@ class ReceivingBatchView(PurchasingBatchView): elif batch_type == 'from_po': # TODO: how to best handle this field? this doesn't seem flexible kwargs['purchase_key'] = batch.purchase_uuid + elif batch_type == 'from_po_with_invoice': + # TODO: how to best handle this field? this doesn't seem flexible + kwargs['purchase_key'] = batch.purchase_uuid elif batch_type == 'truck_dump_children_first': kwargs['truck_dump'] = True kwargs['truck_dump_children_first'] = True From b9037111a4a8370f2b7f7b472e53247b7c37899d Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 25 Nov 2021 18:56:28 -0600 Subject: [PATCH 0010/1183] Don't use multi-select for new report in buefy themes also let app handler fetch the report handler --- tailbone/views/reports.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tailbone/views/reports.py b/tailbone/views/reports.py index 6f6b1660..5d1ca5eb 100644 --- a/tailbone/views/reports.py +++ b/tailbone/views/reports.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2019 Lance Edgar +# Copyright © 2010-2021 Lance Edgar # # This file is part of Rattail. # @@ -36,7 +36,6 @@ import rattail from rattail.db import model, Session as RattailSession from rattail.files import resource_path from rattail.time import localtime -from rattail.reporting import get_report_handler from rattail.threads import Thread from rattail.util import simple_error, OrderedDict @@ -286,7 +285,8 @@ class GenerateReport(View): self.handler = self.get_handler() def get_handler(self): - return get_report_handler(self.rattail_config) + app = self.get_rattail_app() + return app.get_report_handler() def choose(self): """ @@ -313,7 +313,7 @@ class GenerateReport(View): values = [(r.type_key, r.name) for r in reports.values()] values.sort(key=lambda r: r[1]) if use_buefy: - form.set_widget('report_type', forms.widgets.CustomSelectWidget(values=values, size=10)) + form.set_widget('report_type', forms.widgets.CustomSelectWidget(values=values)) form.widgets['report_type'].set_template_values(input_handler='reportTypeChanged') else: form.set_widget('report_type', forms.widgets.PlainSelectWidget(values=values, size=10)) From ce354d5bc32b07a1316942a024491a8ca3d9bf77 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 25 Nov 2021 19:01:35 -0600 Subject: [PATCH 0011/1183] Update changelog --- CHANGES.rst | 8 ++++++++ tailbone/_version.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 607d6443..7287c0cd 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,6 +2,14 @@ CHANGELOG ========= +0.8.176 (2021-11-25) +-------------------- + +* Add basic support for receiving from PO with invoice. + +* Don't use multi-select for new report in buefy themes. + + 0.8.175 (2021-11-17) -------------------- diff --git a/tailbone/_version.py b/tailbone/_version.py index 79b5759b..939e3843 100644 --- a/tailbone/_version.py +++ b/tailbone/_version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8; -*- -__version__ = '0.8.175' +__version__ = '0.8.176' From c1f91906134c91f9c1ae439220be369f94e017f2 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 27 Nov 2021 19:08:15 -0600 Subject: [PATCH 0012/1183] Show current/sale pricing for products in new custorder page --- tailbone/templates/custorders/create.mako | 69 ++++++++++++++++++++--- 1 file changed, 61 insertions(+), 8 deletions(-) diff --git a/tailbone/templates/custorders/create.mako b/tailbone/templates/custorders/create.mako index cfbc4894..98dafda4 100644 --- a/tailbone/templates/custorders/create.mako +++ b/tailbone/templates/custorders/create.mako @@ -552,6 +552,10 @@ {{ productSize }} + + {{ productCaseQuantity }} + + 2021-01-01 --> - - {{ productCaseQuantity }} + + + {{ productSalePriceDisplay }} + + + + + + {{ productSaleEndsDisplay }} + @@ -622,6 +636,20 @@ + + + {{ productSalePriceDisplay }} + + + + + + {{ productSaleEndsDisplay }} + + + {{ productCaseQuantity }} @@ -629,7 +657,9 @@ {{ productCasePriceDisplay }} @@ -702,11 +732,6 @@ field="description" sortable> {{ props.row.description }} - - - {{ props.row.size }} @@ -716,6 +741,22 @@ {{ props.row.unit_price_display }} + + + {{ props.row.sale_price_display }} + + + + + + {{ props.row.sale_ends_display }} + + + @@ -933,6 +974,8 @@ productCaseQuantity: null, productUnitPriceDisplay: null, productCasePriceDisplay: null, + productSalePriceDisplay: null, + productSaleEndsDisplay: null, productURL: null, productImageURL: null, productQuantity: null, @@ -1486,6 +1529,8 @@ this.productCaseQuantity = null this.productUnitPriceDisplay = null this.productCasePriceDisplay = null + this.productSalePriceDisplay = null + this.productSaleEndsDisplay = null this.productImageURL = '${request.static_url('tailbone:static/img/product.png')}' this.productQuantity = 1 this.productUnitChoices = this.defaultUnitChoices @@ -1533,6 +1578,8 @@ this.productCaseQuantity = selected.case_quantity this.productUnitPriceDisplay = selected.unit_price_display this.productCasePriceDisplay = selected.case_price_display + this.productSalePriceDisplay = selected.sale_price_display + this.productSaleEndsDisplay = selected.sale_ends_display this.productImageURL = selected.image_url this.productURL = selected.url this.productQuantity = 1 @@ -1561,6 +1608,8 @@ this.productURL = row.product_url this.productUnitPriceDisplay = row.unit_price_display this.productCasePriceDisplay = row.case_price_display + this.productSalePriceDisplay = row.sale_price_display + this.productSaleEndsDisplay = row.sale_ends_display this.productImageURL = row.product_image_url this.productQuantity = row.order_quantity this.productUnitChoices = row.order_uom_choices @@ -1606,6 +1655,8 @@ this.productCaseQuantity = null this.productUnitPriceDisplay = null this.productCasePriceDisplay = null + this.productSalePriceDisplay = null + this.productSaleEndsDisplay = null this.productURL = null this.productImageURL = null this.productUnitChoices = this.defaultUnitChoices @@ -1651,6 +1702,8 @@ this.productCaseQuantity = response.data.case_quantity this.productUnitPriceDisplay = response.data.unit_price_display this.productCasePriceDisplay = response.data.case_price_display + this.productSalePriceDisplay = response.data.sale_price_display + this.productSaleEndsDisplay = response.data.sale_ends_display this.productURL = response.data.url this.productImageURL = response.data.image_url this.setProductUnitChoices(response.data.uom_choices) From dbd00291b33a393a3cc3aa711264240b93174fcd Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 27 Nov 2021 19:47:02 -0600 Subject: [PATCH 0013/1183] Add simple search filters for past items dialog in new custorder --- tailbone/templates/custorders/create.mako | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tailbone/templates/custorders/create.mako b/tailbone/templates/custorders/create.mako index 98dafda4..0071b61f 100644 --- a/tailbone/templates/custorders/create.mako +++ b/tailbone/templates/custorders/create.mako @@ -713,7 +713,8 @@ :selected.sync="pastItemsSelected" sortable paginated - per-page="6"> + per-page="5" + :debounce-search="1000">