def post_init(self): # A receiving model was created. We should remove it (and its items), # since after this step we can either receive the products now or # later, on the stock application. receiving_model = self.wizard.receiving_model if receiving_model: for item in receiving_model.get_items(): ReceivingOrderItem.delete(item.id, self.store) ReceivingOrder.delete(receiving_model.id, store=self.store) self.wizard.receiving_model = None self.salesperson_name.grab_focus() self._set_receival_date_suggestion() self.register_validate_function(self.wizard.refresh_next) self.force_validation()
def finish(self): assert self.model assert self.model.branch # Remove the items that will not be received now. for item in self.model.get_items(): if item.quantity > 0: continue ReceivingOrderItem.delete(item.id, store=self.store) if yesno(_(u'Do you want to print the labels for the received products?'), gtk.RESPONSE_YES, _(u'Print labels'), _(u"Don't print")): label_data = run_dialog(SkipLabelsEditor, self, self.store) if label_data: print_labels(label_data, self.store, self.model.purchase) ReceivingOrderWizardFinishEvent.emit(self.model) self.retval = self.model self.model.confirm() self.close()
def finish(self): assert self.model assert self.model.branch # Remove the items that will not be received now. for item in self.model.get_items(): if item.quantity > 0: continue ReceivingOrderItem.delete(item.id, store=self.store) if yesno( _(u'Do you want to print the labels for the received products?' ), gtk.RESPONSE_YES, _(u'Print labels'), _(u"Don't print")): label_data = run_dialog(SkipLabelsEditor, self, self.store) if label_data: print_labels(label_data, self.store, self.model.purchase) ReceivingOrderWizardFinishEvent.emit(self.model) self.retval = self.model self.model.confirm() self.close()