Changeset c88d060 in tailbone


Ignore:
Timestamp:
07/09/18 15:50:28 (2 years ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
44663fe
Parents:
469f9cf
Message:

Force user to count "units" and not "packs" for inventory batch

at least until we come up with something smarter...

Location:
tailbone
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tailbone/templates/batch/inventory/desktop_form.mako

    r469f9cf rc88d060  
    114114                        $('#size').val(data.product.size);
    115115                        $('#case_quantity').val(data.product.case_quantity);
     116
     117                        if (data.force_unit_item) {
     118                            $('#product-info .warning.force-unit').show();
     119                        }
    116120
    117121                        if (data.already_present_in_batch) {
     
    249253        <div class="warning notfound">please confirm UPC and provide more details</div>
    250254        <div class="warning present">product already exists in batch, please confirm count</div>
     255        <div class="warning force-unit">pack item scanned, but must count units instead</div>
    251256      </div>
    252257    </div>
  • tailbone/views/inventory.py

    r469f9cf rc88d060  
    381381            product = self.find_product(entry)
    382382
     383        force_unit_item = True # TODO: make configurable?
     384        unit_forced = False
     385        if force_unit_item and product.is_pack_item():
     386            product = product.unit
     387            unit_forced = True
     388
    383389        data = self.product_info(product)
    384390        if type2:
     
    390396                    data['units'] = float((price / product.regular_price.price).quantize(decimal.Decimal('0.01')))
    391397
    392         result = {'product': data, 'upc_raw': entry, 'upc': None}
     398        result = {'product': data, 'upc_raw': entry, 'upc': None, 'force_unit_item': unit_forced}
    393399        if not data:
    394400            upc = re.sub(r'\D', '', entry.strip())
     
    513519            product = self.find_product(entry)
    514520        if product:
     521
     522            force_unit_item = True # TODO: make configurable?
     523            if force_unit_item and product.is_pack_item():
     524                product = product.unit
     525                self.request.session.flash("You scanned a pack item, but must count the units instead.", 'error')
    515526
    516527            aggregate = self.should_aggregate_products(batch)
Note: See TracChangeset for help on using the changeset viewer.