Assign purchase to new receiving batch via uuid instead of object ref

the latter was apparently causing session flush and would create the "dummy"
batch in addition to the "real" one...
This commit is contained in:
Lance Edgar 2018-07-25 12:46:51 -05:00
parent 634a93061b
commit d145ce5f6d

View file

@ -642,11 +642,11 @@ class ReceivingBatchView(PurchasingBatchView):
""" """
purchase = self.get_purchase(po_form.validated[self.purchase_order_fieldname]) purchase = self.get_purchase(po_form.validated[self.purchase_order_fieldname])
if isinstance(purchase, model.Purchase): if isinstance(purchase, model.Purchase):
batch.purchase = purchase batch.purchase_uuid = purchase.uuid
department = self.department_for_purchase(purchase) department = self.department_for_purchase(purchase)
if department: if department:
batch.department = department batch.department_uuid = department.uuid
def configure_mobile_form(self, f): def configure_mobile_form(self, f):
super(ReceivingBatchView, self).configure_mobile_form(f) super(ReceivingBatchView, self).configure_mobile_form(f)