Changeset 6927d74 in rattail for rattail/db/model/batch/purchase.py


Ignore:
Timestamp:
03/07/19 12:20:33 (13 months ago)
Author:
Lance Edgar <ledgar@…>
Branches:
master
Children:
7b4d418
Parents:
2cb67eb
git-author:
Lance Edgar <ledgar@…> (03/07/19 12:20:00)
git-committer:
Lance Edgar <ledgar@…> (03/07/19 12:20:33)
Message:

Fix logic for calculating "credit total"

also copy receiving date from truck dump parent to child, and fix output of
str(PurchaseCredit)

File:
1 edited

Legend:

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

    r2cb67eb r6927d74  
    33#
    44#  Rattail -- Retail Software Framework
    5 #  Copyright © 2010-2018 Lance Edgar
     5#  Copyright © 2010-2019 Lance Edgar
    66#
    77#  This file is part of Rattail.
     
    3636                              Purchase, PurchaseItem)
    3737from rattail.db.core import uuid_column, filename_column
    38 from rattail.util import pretty_quantity
    3938
    4039
     
    332331
    333332
    334 @six.python_2_unicode_compatible
    335333class PurchaseBatchCredit(PurchaseCreditBase, Base):
    336334    """
     
    359357            List of :class:`PurchaseBatchCredit` instances for the row.
    360358            """))
    361 
    362     def __str__(self):
    363         if self.cases_shorted is not None and self.units_shorted is not None:
    364             qty = "{} cases, {} units".format(
    365                 pretty_quantity(self.cases_shorted),
    366                 pretty_quantity(self.units_shorted))
    367         elif self.cases_shorted is not None:
    368             qty = "{} cases".format(pretty_quantity(self.cases_shorted))
    369         elif self.units_shorted is not None:
    370             qty = "{} units".format(pretty_quantity(self.units_shorted))
    371         else:
    372             qty = "??"
    373         qty += " {}".format(self.credit_type)
    374         if self.credit_type == 'expired' and self.expiration_date:
    375             qty += " ({})".format(self.expiration_date)
    376         if self.credit_type == 'mispick' and self.mispick_product:
    377             qty += " ({})".format(self.mispick_product)
    378         if self.invoice_total:
    379             return "{} = ${:0.2f}".format(qty, self.invoice_total)
    380         return qty
Note: See TracChangeset for help on using the changeset viewer.