From c62e0809146bf12ee86096004f59d279316efaad 2021-10-17 17:07:18 From: Lance Edgar Date: 2021-10-17 17:07:18 Subject: [PATCH] Add `add_product()` method for custorder batch handler let it be repsonsible for adding a new item to the order --- diff --git a/rattail/batch/custorder.py b/rattail/batch/custorder.py index 12d486bf12d19c2a66e9e71ed98ca8b209fa0543..fbad967fd2ece6516069f70994fe846553690af6 100644 --- a/rattail/batch/custorder.py +++ b/rattail/batch/custorder.py @@ -397,6 +397,20 @@ class CustomerOrderBatchHandler(BatchHandler): return that reason as a string; otherwise ``None``. """ + def add_product(self, batch, product, order_quantity, order_uom, + **kwargs): + """ + Add a new row to the batch, for the given product and order + quantity. + """ + row = self.make_row() + row.item_entry = product.uuid + row.product = product + row.order_quantity = order_quantity + row.order_uom = order_uom + self.add_row(batch, row) + return row + def refresh_row(self, row): if not row.product: if row.item_entry: