Changeset d60679a in tailbone


Ignore:
Timestamp:
03/27/19 20:11:32 (6 months ago)
Author:
Lance Edgar <ledgar@…>
Branches:
master
Children:
18ad664
Parents:
9ace36c
Message:

Don't allow deletion of some receiving data rows on mobile

specifically, rows on a truck dump parent, which originated from a child
batch (and therefore presumably, an invoice)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tailbone/views/purchasing/receiving.py

    r9ace36c rd60679a  
    280280        batch = row.batch
    281281
    282         # can always delete rows from truck dump parent
     282        # don't allow if master view has disabled that entirely
     283        if not self.rows_deletable:
     284            return False
     285
     286        # can never delete rows for complete/executed batches
     287        # TODO: not so sure about the 'complete' part though..?
     288        if batch.executed or batch.complete:
     289            return False
     290
     291        # can "always" delete rows from truck dump parent...
    283292        if batch.is_truck_dump_parent():
    284             return True
     293
     294            # ...but only on desktop!
     295            if not self.mobile:
     296                return True
     297
     298            # ...for mobile we only allow deletion of rows which did *not* come
     299            # from a child batch, i.e. can delete ad-hoc rows only
     300            # TODO: should have a better way to detect this; for now we rely on
     301            # the fact that only rows from an invoice or similar would have
     302            # order quantities
     303            if not (row.cases_ordered or row.units_ordered):
     304                return True
    285305
    286306        # can always delete rows from truck dump child
Note: See TracChangeset for help on using the changeset viewer.