Changeset 3929ec9 in rattail for rattail/db/model/batch/purchase.py


Ignore:
Timestamp:
07/17/18 20:37:16 (23 months ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
5d649f3
Parents:
1edc948
Message:

Add PurchaseBatch.order_quantities_known and is_truck_dump_parent() etc.

the latter being just for improved code readability. if order quantities are
known then some UI gets turned on to expose that info, otherwise not

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rattail/db/model/batch/purchase.py

    r1edc948 r3929ec9  
    9393    """)
    9494
     95    order_quantities_known = sa.Column(sa.Boolean(), nullable=True, doc="""
     96    Flag indicating whether the order quantities were known at time of batch
     97    creation / population.  Really this is only used for batches of 'receiving'
     98    mode, to present a slightly different UI if order quantities were (not) known.
     99    """)
     100
    95101    truck_dump = sa.Column(sa.Boolean(), nullable=True, default=False, doc="""
    96102    Flag indicating whether a "receiving" batch is of the "truck dump"
     
    115121            assumed to be a truck dump.
    116122            """))
     123
     124    def is_truck_dump_parent(self):
     125        """
     126        Returns boolean indicating whether or not the batch is a "truck dump"
     127        parent.
     128        """
     129        if self.truck_dump:
     130            return True
     131        return False
     132
     133    def is_truck_dump_child(self):
     134        """
     135        Returns boolean indicating whether or not the batch is a "truck dump"
     136        child.
     137        """
     138        if self.truck_dump_batch:
     139            return True
     140        return False
     141
     142    def is_truck_dump_related(self):
     143        """
     144        Returns boolean indicating whether or not the batch is associated with
     145        a "truck dump" in any way, i.e. is a parent or child of such.
     146        """
     147        if self.is_truck_dump_parent():
     148            return True
     149        if self.is_truck_dump_child():
     150            return True
     151        return False
    117152
    118153
Note: See TracChangeset for help on using the changeset viewer.