Honor case vs. unit restrictions for new custorder

and expose them in config view
This commit is contained in:
Lance Edgar 2022-03-29 18:19:14 -05:00
parent 4e25e87bfb
commit 1bb41b21af
3 changed files with 43 additions and 15 deletions

View file

@ -347,8 +347,15 @@ class CustomerOrderView(MasterView):
'product_key_label': self.rattail_config.product_key_title(),
'allow_unknown_product': self.batch_handler.allow_unknown_product(),
'department_options': self.get_department_options(),
'default_uom_choices': self.batch_handler.uom_choices_for_product(None),
'default_uom': None,
})
if self.batch_handler.allow_case_orders():
context['default_uom'] = self.enum.UNIT_OF_MEASURE_CASE
elif self.batch_handler.allow_unit_orders():
context['default_uom'] = self.enum.UNIT_OF_MEASURE_EACH
return self.render_to_response(template, context)
def get_department_options(self):
@ -944,11 +951,17 @@ class CustomerOrderView(MasterView):
# product handling
{'section': 'rattail.custorders',
'option': 'allow_unknown_product',
'option': 'allow_case_orders',
'type': bool},
{'section': 'rattail.custorders',
'option': 'allow_unit_orders',
'type': bool},
{'section': 'rattail.custorders',
'option': 'product_price_may_be_questionable',
'type': bool},
{'section': 'rattail.custorders',
'option': 'allow_unknown_product',
'type': bool},
]
@classmethod