Hopefully fix "single store" behavior when make a new ordering batch

this does seem to fix for this use case, but previous commit for this code
implied that it was fixing something for the receiving use case...
This commit is contained in:
Lance Edgar 2019-08-23 22:05:09 -05:00
parent 937c2920ac
commit 5cfe69d24b

View file

@ -254,15 +254,12 @@ class PurchasingBatchView(BatchMasterView):
f.replace('store', 'store_uuid') f.replace('store', 'store_uuid')
if single_store: if single_store:
store = self.rattail_config.get_store(self.Session()) store = self.rattail_config.get_store(self.Session())
f.set_widget('store_uuid', forms.widgets.ReadonlyWidget()) f.set_widget('store_uuid', dfwidget.HiddenWidget())
f.set_default('store_uuid', store.uuid) f.set_default('store_uuid', store.uuid)
f.set_hidden('store_uuid') f.set_hidden('store_uuid')
else: else:
f.set_widget('store_uuid', dfwidget.SelectWidget(values=self.get_store_values())) f.set_widget('store_uuid', dfwidget.SelectWidget(values=self.get_store_values()))
f.set_label('store_uuid', "Store") f.set_label('store_uuid', "Store")
else:
if single_store:
f.remove_field('store')
else: else:
f.set_readonly('store') f.set_readonly('store')
f.set_renderer('store', self.render_store) f.set_renderer('store', self.render_store)