Changeset b5688a0 in rattail


Ignore:
Timestamp:
07/08/2022 02:02:17 PM (7 months ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
7c91535
Parents:
01b538c
git-author:
Lance Edgar <lance@…> (07/08/2022 02:02:07 PM)
git-committer:
Lance Edgar <lance@…> (07/08/2022 02:02:17 PM)
Message:

Add is_active_for_store() method to products handler

with some basic logic, which assumes a volatile cache table has
accurate data...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rattail/products.py

    r01b538c rb5688a0  
    595595        return get_product_by_code(session, entry)
    596596
     597    def is_active_for_store(self, product, store, **kwargs):
     598        """
     599        Return boolean indicating whether the given product is
     600        considered "active" at the given store.
     601        """
     602        info = product.store_infos.get(store.uuid)
     603        if info and info.recently_active:
     604            return True
     605        return False
     606
    597607    def normalize_product(self, product, fields=None, **kwargs):
    598608        """
Note: See TracChangeset for help on using the changeset viewer.