def confirm(self): """Confirms the stock decrease """ assert self.can_confirm() assert self.branch store = self.store branch = self.branch for item in self.get_items(): if item.sellable.product: ProductHistory.add_decreased_item(store, branch, item) item.decrease(branch) old_status = self.status self.status = StockDecrease.STATUS_CONFIRMED # Save the operation_nature and branch in Invoice Table self.invoice.operation_nature = self.operation_nature self.invoice.branch = branch if self.group: self.group.confirm() StockOperationConfirmedEvent.emit(self, old_status)
def confirm(self): # Save the operation nature and branch in Invoice table. self.invoice.operation_nature = self.operation_nature self.invoice.branch = self.branch # Since there is no status change here and the event requires # the parameter, we use None old_status = None StockOperationConfirmedEvent.emit(self, old_status)
def confirm(self, login_user): """Receive the returned_sale_items from a pending |returned_sale| :param user: the |login_user| that received the pending returned sale """ assert self.status == self.STATUS_PENDING self._return_items() old_status = self.status self.status = self.STATUS_CONFIRMED self.confirm_responsible = login_user self.confirm_date = localnow() StockOperationConfirmedEvent.emit(self, old_status)
def send(self): """Sends a transfer order to the destination branch. """ assert self.can_send() for item in self.get_items(): item.send() # Save the operation nature and branch in Invoice table. self.invoice.operation_nature = self.operation_nature self.invoice.branch = self.branch old_status = self.status self.status = self.STATUS_SENT StockOperationConfirmedEvent.emit(self, old_status)