def delete(invoiceId, stationaryItemId):
    result = InvoiceStationaryItem.delete(invoiceId=invoiceId,
                                          stationaryItemId=stationaryItemId)

    db.session.commit()

    return result
예제 #2
0
def create(invoiceId, body):
    request_body = RequestBody(body)
    result = InvoiceStationaryItem.create(
        invoiceId=invoiceId,
        stationaryItemId=request_body.get("stationaryItemId"))

    return Schema().dump(result).data, 201
예제 #3
0
def receive(body):
    request_body = RequestBody(body)
    result = InvoiceStationaryItem.update(
        invoiceId=request_body.get("invoiceId"),
        stationaryItemId=request_body.get("stationaryItemId"),
        received=True,
        receivedFrom=request_body.get("receivedFrom"),
        receivedOfficeId=request_body.get("receivedOfficeId"),
        scannedImages=connexion.request.files['scannedImages'])

    return Schema().dump(result).data, 201
예제 #4
0
def get_all(invoiceId=None,
            stationaryItemId=None,
            received=None,
            receivedFrom=None,
            receivedBy=None,
            receivedOffice=None):
    result = InvoiceStationaryItem.get_all(invoiceId=invoiceId,
                                           stationaryItemId=stationaryItemId,
                                           received=received,
                                           receivedFrom=receivedFrom,
                                           receivedBy=receivedBy,
                                           receivedOffice=receivedOffice)

    return Schema(many=True).dump(result).data
def get_by_id(invoiceId, stationaryItemId):
    result = InvoiceStationaryItem.get_by_id(invoiceId, stationaryItemId)

    return Schema().dump(result).data, 201
예제 #6
0
 def add_stationary_items(self, stationaryItemIds):
     for stationaryItemId in stationaryItemIds:
         InvoiceStationaryItem.create(invoiceId=self.invoiceId,
                                      stationaryItemId=stationaryItemId)
예제 #7
0
 def add_stationary_item(self, stationaryItemId):
     return InvoiceStationaryItem.create(invoiceId=self.invoiceId,
                                         stationaryItemId=stationaryItemId)
예제 #8
0
def delete(invoiceId, stationaryItemId):
    result = InvoiceStationaryItem.delete(invoiceId=invoiceId,
                                          stationaryItemId=stationaryItemId)

    return result