Changeset 0dc344b in tailbone


Ignore:
Timestamp:
07/24/2022 03:05:51 PM (6 months ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
36d4f0a
Parents:
25f39f4
Message:

Assume default vendor for new receiving batch

i.e. if there is only one vendor

File:
1 edited

Legend:

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

    r25f39f4 r0dc344b  
    333333            if use_dropdown:
    334334                vendors = self.Session.query(model.Vendor)\
    335                                       .order_by(model.Vendor.id)
     335                                      .order_by(model.Vendor.id)\
     336                                      .all()
    336337                vendor_values = [(vendor.uuid, "({}) {}".format(vendor.id, vendor.name))
    337338                                 for vendor in vendors]
     
    340341                else:
    341342                    form.set_widget('vendor', forms.widgets.JQuerySelectWidget(values=vendor_values))
     343                if len(vendors) == 1:
     344                    form.set_default('vendor', vendors[0].uuid)
    342345            else:
    343346                vendor_display = ""
Note: See TracChangeset for help on using the changeset viewer.