JEISA-WEBAPP/pocketbase/pb_migrations/1760602672_add_cost_price_gbp.js
davidels1 f7b46986c5 Add GBP cost price to stock and purchase orders
Introduces a new 'cost_price_gbp' field to the stock items schema and database migration. Updates stock item forms to support both ZAR and GBP cost prices. Purchase order forms and PDF generation now use GBP pricing, with enhanced supplier and order metadata. Adds a searchable stock item selector for purchase orders and improves type definitions and UI labels for clarity.
2025-11-05 14:55:42 +02:00

27 lines
665 B
JavaScript

/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_2382354120");
// Add cost_price_gbp field
collection.fields.addAt(6, new Field({
"hidden": false,
"id": "",
"max": null,
"min": 0,
"name": "cost_price_gbp",
"onlyInt": false,
"presentable": false,
"required": false,
"system": false,
"type": "number"
}));
return app.save(collection);
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_2382354120");
// Remove cost_price_gbp field
collection.fields.removeById("number_cost_price_gbp");
return app.save(collection);
});