Add config for supported vendor catalog parsers
also explicitly set "native value" for all configuration checkbox fields, since apparently it will send `'false'` by default...
This commit is contained in:
parent
2ce7c93aeb
commit
dc28b1337d
|
@ -10,12 +10,42 @@
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-checkbox name="rattail.batch.vendor_catalog.allow_future"
|
<b-checkbox name="rattail.batch.vendor_catalog.allow_future"
|
||||||
v-model="simpleSettings['rattail.batch.vendor_catalog.allow_future']"
|
v-model="simpleSettings['rattail.batch.vendor_catalog.allow_future']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Allow "future" cost changes
|
Allow "future" cost changes
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h3 class="block is-size-3">Catalog Parsers</h3>
|
||||||
|
<div class="block" style="padding-left: 2rem;">
|
||||||
|
|
||||||
|
<p class="block">
|
||||||
|
Only the selected parsers will be exposed to users.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
% for Parser in catalog_parsers:
|
||||||
|
<b-field message="${Parser.key}">
|
||||||
|
<b-checkbox name="catalog_parser_${Parser.key}"
|
||||||
|
v-model="catalogParsers['${Parser.key}']"
|
||||||
|
native-value="true"
|
||||||
|
@input="settingsNeedSaved = true">
|
||||||
|
${Parser.display}
|
||||||
|
</b-checkbox>
|
||||||
|
</b-field>
|
||||||
|
% endfor
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</%def>
|
||||||
|
|
||||||
|
<%def name="modify_this_page_vars()">
|
||||||
|
${parent.modify_this_page_vars()}
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
ThisPageData.catalogParsers = ${json.dumps(catalog_parsers_data)|n}
|
||||||
|
|
||||||
|
</script>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<b-field message="If not set, only a Person is required.">
|
<b-field message="If not set, only a Person is required.">
|
||||||
<b-checkbox name="rattail.custorders.new_order_requires_customer"
|
<b-checkbox name="rattail.custorders.new_order_requires_customer"
|
||||||
v-model="simpleSettings['rattail.custorders.new_order_requires_customer']"
|
v-model="simpleSettings['rattail.custorders.new_order_requires_customer']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Require a Customer account
|
Require a Customer account
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
@ -17,6 +18,7 @@
|
||||||
<b-field message="If not set, default contact info is always assumed.">
|
<b-field message="If not set, default contact info is always assumed.">
|
||||||
<b-checkbox name="rattail.custorders.new_orders.allow_contact_info_choice"
|
<b-checkbox name="rattail.custorders.new_orders.allow_contact_info_choice"
|
||||||
v-model="simpleSettings['rattail.custorders.new_orders.allow_contact_info_choice']"
|
v-model="simpleSettings['rattail.custorders.new_orders.allow_contact_info_choice']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Allow user to choose contact info
|
Allow user to choose contact info
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
@ -25,6 +27,7 @@
|
||||||
<b-field message="Only applies if user is allowed to choose contact info.">
|
<b-field message="Only applies if user is allowed to choose contact info.">
|
||||||
<b-checkbox name="rattail.custorders.new_orders.allow_contact_info_create"
|
<b-checkbox name="rattail.custorders.new_orders.allow_contact_info_create"
|
||||||
v-model="simpleSettings['rattail.custorders.new_orders.allow_contact_info_create']"
|
v-model="simpleSettings['rattail.custorders.new_orders.allow_contact_info_create']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Allow user to enter new contact info
|
Allow user to enter new contact info
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
@ -52,6 +55,7 @@
|
||||||
<b-field message="If set, user can enter details of an arbitrary new "pending" product.">
|
<b-field message="If set, user can enter details of an arbitrary new "pending" product.">
|
||||||
<b-checkbox name="rattail.custorders.allow_unknown_product"
|
<b-checkbox name="rattail.custorders.allow_unknown_product"
|
||||||
v-model="simpleSettings['rattail.custorders.allow_unknown_product']"
|
v-model="simpleSettings['rattail.custorders.allow_unknown_product']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Allow creating orders for "unknown" products
|
Allow creating orders for "unknown" products
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
@ -60,6 +64,7 @@
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-checkbox name="rattail.custorders.product_price_may_be_questionable"
|
<b-checkbox name="rattail.custorders.product_price_may_be_questionable"
|
||||||
v-model="simpleSettings['rattail.custorders.product_price_may_be_questionable']"
|
v-model="simpleSettings['rattail.custorders.product_price_may_be_questionable']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Allow prices to be flagged as "questionable"
|
Allow prices to be flagged as "questionable"
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
<b-field message="If set, GPC values like 002XXXXXYYYYY-Z will be converted to 002XXXXX00000-Z for lokkup">
|
<b-field message="If set, GPC values like 002XXXXXYYYYY-Z will be converted to 002XXXXX00000-Z for lokkup">
|
||||||
<b-checkbox name="rattail.products.convert_type2_for_gpc_lookup"
|
<b-checkbox name="rattail.products.convert_type2_for_gpc_lookup"
|
||||||
v-model="simpleSettings['rattail.products.convert_type2_for_gpc_lookup']"
|
v-model="simpleSettings['rattail.products.convert_type2_for_gpc_lookup']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Auto-convert Type 2 UPC for sake of lookup
|
Auto-convert Type 2 UPC for sake of lookup
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
@ -48,6 +49,7 @@
|
||||||
<b-field message="If a product has an image in the DB, that will still be preferred.">
|
<b-field message="If a product has an image in the DB, that will still be preferred.">
|
||||||
<b-checkbox name="tailbone.products.show_pod_image"
|
<b-checkbox name="tailbone.products.show_pod_image"
|
||||||
v-model="simpleSettings['tailbone.products.show_pod_image']"
|
v-model="simpleSettings['tailbone.products.show_pod_image']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Show "POD" Images as fallback
|
Show "POD" Images as fallback
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-checkbox name="rattail.batch.purchase.allow_receiving_from_scratch"
|
<b-checkbox name="rattail.batch.purchase.allow_receiving_from_scratch"
|
||||||
v-model="simpleSettings['rattail.batch.purchase.allow_receiving_from_scratch']"
|
v-model="simpleSettings['rattail.batch.purchase.allow_receiving_from_scratch']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
From Scratch
|
From Scratch
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
@ -17,6 +18,7 @@
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-checkbox name="rattail.batch.purchase.allow_receiving_from_invoice"
|
<b-checkbox name="rattail.batch.purchase.allow_receiving_from_invoice"
|
||||||
v-model="simpleSettings['rattail.batch.purchase.allow_receiving_from_invoice']"
|
v-model="simpleSettings['rattail.batch.purchase.allow_receiving_from_invoice']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
From Invoice
|
From Invoice
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
@ -25,6 +27,7 @@
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-checkbox name="rattail.batch.purchase.allow_receiving_from_purchase_order"
|
<b-checkbox name="rattail.batch.purchase.allow_receiving_from_purchase_order"
|
||||||
v-model="simpleSettings['rattail.batch.purchase.allow_receiving_from_purchase_order']"
|
v-model="simpleSettings['rattail.batch.purchase.allow_receiving_from_purchase_order']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
From Purchase Order
|
From Purchase Order
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
@ -33,6 +36,7 @@
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-checkbox name="rattail.batch.purchase.allow_receiving_from_purchase_order_with_invoice"
|
<b-checkbox name="rattail.batch.purchase.allow_receiving_from_purchase_order_with_invoice"
|
||||||
v-model="simpleSettings['rattail.batch.purchase.allow_receiving_from_purchase_order_with_invoice']"
|
v-model="simpleSettings['rattail.batch.purchase.allow_receiving_from_purchase_order_with_invoice']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
From Purchase Order, with Invoice
|
From Purchase Order, with Invoice
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
@ -41,6 +45,7 @@
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-checkbox name="rattail.batch.purchase.allow_truck_dump_receiving"
|
<b-checkbox name="rattail.batch.purchase.allow_truck_dump_receiving"
|
||||||
v-model="simpleSettings['rattail.batch.purchase.allow_truck_dump_receiving']"
|
v-model="simpleSettings['rattail.batch.purchase.allow_truck_dump_receiving']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Truck Dump
|
Truck Dump
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
@ -54,6 +59,7 @@
|
||||||
<b-field message="NB. Allow Cases setting also affects Ordering behavior.">
|
<b-field message="NB. Allow Cases setting also affects Ordering behavior.">
|
||||||
<b-checkbox name="rattail.batch.purchase.allow_cases"
|
<b-checkbox name="rattail.batch.purchase.allow_cases"
|
||||||
v-model="simpleSettings['rattail.batch.purchase.allow_cases']"
|
v-model="simpleSettings['rattail.batch.purchase.allow_cases']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Allow Cases
|
Allow Cases
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
@ -62,6 +68,7 @@
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-checkbox name="rattail.batch.purchase.allow_expired_credits"
|
<b-checkbox name="rattail.batch.purchase.allow_expired_credits"
|
||||||
v-model="simpleSettings['rattail.batch.purchase.allow_expired_credits']"
|
v-model="simpleSettings['rattail.batch.purchase.allow_expired_credits']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Allow "Expired" Credits
|
Allow "Expired" Credits
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
@ -75,6 +82,7 @@
|
||||||
<b-field message="TODO: this may also affect Ordering (?)">
|
<b-field message="TODO: this may also affect Ordering (?)">
|
||||||
<b-checkbox name="rattail.batch.purchase.mobile_images"
|
<b-checkbox name="rattail.batch.purchase.mobile_images"
|
||||||
v-model="simpleSettings['rattail.batch.purchase.mobile_images']"
|
v-model="simpleSettings['rattail.batch.purchase.mobile_images']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Show Product Images
|
Show Product Images
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
@ -83,6 +91,7 @@
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-checkbox name="rattail.batch.purchase.mobile_quick_receive"
|
<b-checkbox name="rattail.batch.purchase.mobile_quick_receive"
|
||||||
v-model="simpleSettings['rattail.batch.purchase.mobile_quick_receive']"
|
v-model="simpleSettings['rattail.batch.purchase.mobile_quick_receive']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Allow "Quick Receive"
|
Allow "Quick Receive"
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
@ -91,6 +100,7 @@
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-checkbox name="rattail.batch.purchase.mobile_quick_receive_all"
|
<b-checkbox name="rattail.batch.purchase.mobile_quick_receive_all"
|
||||||
v-model="simpleSettings['rattail.batch.purchase.mobile_quick_receive_all']"
|
v-model="simpleSettings['rattail.batch.purchase.mobile_quick_receive_all']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Allow "Quick Receive All"
|
Allow "Quick Receive All"
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<b-field message="If not set, reports are shown as simple list of hyperlinks.">
|
<b-field message="If not set, reports are shown as simple list of hyperlinks.">
|
||||||
<b-checkbox name="tailbone.reporting.choosing_uses_form"
|
<b-checkbox name="tailbone.reporting.choosing_uses_form"
|
||||||
v-model="simpleSettings['tailbone.reporting.choosing_uses_form']"
|
v-model="simpleSettings['tailbone.reporting.choosing_uses_form']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Show report chooser as form, with dropdown
|
Show report chooser as form, with dropdown
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-checkbox name="rattail.mail.record_attempts"
|
<b-checkbox name="rattail.mail.record_attempts"
|
||||||
v-model="simpleSettings['rattail.mail.record_attempts']"
|
v-model="simpleSettings['rattail.mail.record_attempts']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Make record of all attempts to send email
|
Make record of all attempts to send email
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
|
1
tailbone/templates/vendors/configure.mako
vendored
1
tailbone/templates/vendors/configure.mako
vendored
|
@ -9,6 +9,7 @@
|
||||||
<b-field message="If not set, vendor chooser is an autocomplete field.">
|
<b-field message="If not set, vendor chooser is an autocomplete field.">
|
||||||
<b-checkbox name="rattail.vendors.choice_uses_dropdown"
|
<b-checkbox name="rattail.vendors.choice_uses_dropdown"
|
||||||
v-model="simpleSettings['rattail.vendors.choice_uses_dropdown']"
|
v-model="simpleSettings['rattail.vendors.choice_uses_dropdown']"
|
||||||
|
native-value="true"
|
||||||
@input="settingsNeedSaved = true">
|
@input="settingsNeedSaved = true">
|
||||||
Show vendor chooser as dropdown (select) element
|
Show vendor chooser as dropdown (select) element
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
|
|
|
@ -39,6 +39,7 @@ from webhelpers2.html import tags
|
||||||
from tailbone import forms
|
from tailbone import forms
|
||||||
from tailbone.views.batch import FileBatchMasterView
|
from tailbone.views.batch import FileBatchMasterView
|
||||||
from tailbone.diffs import Diff
|
from tailbone.diffs import Diff
|
||||||
|
from tailbone.db import Session
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -346,6 +347,47 @@ class VendorCatalogView(FileBatchMasterView):
|
||||||
])
|
])
|
||||||
return settings
|
return settings
|
||||||
|
|
||||||
|
def configure_get_context(self):
|
||||||
|
context = super(VendorCatalogView, self).configure_get_context()
|
||||||
|
app = self.get_rattail_app()
|
||||||
|
vendor_handler = app.get_vendor_handler()
|
||||||
|
|
||||||
|
Parsers = vendor_handler.get_all_catalog_parsers()
|
||||||
|
Supported = vendor_handler.get_supported_catalog_parsers()
|
||||||
|
context['catalog_parsers'] = Parsers
|
||||||
|
context['catalog_parsers_data'] = dict([(Parser.key, Parser in Supported)
|
||||||
|
for Parser in Parsers])
|
||||||
|
|
||||||
|
return context
|
||||||
|
|
||||||
|
def configure_gather_settings(self, data):
|
||||||
|
settings = super(VendorCatalogView, self).configure_gather_settings(data)
|
||||||
|
app = self.get_rattail_app()
|
||||||
|
vendor_handler = app.get_vendor_handler()
|
||||||
|
|
||||||
|
supported = []
|
||||||
|
for Parser in vendor_handler.get_all_catalog_parsers():
|
||||||
|
name = 'catalog_parser_{}'.format(Parser.key)
|
||||||
|
if data.get(name) == 'true':
|
||||||
|
supported.append(Parser.key)
|
||||||
|
settings.append({'name': 'rattail.vendors.supported_catalog_parsers',
|
||||||
|
'value': ', '.join(supported)})
|
||||||
|
|
||||||
|
return settings
|
||||||
|
|
||||||
|
def configure_remove_settings(self):
|
||||||
|
super(VendorCatalogView, self).configure_remove_settings()
|
||||||
|
model = self.model
|
||||||
|
names = [
|
||||||
|
'rattail.vendors.supported_catalog_parsers',
|
||||||
|
'tailbone.batch.vendorcatalog.supported_parsers', # deprecated
|
||||||
|
]
|
||||||
|
|
||||||
|
Session().query(model.Setting)\
|
||||||
|
.filter(model.Setting.name.in_(names))\
|
||||||
|
.delete(synchronize_session=False)
|
||||||
|
|
||||||
|
|
||||||
# TODO: deprecate / remove this
|
# TODO: deprecate / remove this
|
||||||
VendorCatalogsView = VendorCatalogView
|
VendorCatalogsView = VendorCatalogView
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue