def finish(self):
        missing = get_missing_items(self.model, self.store)
        if missing:
            run_dialog(MissingItemsDialog, self, self.model, missing)
            return False

        order = TransferOrder(
            open_date=self.model.open_date,
            receival_date=self.model.receival_date,
            source_branch=self.model.source_branch,
            destination_branch=self.model.destination_branch,
            source_responsible=self.model.source_responsible,
            destination_responsible=self.model.destination_responsible,
            store=self.store)
        for item in self.model.get_items():
            transfer_item = order.add_sellable(item.sellable,
                                               quantity=item.quantity,
                                               batch=item.batch)
            transfer_item.send()

        # XXX Waiting for transfer order receiving wizard implementation
        order.receive()

        self.retval = self.model
        self.close()
        StockTransferWizardFinishEvent.emit(order)
        self._receipt_dialog(order)
Beispiel #2
0
    def finish(self):
        missing = get_missing_items(self.model, self.store)
        if missing:
            run_dialog(MissingItemsDialog, self, self.model, missing)
            return False

        order = TransferOrder(
            open_date=self.model.open_date,
            receival_date=self.model.receival_date,
            source_branch=self.model.source_branch,
            destination_branch=self.model.destination_branch,
            source_responsible=self.model.source_responsible,
            destination_responsible=self.model.destination_responsible,
            store=self.store)
        for item in self.model.get_items():
            transfer_item = order.add_sellable(item.sellable, batch=None,
                                               quantity=item.quantity)
            transfer_item.send()

        # XXX Waiting for transfer order receiving wizard implementation
        order.receive()

        self.retval = self.model
        self.close()
        StockTransferWizardFinishEvent.emit(order)
        self._receipt_dialog(order)
Beispiel #3
0
    def process_one(self, data, fields, store):
        person = store.find(Person, name=data.source_branch_name).one()
        if person is None or person.branch is None:
            raise ValueError("%s is not a valid branch" %
                             (data.source_branch_name, ))
        source_branch = person.branch

        person = store.find(Person, name=data.source_employee_name).one()
        if person is None or person.employee is None:
            raise ValueError("%s is not a valid employee" %
                             (data.source_employee_name, ))
        source_employee = person.employee

        person = store.find(Person, name=data.dest_branch_name).one()
        if person is None or person.branch is None:
            raise ValueError("%s is not a valid branch" %
                             (data.dest_branch_name, ))
        dest_branch = person.branch

        person = store.find(Person, name=data.dest_employee_name).one()
        if person is None or person.employee is None:
            raise ValueError("%s is not a valid employee" %
                             (data.dest_employee_name, ))
        dest_employee = person.employee

        station = store.find(BranchStation).any()
        user = store.find(LoginUser).any()
        sellables = self.parse_multi(Sellable, data.sellable_list, store)

        order = TransferOrder(store=store,
                              open_date=self.parse_date(data.open_date),
                              receival_date=None,
                              branch=source_branch,
                              station=station,
                              destination_branch=dest_branch,
                              source_responsible=source_employee,
                              destination_responsible=None)

        for sellable in sellables:
            if not sellable.product:
                continue
            order.add_sellable(sellable,
                               batch=None,
                               quantity=int(data.quantity))

        order.send(user)
        order.receive(user, dest_employee)
    def process_one(self, data, fields, store):
        person = store.find(Person, name=data.source_branch_name).one()
        if person is None or person.branch is None:
            raise ValueError("%s is not a valid branch" % (
                data.source_branch_name, ))
        source_branch = person.branch

        person = store.find(Person, name=data.source_employee_name).one()
        if person is None or person.employee is None:
            raise ValueError("%s is not a valid employee" % (
                data.source_employee_name, ))
        source_employee = person.employee

        person = store.find(Person, name=data.dest_branch_name).one()
        if person is None or person.branch is None:
            raise ValueError("%s is not a valid branch" % (
                data.dest_branch_name, ))
        dest_branch = person.branch

        person = store.find(Person, name=data.dest_employee_name).one()
        if person is None or person.employee is None:
            raise ValueError("%s is not a valid employee" % (
                data.dest_employee_name, ))
        dest_employee = person.employee

        sellables = self.parse_multi(Sellable, data.sellable_list, store)

        order = TransferOrder(store=store,
                              open_date=self.parse_date(data.open_date),
                              receival_date=None,
                              source_branch=source_branch,
                              destination_branch=dest_branch,
                              source_responsible=source_employee,
                              destination_responsible=None)

        for sellable in sellables:
            if not sellable.product:
                continue
            order.add_sellable(sellable, batch=None,
                               quantity=int(data.quantity))

        order.send()
        order.receive(dest_employee)