erpnext-queue-client 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +6 -16
- package/dist/client.js +51 -51
- package/dist/erpnext/decryptFromErpNext.server.d.ts +1 -1
- package/dist/erpnext/decryptFromErpNext.server.test.js +3 -3
- package/dist/erpnext/doctypeResourceRequest.d.ts +38 -0
- package/dist/erpnext/doctypeResourceRequest.js +59 -0
- package/dist/erpnext/doctypeSubmittableResourceRequest.d.ts +8 -0
- package/dist/erpnext/doctypeSubmittableResourceRequest.js +39 -0
- package/dist/erpnext/doctypes/address.d.ts +263 -0
- package/dist/erpnext/doctypes/address.js +46 -0
- package/dist/erpnext/doctypes/contact.d.ts +383 -0
- package/dist/erpnext/doctypes/contact.js +46 -0
- package/dist/erpnext/doctypes/deliveryNote.d.ts +985 -0
- package/dist/erpnext/doctypes/deliveryNote.js +38 -0
- package/dist/erpnext/doctypes/item.d.ts +572 -0
- package/dist/erpnext/doctypes/item.js +95 -0
- package/dist/erpnext/doctypes/purchaseReceipt.d.ts +743 -0
- package/dist/erpnext/doctypes/purchaseReceipt.js +50 -0
- package/dist/erpnext/doctypes/shipment.d.ts +752 -0
- package/dist/erpnext/doctypes/shipment.js +51 -0
- package/dist/erpnext/erpnextRequestWrapper.js +15 -13
- package/dist/erpnext/fileRequests.d.ts +10 -0
- package/dist/erpnext/fileRequests.js +42 -0
- package/dist/erpnext/methodRequest.d.ts +15 -0
- package/dist/erpnext/methodRequest.js +32 -0
- package/dist/erpnext/model/Address.d.ts +200 -198
- package/dist/erpnext/model/Address.js +3 -2
- package/dist/erpnext/model/Contact.d.ts +343 -344
- package/dist/erpnext/model/Contact.js +2 -2
- package/dist/erpnext/model/Country.d.ts +83 -31
- package/dist/erpnext/model/Country.js +2 -6
- package/dist/erpnext/model/Customer.d.ts +64 -65
- package/dist/erpnext/model/Customer.js +2 -2
- package/dist/erpnext/model/DeliveryNote.d.ts +1048 -1048
- package/dist/erpnext/model/DispatchRun.d.ts +399 -399
- package/dist/erpnext/model/DispatcherPreset.d.ts +94 -94
- package/dist/erpnext/model/ERPNextQueue.d.ts +8 -7
- package/dist/erpnext/model/ERPNextRequest.d.ts +55 -21
- package/dist/erpnext/model/ERPNextResponse.d.ts +4 -4
- package/dist/erpnext/model/File.d.ts +88 -88
- package/dist/erpnext/model/Fulfiller.d.ts +97 -97
- package/dist/erpnext/model/FulfillerSettings.d.ts +66 -66
- package/dist/erpnext/model/FulfillmentStation.d.ts +2 -2
- package/dist/erpnext/model/Item.d.ts +821 -821
- package/dist/erpnext/model/Item.js +2 -2
- package/dist/erpnext/model/PaymentEntry.d.ts +197 -0
- package/dist/erpnext/model/PaymentEntry.js +63 -0
- package/dist/erpnext/model/ProjectedQuantityReport.d.ts +178 -178
- package/dist/erpnext/model/PurchaseOrder.d.ts +534 -534
- package/dist/erpnext/model/Receipt.d.ts +456 -456
- package/dist/erpnext/model/Receipt.js +2 -2
- package/dist/erpnext/model/ReceiptDraft.d.ts +394 -394
- package/dist/erpnext/model/Shipment.d.ts +708 -708
- package/dist/erpnext/model/ShippingProvider.d.ts +198 -198
- package/dist/erpnext/model/StockEntry.d.ts +248 -0
- package/dist/erpnext/model/StockEntry.js +76 -0
- package/dist/erpnext/model/StockReconciliation.d.ts +187 -0
- package/dist/erpnext/model/StockReconciliation.js +44 -0
- package/dist/erpnext/model/Supplier.d.ts +105 -0
- package/dist/erpnext/model/Supplier.js +39 -0
- package/dist/erpnext/model/Waitlist.d.ts +32 -0
- package/dist/erpnext/model/Waitlist.js +19 -0
- package/dist/erpnext/model/WarehouseCategory.d.ts +6 -6
- package/dist/erpnext/resourceRequest.d.ts +45 -0
- package/dist/erpnext/resourceRequest.js +135 -0
- package/dist/index.d.ts +52 -1
- package/dist/index.js +56 -12
- package/dist/utils/fernet.server.d.ts +11 -11
- package/dist/utils/fernet.server.js +0 -1
- package/dist/utils/request.js +2 -2
- package/dist/utils/zodUtils.d.ts +2 -1
- package/dist/utils/zodUtils.js +14 -1
- package/package.json +4 -1
- package/dist/erpnext/erpnextRequests.d.ts +0 -1786
- package/dist/erpnext/erpnextRequests.js +0 -339
|
@@ -1,339 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.erpnextRequests = erpnextRequests;
|
|
13
|
-
const lodash_1 = require("lodash");
|
|
14
|
-
const Address_1 = require("./model/Address");
|
|
15
|
-
const Item_1 = require("./model/Item");
|
|
16
|
-
const ProjectedQuantityReport_1 = require("./model/ProjectedQuantityReport");
|
|
17
|
-
const Shipment_1 = require("./model/Shipment");
|
|
18
|
-
const utils_1 = require("../utils/utils");
|
|
19
|
-
const Address_2 = require("./model/Address");
|
|
20
|
-
const Contact_1 = require("./model/Contact");
|
|
21
|
-
const Country_1 = require("./model/Country");
|
|
22
|
-
const Customer_1 = require("./model/Customer");
|
|
23
|
-
const DeliveryNote_1 = require("./model/DeliveryNote");
|
|
24
|
-
const File_1 = require("./model/File");
|
|
25
|
-
const PurchaseOrder_1 = require("./model/PurchaseOrder");
|
|
26
|
-
const Receipt_1 = require("./model/Receipt");
|
|
27
|
-
const ReceiptDraft_1 = require("./model/ReceiptDraft");
|
|
28
|
-
const StockDict_1 = require("./model/StockDict");
|
|
29
|
-
const ShippingProvider_1 = require("./model/ShippingProvider");
|
|
30
|
-
function erpnextRequests(client) {
|
|
31
|
-
/* --------------------------------- Country -------------------------------- */
|
|
32
|
-
return {
|
|
33
|
-
getCountryList: () => __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
const result = yield client.executeERPNextRequest("getCountryList", {
|
|
35
|
-
requestMethod: "GET",
|
|
36
|
-
responseValidationModel: (0, Country_1.CountryList)(["name", "code"]),
|
|
37
|
-
resourceName: "Country",
|
|
38
|
-
params: `?fields=["name", "code"]`,
|
|
39
|
-
}, "erpnext");
|
|
40
|
-
return result;
|
|
41
|
-
}),
|
|
42
|
-
/* --------------------------------- Address --------------------------------- */
|
|
43
|
-
createShippingAddress: (address_1, ...args_1) => __awaiter(this, [address_1, ...args_1], void 0, function* (address, customerName = "") {
|
|
44
|
-
const result = yield client.executeERPNextRequest("createShippingAddress", {
|
|
45
|
-
requestMethod: "POST",
|
|
46
|
-
responseValidationModel: Address_2.Address,
|
|
47
|
-
resourceName: "Address",
|
|
48
|
-
body: Object.assign(Object.assign({}, address), { links: [
|
|
49
|
-
{
|
|
50
|
-
link_doctype: "Customer",
|
|
51
|
-
link_name: customerName,
|
|
52
|
-
},
|
|
53
|
-
] }),
|
|
54
|
-
}, "erpnext");
|
|
55
|
-
return result;
|
|
56
|
-
}),
|
|
57
|
-
getAddressById: (id) => __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
const result = yield client.executeERPNextRequest("getAddressById", {
|
|
59
|
-
requestMethod: "GET",
|
|
60
|
-
responseValidationModel: Address_2.Address,
|
|
61
|
-
resourceName: "Address",
|
|
62
|
-
resourceId: encodeURIComponent(id),
|
|
63
|
-
}, "erpnext");
|
|
64
|
-
return result;
|
|
65
|
-
}),
|
|
66
|
-
/* ------------------------------- AddressList ------------------------------ */
|
|
67
|
-
getAddressesByEmail: (email) => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
const result = yield client.executeERPNextRequest("getAddressesByEmail", {
|
|
69
|
-
requestMethod: "GET",
|
|
70
|
-
responseValidationModel: Address_1.AddressListName,
|
|
71
|
-
resourceName: "Address",
|
|
72
|
-
params: `?fields=["name"]&filters=[["email_id","=","${encodeURIComponent(email)}"]]`,
|
|
73
|
-
}, "erpnext");
|
|
74
|
-
return result;
|
|
75
|
-
}),
|
|
76
|
-
getAddressesByAddressFields: (address) => __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
const searchCriteria = [];
|
|
78
|
-
if (address.address_line1)
|
|
79
|
-
searchCriteria.push(["address_line1", "=", address.address_line1]);
|
|
80
|
-
if (address.city)
|
|
81
|
-
searchCriteria.push(["city", "=", address.city]);
|
|
82
|
-
if (address.pincode)
|
|
83
|
-
searchCriteria.push(["pincode", "=", address.pincode]);
|
|
84
|
-
if (address.phone)
|
|
85
|
-
searchCriteria.push(["phone", "=", address.phone]);
|
|
86
|
-
if (address.email_id)
|
|
87
|
-
searchCriteria.push(["email_id", "=", address.email_id]);
|
|
88
|
-
const result = yield client.executeERPNextRequest("getAddressesByAddressFields", {
|
|
89
|
-
requestMethod: "GET",
|
|
90
|
-
responseValidationModel: Address_1.AddressListName,
|
|
91
|
-
resourceName: "Address",
|
|
92
|
-
params: `?fields=["name"]&filters=${encodeURIComponent(JSON.stringify(searchCriteria))}`,
|
|
93
|
-
}, "erpnext");
|
|
94
|
-
return result;
|
|
95
|
-
}),
|
|
96
|
-
/* ------------------------------- Contact -------------------------------- */
|
|
97
|
-
getContactById: (id) => __awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
const result = yield client.executeERPNextRequest("getContactById", {
|
|
99
|
-
requestMethod: "GET",
|
|
100
|
-
responseValidationModel: Contact_1.Contact,
|
|
101
|
-
resourceName: "Contact",
|
|
102
|
-
resourceId: encodeURIComponent(id),
|
|
103
|
-
}, "erpnext");
|
|
104
|
-
return result;
|
|
105
|
-
}),
|
|
106
|
-
getContactsByAddressEmail: (address) => __awaiter(this, void 0, void 0, function* () {
|
|
107
|
-
const searchCriteria = [];
|
|
108
|
-
if (address.email_id)
|
|
109
|
-
searchCriteria.push(["Contact", "email_id", "=", address.email_id]);
|
|
110
|
-
const result = yield client.executeERPNextRequest("getContactsByAddressEmail", {
|
|
111
|
-
requestMethod: "GET",
|
|
112
|
-
responseValidationModel: Contact_1.ContactListName,
|
|
113
|
-
resourceName: "Contact",
|
|
114
|
-
params: `?fields=["name"]&filters=${encodeURIComponent(JSON.stringify(searchCriteria))}`,
|
|
115
|
-
}, "erpnext");
|
|
116
|
-
return result;
|
|
117
|
-
}),
|
|
118
|
-
createContact: (contact_1, ...args_1) => __awaiter(this, [contact_1, ...args_1], void 0, function* (contact, customerName = "") {
|
|
119
|
-
const result = yield client.executeERPNextRequest("createContact", {
|
|
120
|
-
requestMethod: "POST",
|
|
121
|
-
responseValidationModel: Contact_1.Contact,
|
|
122
|
-
resourceName: "Contact",
|
|
123
|
-
body: Object.assign(Object.assign({}, contact), { links: [
|
|
124
|
-
{
|
|
125
|
-
link_doctype: "Customer",
|
|
126
|
-
link_name: customerName,
|
|
127
|
-
},
|
|
128
|
-
] }),
|
|
129
|
-
}, "erpnext");
|
|
130
|
-
return result;
|
|
131
|
-
}),
|
|
132
|
-
/* ------------------------------- Customer ------------------------------ */
|
|
133
|
-
createCustomer: (body) => __awaiter(this, void 0, void 0, function* () {
|
|
134
|
-
const result = yield client.executeERPNextRequest("createCustomer", {
|
|
135
|
-
requestMethod: "POST",
|
|
136
|
-
responseValidationModel: Customer_1.Customer,
|
|
137
|
-
resourceName: "Customer",
|
|
138
|
-
body,
|
|
139
|
-
}, "erpnext");
|
|
140
|
-
return result;
|
|
141
|
-
}),
|
|
142
|
-
getDeliveryNote: (deliveryNoteErpNextName) => __awaiter(this, void 0, void 0, function* () {
|
|
143
|
-
return yield client.executeERPNextRequest("getDeliveryNote", {
|
|
144
|
-
resourceName: "Delivery Note",
|
|
145
|
-
requestMethod: "GET",
|
|
146
|
-
responseValidationModel: DeliveryNote_1.DeliveryNote,
|
|
147
|
-
resourceId: deliveryNoteErpNextName,
|
|
148
|
-
}, "erpnext");
|
|
149
|
-
}),
|
|
150
|
-
printDeliveryNote: (deliveryNoteName_1, ...args_1) => __awaiter(this, [deliveryNoteName_1, ...args_1], void 0, function* (deliveryNoteName, language = "de") {
|
|
151
|
-
return yield client.utils.executeERPNextRequestDownloadFile(`/api/method/frappe.utils.print_format.download_pdf?doctype=Delivery%20Note&name=${deliveryNoteName}&_lang=${language}`);
|
|
152
|
-
}),
|
|
153
|
-
cancelDeliveryNote: (deliveryNoteName) => __awaiter(this, void 0, void 0, function* () {
|
|
154
|
-
return yield client.executeERPNextRequest("cancelDeliveryNote", {
|
|
155
|
-
resourceName: "Delivery Note",
|
|
156
|
-
resourceId: deliveryNoteName,
|
|
157
|
-
requestMethod: "PUT",
|
|
158
|
-
responseValidationModel: DeliveryNote_1.DeliveryNote,
|
|
159
|
-
body: {
|
|
160
|
-
docstatus: 2,
|
|
161
|
-
},
|
|
162
|
-
}, "erpnext");
|
|
163
|
-
}),
|
|
164
|
-
/* -------------------------------- Shipment -------------------------------- */
|
|
165
|
-
createShipmentDraft: (deliveryNoteName) => __awaiter(this, void 0, void 0, function* () {
|
|
166
|
-
const draft = yield client.executeERPNextRequest("createShipmentDraft", {
|
|
167
|
-
methodName: "erpnext.stock.doctype.delivery_note.delivery_note.make_shipment",
|
|
168
|
-
requestMethod: "POST",
|
|
169
|
-
responseValidationModel: Shipment_1.ShipmentDraftFromDeliveryNote,
|
|
170
|
-
params: `?source_name=${deliveryNoteName}`,
|
|
171
|
-
}, "erpnext");
|
|
172
|
-
return draft;
|
|
173
|
-
}),
|
|
174
|
-
getShipment: (shipmentErpNextName) => __awaiter(this, void 0, void 0, function* () {
|
|
175
|
-
const shipment = yield client.executeERPNextRequest("getShipment", {
|
|
176
|
-
resourceName: "Shipment",
|
|
177
|
-
requestMethod: "GET",
|
|
178
|
-
responseValidationModel: Shipment_1.Shipment,
|
|
179
|
-
resourceId: shipmentErpNextName,
|
|
180
|
-
}, "erpnext");
|
|
181
|
-
return shipment;
|
|
182
|
-
}),
|
|
183
|
-
updateShipment: (shipmentErpNextName, updateBody) => __awaiter(this, void 0, void 0, function* () {
|
|
184
|
-
const shipment = yield client.executeERPNextRequest("updateShipment", {
|
|
185
|
-
resourceName: "Shipment",
|
|
186
|
-
requestMethod: "PUT",
|
|
187
|
-
inputValidationModel: Shipment_1.ShipmentAddShippingLabelAndSubmitBody,
|
|
188
|
-
responseValidationModel: Shipment_1.Shipment,
|
|
189
|
-
resourceId: shipmentErpNextName,
|
|
190
|
-
body: updateBody,
|
|
191
|
-
}, "erpnext");
|
|
192
|
-
return shipment;
|
|
193
|
-
}),
|
|
194
|
-
cancelShipment: (shipmentName) => __awaiter(this, void 0, void 0, function* () {
|
|
195
|
-
const result = yield client.executeERPNextRequest("cancelShipment", {
|
|
196
|
-
resourceName: "Shipment",
|
|
197
|
-
resourceId: shipmentName,
|
|
198
|
-
requestMethod: "PUT",
|
|
199
|
-
responseValidationModel: Shipment_1.Shipment,
|
|
200
|
-
body: {
|
|
201
|
-
docstatus: 2,
|
|
202
|
-
},
|
|
203
|
-
}, "erpnext");
|
|
204
|
-
return result;
|
|
205
|
-
}),
|
|
206
|
-
deleteShipment: (shipmentName) => __awaiter(this, void 0, void 0, function* () {
|
|
207
|
-
const result = yield client.executeERPNextRequest("deleteShipment", {
|
|
208
|
-
resourceName: "Shipment",
|
|
209
|
-
resourceId: shipmentName,
|
|
210
|
-
requestMethod: "DELETE",
|
|
211
|
-
responseValidationModel: false,
|
|
212
|
-
}, "erpnext");
|
|
213
|
-
return result;
|
|
214
|
-
}),
|
|
215
|
-
/* ---------------------------- Shipping Provider -------------------------- */
|
|
216
|
-
getShippingProvider: (shippingProviderErpNextName) => __awaiter(this, void 0, void 0, function* () {
|
|
217
|
-
const shipment = yield client.executeERPNextRequest("getShippingProvider", {
|
|
218
|
-
resourceName: "Shipping Provider",
|
|
219
|
-
resourceId: shippingProviderErpNextName,
|
|
220
|
-
requestMethod: "GET",
|
|
221
|
-
responseValidationModel: ShippingProvider_1.ShippingProvider,
|
|
222
|
-
}, "erpnext");
|
|
223
|
-
return shipment;
|
|
224
|
-
}),
|
|
225
|
-
/* ---------------------------------- Item ---------------------------------- */
|
|
226
|
-
getNoneStockItems: () => __awaiter(this, void 0, void 0, function* () {
|
|
227
|
-
const validated = yield client.executeERPNextRequest("getNoneStockItems", {
|
|
228
|
-
requestMethod: "GET",
|
|
229
|
-
resourceName: "Item",
|
|
230
|
-
responseValidationModel: Item_1.ErpNextResponseDictFalse,
|
|
231
|
-
params: '?filters=[["is_stock_item","=","0"]]&as_dict=False',
|
|
232
|
-
}, "erpnext");
|
|
233
|
-
return validated
|
|
234
|
-
.map(([item]) => {
|
|
235
|
-
return item;
|
|
236
|
-
})
|
|
237
|
-
.filter(utils_1.isDefined);
|
|
238
|
-
}),
|
|
239
|
-
/* --------------------------- Projected Quantity --------------------------- */
|
|
240
|
-
getStockDict: (warehouse) => __awaiter(this, void 0, void 0, function* () {
|
|
241
|
-
const validated = yield client.executeERPNextRequest("getStockDict", {
|
|
242
|
-
requestMethod: "GET",
|
|
243
|
-
methodName: `get_stock_from_bin?warehouse=${encodeURIComponent(warehouse)}`,
|
|
244
|
-
responseValidationModel: StockDict_1.StockDict,
|
|
245
|
-
}, "erpnext");
|
|
246
|
-
return validated;
|
|
247
|
-
}),
|
|
248
|
-
/* --------------------------- Projected Quantity --------------------------- */
|
|
249
|
-
getProjectedQuantity: (...args_1) => __awaiter(this, [...args_1], void 0, function* (options = {}) {
|
|
250
|
-
const { itemCodes, warehouse } = options;
|
|
251
|
-
const validated = yield client.executeERPNextRequest("getProjectedQuantity", {
|
|
252
|
-
requestMethod: "POST",
|
|
253
|
-
methodName: "frappe.desk.query_report.run",
|
|
254
|
-
inputValidationModel: ProjectedQuantityReport_1.GetProjectedQuantityRequestBody,
|
|
255
|
-
responseValidationModel: ProjectedQuantityReport_1.GetProjectedQuantity,
|
|
256
|
-
body: Object.assign({ report_name: "Stock Projected Qty" }, ((itemCodes === null || itemCodes === void 0 ? void 0 : itemCodes.length) || warehouse
|
|
257
|
-
? {
|
|
258
|
-
filters: Object.assign(Object.assign({}, ((itemCodes === null || itemCodes === void 0 ? void 0 : itemCodes.length) === 1 && { item_code: itemCodes[0] })), (warehouse && { warehouse })),
|
|
259
|
-
}
|
|
260
|
-
: {})),
|
|
261
|
-
}, "erpnext");
|
|
262
|
-
const stockLevels = {};
|
|
263
|
-
validated.result
|
|
264
|
-
.filter((r) => !(0, lodash_1.isArray)(r))
|
|
265
|
-
.forEach((r) => {
|
|
266
|
-
const projectedQuantity = r;
|
|
267
|
-
stockLevels[projectedQuantity.item_code] = stockLevels[projectedQuantity.item_code]
|
|
268
|
-
? stockLevels[projectedQuantity.item_code] +
|
|
269
|
-
projectedQuantity.actual_qty
|
|
270
|
-
: projectedQuantity.actual_qty;
|
|
271
|
-
});
|
|
272
|
-
// Add 0 for requested items that are not in stock
|
|
273
|
-
itemCodes === null || itemCodes === void 0 ? void 0 : itemCodes.forEach((sku) => {
|
|
274
|
-
if (Object(stockLevels).hasOwnProperty(sku))
|
|
275
|
-
return;
|
|
276
|
-
stockLevels[sku] = 0;
|
|
277
|
-
});
|
|
278
|
-
return stockLevels;
|
|
279
|
-
}),
|
|
280
|
-
/* --------------------------- Upload File --------------------------- */
|
|
281
|
-
uploadFile: (file_1, filename_1, ...args_1) => __awaiter(this, [file_1, filename_1, ...args_1], void 0, function* (file, filename, doctypeToLinkTo = "", docnameToLinkTo = "", isPrivate = true) {
|
|
282
|
-
const body = Object.assign({ filedata: file.toString("base64"), filename, from_form: 1, is_private: isPrivate ? 1 : 0 }, (doctypeToLinkTo &&
|
|
283
|
-
docnameToLinkTo && {
|
|
284
|
-
doctype: doctypeToLinkTo,
|
|
285
|
-
docname: docnameToLinkTo,
|
|
286
|
-
}));
|
|
287
|
-
const result = yield client.utils.executeERPNextRequestWithoutTemporalQueue({
|
|
288
|
-
requestMethod: "POST",
|
|
289
|
-
responseValidationModel: File_1.ERPNextValidatedFile,
|
|
290
|
-
methodName: "uploadfile",
|
|
291
|
-
body,
|
|
292
|
-
});
|
|
293
|
-
return result;
|
|
294
|
-
}),
|
|
295
|
-
/* -------------------------------- Purchase Order ---------------------------- */
|
|
296
|
-
cancelPurchaseOrder: (purchaseOrderName) => __awaiter(this, void 0, void 0, function* () {
|
|
297
|
-
return yield client.executeERPNextRequest("cancelPurchaseOrder", {
|
|
298
|
-
resourceName: "Purchase Order",
|
|
299
|
-
resourceId: purchaseOrderName,
|
|
300
|
-
requestMethod: "PUT",
|
|
301
|
-
responseValidationModel: PurchaseOrder_1.PurchaseOrder,
|
|
302
|
-
body: {
|
|
303
|
-
docstatus: 2,
|
|
304
|
-
},
|
|
305
|
-
}, "erpnext");
|
|
306
|
-
}),
|
|
307
|
-
/* -------------------------------- Receipt -------------------------------- */
|
|
308
|
-
createReceiptDraft: (purchaseOrderName) => __awaiter(this, void 0, void 0, function* () {
|
|
309
|
-
const draft = yield client.executeERPNextRequest("createReceiptDraft", {
|
|
310
|
-
methodName: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt",
|
|
311
|
-
requestMethod: "POST",
|
|
312
|
-
responseValidationModel: ReceiptDraft_1.ReceiptDraft,
|
|
313
|
-
params: `?source_name=${purchaseOrderName}`,
|
|
314
|
-
}, "erpnext");
|
|
315
|
-
return draft;
|
|
316
|
-
}),
|
|
317
|
-
createReceipt: (purchaseOrderName) => __awaiter(this, void 0, void 0, function* () {
|
|
318
|
-
const receiptDraft = yield this.createReceiptDraft(purchaseOrderName);
|
|
319
|
-
const body = Object.assign(Object.assign({}, receiptDraft), { docstatus: 1 });
|
|
320
|
-
return yield client.executeERPNextRequest("createReceipt", {
|
|
321
|
-
resourceName: "Purchase Receipt",
|
|
322
|
-
requestMethod: "POST",
|
|
323
|
-
responseValidationModel: Receipt_1.Receipt,
|
|
324
|
-
body,
|
|
325
|
-
}, "erpnext");
|
|
326
|
-
}),
|
|
327
|
-
cancelReceipt: (receiptName) => __awaiter(this, void 0, void 0, function* () {
|
|
328
|
-
return yield client.executeERPNextRequest("cancelReceipt", {
|
|
329
|
-
resourceName: "Purchase Receipt",
|
|
330
|
-
resourceId: receiptName,
|
|
331
|
-
requestMethod: "PUT",
|
|
332
|
-
responseValidationModel: Receipt_1.Receipt,
|
|
333
|
-
body: {
|
|
334
|
-
docstatus: 2,
|
|
335
|
-
},
|
|
336
|
-
}, "erpnext");
|
|
337
|
-
}),
|
|
338
|
-
};
|
|
339
|
-
}
|