From 1a8a23d2a2f611169dc15ffc1c8962432890a650 Mon Sep 17 00:00:00 2001 From: 18alantom <2.alan.tom@gmail.com> Date: Thu, 4 Nov 2021 16:01:26 +0530 Subject: [PATCH] build(electron): bump electron to 15.3.0 - refactor Common Js imports to ES6 --- accounting/exchangeRate.js | 2 +- accounting/importCOA.js | 10 +- accounting/ledgerPosting.js | 6 +- accounting/utils.js | 34 ++-- build/notarize.js | 2 +- fixtures/invoicePrint.js | 4 +- fixtures/standardCOA.js | 6 +- models/doctype/Account/Account.js | 7 +- models/doctype/Account/AccountDocument.js | 6 +- .../AccountingLedgerEntry.js | 2 +- .../AccountingSettings/AccountingSettings.js | 5 +- models/doctype/Address/Address.js | 2 +- models/doctype/Color/Color.js | 2 +- .../CompanySettings/CompanySettings.js | 4 +- models/doctype/Contact/Contact.js | 4 +- models/doctype/Currency/Currency.js | 2 +- models/doctype/Email/Email.js | 6 +- models/doctype/EmailAccount/EmailAccount.js | 6 +- models/doctype/Event/Event.js | 6 +- models/doctype/Event/EventDocument.js | 8 +- models/doctype/EventSchedule/EventSchedule.js | 4 +- models/doctype/EventSettings/EventSettings.js | 4 +- models/doctype/Fulfillment/Fulfillment.js | 6 +- .../FulfillmentItem/FulfillmentItem.js | 6 +- .../FulfillmentSettings.js | 6 +- models/doctype/GSTR3B/GSTR3B.js | 7 +- models/doctype/GSTR3B/GSTR3BDocument.js | 8 +- models/doctype/GSTR3B/GSTR3BFormat.js | 8 +- models/doctype/GSTR3B/GSTR3BServer.js | 4 +- models/doctype/GetStarted/GetStarted.js | 2 +- models/doctype/Item/Item.js | 6 +- models/doctype/JournalEntry/JournalEntry.js | 6 +- .../JournalEntry/JournalEntryServer.js | 6 +- .../JournalEntryAccount.js | 2 +- .../JournalEntrySettings.js | 2 +- models/doctype/Party/Customer.js | 10 +- models/doctype/Party/Party.js | 6 +- models/doctype/Party/PartyServer.js | 6 +- models/doctype/Party/RegionalChanges.js | 4 +- models/doctype/Party/Supplier.js | 10 +- models/doctype/Payment/Payment.js | 6 +- models/doctype/Payment/PaymentServer.js | 8 +- models/doctype/PaymentFor/PaymentFor.js | 2 +- .../PaymentSettings/PaymentSettings.js | 4 +- models/doctype/PrintSettings/PrintSettings.js | 4 +- .../PurchaseInvoice/PurchaseInvoice.js | 9 +- .../PurchaseInvoiceDocument.js | 4 +- .../PurchaseInvoice/PurchaseInvoiceServer.js | 8 +- .../PurchaseInvoiceItem.js | 2 +- .../PurchaseInvoiceSettings.js | 2 +- models/doctype/PurchaseOrder/PurchaseOrder.js | 6 +- .../PurchaseOrderItem/PurchaseOrderItem.js | 6 +- .../PurchaseOrderSettings.js | 6 +- .../PurchaseReceipt/PurchaseReceipt.js | 6 +- .../PurchaseReceiptItem.js | 6 +- .../PurchaseReceiptSettings.js | 6 +- models/doctype/Quotation/Quotation.js | 6 +- models/doctype/Quotation/QuotationDocument.js | 4 +- models/doctype/QuotationItem/QuotationItem.js | 6 +- .../QuotationSettings/QuotationSettings.js | 6 +- models/doctype/SalesInvoice/SalesInvoice.js | 9 +- .../SalesInvoice/SalesInvoiceDocument.js | 4 +- .../SalesInvoice/SalesInvoiceServer.js | 8 +- .../SalesInvoiceItem/SalesInvoiceItem.js | 2 +- .../SalesInvoiceSettings.js | 2 +- models/doctype/SalesOrder/SalesOrder.js | 6 +- .../doctype/SalesOrderItem/SalesOrderItem.js | 6 +- .../SalesOrderSettings/SalesOrderSettings.js | 6 +- models/doctype/SetupWizard/SetupWizard.js | 6 +- models/doctype/Tax/RegionalChanges.js | 2 +- models/doctype/Tax/Tax.js | 2 +- models/doctype/TaxDetail/TaxDetail.js | 2 +- models/doctype/TaxSummary/TaxSummary.js | 2 +- models/doctype/Transaction/Transaction.js | 162 +++++++++-------- .../Transaction/TransactionDocument.js | 10 +- .../doctype/Transaction/TransactionServer.js | 4 +- models/index.js | 170 +++++++++++------- package.json | 4 +- .../AccountsReceivablePayable.js | 4 +- reports/BalanceSheet/BalanceSheet.js | 8 +- reports/BalanceSheet/viewConfig.js | 4 +- .../BankReconciliation/BankReconciliation.js | 4 +- .../BankReconciliationImport.js | 45 +++-- reports/BankReconciliation/viewConfig.js | 66 +++---- reports/Cashflow/Cashflow.js | 8 +- .../FinancialStatements.js | 14 +- reports/GeneralLedger/GeneralLedger.js | 4 +- reports/GoodsAndServiceTax/BaseGSTR.js | 4 +- reports/GoodsAndServiceTax/BaseViewConfig.js | 6 +- reports/GoodsAndServiceTax/GSTR1.js | 4 +- reports/GoodsAndServiceTax/GSTR1View.js | 5 +- reports/GoodsAndServiceTax/GSTR2.js | 4 +- reports/GoodsAndServiceTax/GSTR2View.js | 5 +- reports/ProfitAndLoss/ProfitAndLoss.js | 8 +- reports/ProfitAndLoss/viewConfig.js | 5 +- reports/PurchaseRegister/PurchaseRegister.js | 4 +- reports/PurchaseRegister/viewConfig.js | 3 +- reports/SalesRegister/SalesRegister.js | 4 +- reports/SalesRegister/viewConfig.js | 3 +- reports/TrialBalance/TrialBalance.js | 8 +- reports/TrialBalance/viewConfig.js | 5 +- reports/index.js | 24 +-- reports/view.js | 30 ++-- server/index.js | 12 +- server/postStart.js | 27 +-- server/registerServerMethods.js | 10 +- src/background.js | 13 +- src/components/Controls/AttachImage.vue | 4 +- src/components/ExportWizard.vue | 4 +- src/components/ReconciliationValidation.vue | 2 +- src/components/SearchBar.vue | 5 +- src/main.js | 1 - src/messages.js | 1 + src/migrate.js | 8 +- src/pages/GetStarted.vue | 4 +- src/pages/SetupWizard/setupCompany.js | 4 +- src/saveHtmlAsPdf.js | 12 +- src/theme.js | 6 +- tests/testInvoice.js | 8 +- yarn.lock | 114 +++++++----- 120 files changed, 679 insertions(+), 586 deletions(-) diff --git a/accounting/exchangeRate.js b/accounting/exchangeRate.js index 28acfa08..322a06b4 100644 --- a/accounting/exchangeRate.js +++ b/accounting/exchangeRate.js @@ -1,4 +1,4 @@ -let { DateTime } = require('luxon'); +import { DateTime } from 'luxon'; export async function getExchangeRate({ fromCurrency, toCurrency, date }) { if (!date) { diff --git a/accounting/importCOA.js b/accounting/importCOA.js index 04d10417..a94da273 100644 --- a/accounting/importCOA.js +++ b/accounting/importCOA.js @@ -1,6 +1,6 @@ -const frappe = require('frappejs'); -const countries = require('../fixtures/countryInfo.json'); -const standardCOA = require('../fixtures/verified/standardCOA.json'); +import frappe from 'frappejs'; +import countries from '../fixtures/countryInfo.json'; +import standardCOA from '../fixtures/verified/standardCOA.json'; const accountFields = [ 'accountType', 'rootType', @@ -57,14 +57,14 @@ async function getCountryCOA() { const conCode = countries[doc.country].code; try { - const countryCoa = require('../fixtures/verified/' + conCode + '.json'); + const countryCoa = await import('../fixtures/verified/' + conCode + '.json'); return countryCoa.tree; } catch (e) { return standardCOA; } } -module.exports = async function importCharts() { +export default async function importCharts() { const chart = await getCountryCOA(); await importAccounts(chart, '', '', true); }; diff --git a/accounting/ledgerPosting.js b/accounting/ledgerPosting.js index fec34229..fda9ce86 100644 --- a/accounting/ledgerPosting.js +++ b/accounting/ledgerPosting.js @@ -1,7 +1,7 @@ -const frappe = require('frappejs'); -const { round } = require('frappejs/utils/numberFormat'); +import frappe from 'frappejs'; +import { round } from 'frappejs/utils/numberFormat'; -module.exports = class LedgerPosting { +export default class LedgerPosting { constructor({ reference, party, date, description }) { this.reference = reference; this.party = party; diff --git a/accounting/utils.js b/accounting/utils.js index b461f18b..eca16f2c 100644 --- a/accounting/utils.js +++ b/accounting/utils.js @@ -1,18 +1,18 @@ -module.exports = { - ledgerLink: { - label: 'Ledger Entries', - condition: doc => doc.submitted, - action: (doc, router) => { - router.push({ - name: 'Report', - params: { - reportName: 'general-ledger', - defaultFilters: { - referenceType: doc.doctype, - referenceName: doc.name - } - } - }); - } - } +export const ledgerLink = { + label: 'Ledger Entries', + condition: (doc) => doc.submitted, + action: (doc, router) => { + router.push({ + name: 'Report', + params: { + reportName: 'general-ledger', + defaultFilters: { + referenceType: doc.doctype, + referenceName: doc.name, + }, + }, + }); + }, }; + +export default { ledgerLink }; diff --git a/build/notarize.js b/build/notarize.js index 8d6b1c8a..7220c970 100644 --- a/build/notarize.js +++ b/build/notarize.js @@ -1,4 +1,4 @@ -const { notarize } = require('electron-notarize'); +import { notarize } from 'electron-notarize'; exports.default = async context => { const { electronPlatformName, appOutDir } = context; diff --git a/fixtures/invoicePrint.js b/fixtures/invoicePrint.js index ca11e852..73ca0afa 100644 --- a/fixtures/invoicePrint.js +++ b/fixtures/invoicePrint.js @@ -1,4 +1,4 @@ -module.exports = { +export default { doctype: "PrintFormat", name: "Standard Invoice Format", for: "SalesInvoice", @@ -71,4 +71,4 @@ module.exports = { {{ frappe.format(doc.terms, 'Text') }} ` -} +}; diff --git a/fixtures/standardCOA.js b/fixtures/standardCOA.js index a7ab0a29..18816987 100644 --- a/fixtures/standardCOA.js +++ b/fixtures/standardCOA.js @@ -1,7 +1,7 @@ -const frappe = require('frappejs'); +import frappe from 'frappejs'; const _ = frappe._.bind(frappe); -module.exports = { +export default { [_("Application of Funds (Assets)")]: { [_("Current Assets")]: { [_("Accounts Receivable")]: { @@ -170,4 +170,4 @@ module.exports = { }, "rootType": "Equity" } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/models/doctype/Account/Account.js b/models/doctype/Account/Account.js index b601c988..9a5d05fe 100644 --- a/models/doctype/Account/Account.js +++ b/models/doctype/Account/Account.js @@ -1,10 +1,11 @@ -const frappe = require('frappejs'); +import frappe from 'frappejs'; +import Account from './AccountDocument'; -module.exports = { +export default { name: 'Account', label: 'Account', doctype: 'DocType', - documentClass: require('./AccountDocument.js'), + documentClass: Account, isSingle: 0, isTree: 1, keywordFields: ['name', 'rootType', 'accountType'], diff --git a/models/doctype/Account/AccountDocument.js b/models/doctype/Account/AccountDocument.js index b47bf487..54fcd8ae 100644 --- a/models/doctype/Account/AccountDocument.js +++ b/models/doctype/Account/AccountDocument.js @@ -1,7 +1,7 @@ -const frappe = require('frappejs'); -const BaseDocument = require('frappejs/model/document'); +import frappe from 'frappejs'; +import BaseDocument from 'frappejs/model/document'; -module.exports = class Account extends BaseDocument { +export default class Account extends BaseDocument { async validate() { if (!this.accountType && this.parentAccount) { this.accountType = await frappe.db.getValue( diff --git a/models/doctype/AccountingLedgerEntry/AccountingLedgerEntry.js b/models/doctype/AccountingLedgerEntry/AccountingLedgerEntry.js index 66ef1e8a..339e494d 100644 --- a/models/doctype/AccountingLedgerEntry/AccountingLedgerEntry.js +++ b/models/doctype/AccountingLedgerEntry/AccountingLedgerEntry.js @@ -1,4 +1,4 @@ -module.exports = { +export default { name: 'AccountingLedgerEntry', label: 'Ledger Entry', naming: 'autoincrement', diff --git a/models/doctype/AccountingSettings/AccountingSettings.js b/models/doctype/AccountingSettings/AccountingSettings.js index ec090720..11e61557 100644 --- a/models/doctype/AccountingSettings/AccountingSettings.js +++ b/models/doctype/AccountingSettings/AccountingSettings.js @@ -1,6 +1,7 @@ -const countryList = Object.keys(require('~/fixtures/countryInfo.json')).sort(); +import countryInfo from '~/fixtures/countryInfo.json'; -module.exports = { +const countryList = Object.keys(countryInfo).sort(); +export default { name: 'AccountingSettings', label: 'Accounting Settings', naming: 'name', // {random|autoincrement} diff --git a/models/doctype/Address/Address.js b/models/doctype/Address/Address.js index 9a1725d8..4767270a 100644 --- a/models/doctype/Address/Address.js +++ b/models/doctype/Address/Address.js @@ -1,4 +1,4 @@ -module.exports = { +export default { name: 'Address', doctype: 'DocType', isSingle: 0, diff --git a/models/doctype/Color/Color.js b/models/doctype/Color/Color.js index 3d67ad23..3c0a8b35 100644 --- a/models/doctype/Color/Color.js +++ b/models/doctype/Color/Color.js @@ -1,4 +1,4 @@ -module.exports = { +export default { name: 'Color', doctype: 'DocType', fields: [ diff --git a/models/doctype/CompanySettings/CompanySettings.js b/models/doctype/CompanySettings/CompanySettings.js index 74308bef..21f046c1 100644 --- a/models/doctype/CompanySettings/CompanySettings.js +++ b/models/doctype/CompanySettings/CompanySettings.js @@ -1,4 +1,4 @@ -module.exports = { +export default { "name": "CompanySettings", "label": "Company Settings", "naming": "autoincrement", @@ -24,4 +24,4 @@ module.exports = { "target": "Address" } ] -} \ No newline at end of file +}; \ No newline at end of file diff --git a/models/doctype/Contact/Contact.js b/models/doctype/Contact/Contact.js index 854dd182..c9853f38 100644 --- a/models/doctype/Contact/Contact.js +++ b/models/doctype/Contact/Contact.js @@ -1,4 +1,4 @@ -module.exports = { +export default { "name": "Contact", "doctype": "DocType", "isSingle": 0, @@ -78,4 +78,4 @@ module.exports = { ] } ] -} +}; diff --git a/models/doctype/Currency/Currency.js b/models/doctype/Currency/Currency.js index f7bb9506..40fddbbc 100644 --- a/models/doctype/Currency/Currency.js +++ b/models/doctype/Currency/Currency.js @@ -1,4 +1,4 @@ -module.exports = { +export default { name: 'Currency', label: 'Currency', doctype: 'DocType', diff --git a/models/doctype/Email/Email.js b/models/doctype/Email/Email.js index 8f8f2389..59cb2612 100644 --- a/models/doctype/Email/Email.js +++ b/models/doctype/Email/Email.js @@ -1,6 +1,6 @@ -const frappe = require('frappejs'); +import frappe from 'frappejs'; -module.exports = { +export default { "name": "Email", "doctype": "DocType", "pageSettings": { @@ -69,4 +69,4 @@ module.exports = { "hidden": 1, } ] -} \ No newline at end of file +}; \ No newline at end of file diff --git a/models/doctype/EmailAccount/EmailAccount.js b/models/doctype/EmailAccount/EmailAccount.js index e3d93972..77b9fc74 100644 --- a/models/doctype/EmailAccount/EmailAccount.js +++ b/models/doctype/EmailAccount/EmailAccount.js @@ -1,6 +1,6 @@ -const frappe = require('frappejs'); +import frappe from 'frappejs'; -module.exports = { +export default { "name": "EmailAccount", "label": "Email Account", "doctype": "DocType", @@ -56,4 +56,4 @@ module.exports = { "default": "465" } ] -} \ No newline at end of file +}; \ No newline at end of file diff --git a/models/doctype/Event/Event.js b/models/doctype/Event/Event.js index f1cf76b6..a3ac0740 100644 --- a/models/doctype/Event/Event.js +++ b/models/doctype/Event/Event.js @@ -1,7 +1,7 @@ -const { DateTime } = require('luxon'); -const EventDocument = require('./EventDocument'); +import { DateTime } from 'luxon'; +import EventDocument from './EventDocument'; -module.exports = { +export default { name: 'Event', doctype: 'DocType', naming: 'random', diff --git a/models/doctype/Event/EventDocument.js b/models/doctype/Event/EventDocument.js index 5473c236..5a943173 100644 --- a/models/doctype/Event/EventDocument.js +++ b/models/doctype/Event/EventDocument.js @@ -1,8 +1,8 @@ -const frappe = require('frappejs'); -const BaseDocument = require('frappejs/model/document'); +import frappe from 'frappejs'; +import BaseDocument from 'frappejs/model/document'; -module.exports = class Event extends BaseDocument { +export default class Event extends BaseDocument { alertEvent() { alert(this.title); } -} +}; diff --git a/models/doctype/EventSchedule/EventSchedule.js b/models/doctype/EventSchedule/EventSchedule.js index da7c926a..60aae5d5 100644 --- a/models/doctype/EventSchedule/EventSchedule.js +++ b/models/doctype/EventSchedule/EventSchedule.js @@ -1,4 +1,4 @@ -module.exports = { +export default { name: 'EventSchedule', doctype: 'DocType', isChild: 1, @@ -14,4 +14,4 @@ module.exports = { fieldtype: 'Data', }, ] -} \ No newline at end of file +}; \ No newline at end of file diff --git a/models/doctype/EventSettings/EventSettings.js b/models/doctype/EventSettings/EventSettings.js index 031a8331..30900a81 100644 --- a/models/doctype/EventSettings/EventSettings.js +++ b/models/doctype/EventSettings/EventSettings.js @@ -1,4 +1,4 @@ -module.exports = { +export default { "name": "EventSettings", "label": "Event Settings", "doctype": "DocType", @@ -12,4 +12,4 @@ module.exports = { fieldtype: "Check" } ] -} \ No newline at end of file +}; \ No newline at end of file diff --git a/models/doctype/Fulfillment/Fulfillment.js b/models/doctype/Fulfillment/Fulfillment.js index 6af0d29f..8164fb79 100644 --- a/models/doctype/Fulfillment/Fulfillment.js +++ b/models/doctype/Fulfillment/Fulfillment.js @@ -1,7 +1,7 @@ -const model = require('frappejs/model'); -const Quotation = require('../Quotation/Quotation'); +import model from 'frappejs/model'; +import Quotation from '../Quotation/Quotation'; -module.exports = model.extend(Quotation, { +export default model.extend(Quotation, { name: "Fulfillment", label: "Fulfillment", settings: "FulfillmentSettings", diff --git a/models/doctype/FulfillmentItem/FulfillmentItem.js b/models/doctype/FulfillmentItem/FulfillmentItem.js index 5dd69060..a4ab16aa 100644 --- a/models/doctype/FulfillmentItem/FulfillmentItem.js +++ b/models/doctype/FulfillmentItem/FulfillmentItem.js @@ -1,6 +1,6 @@ -const model = require('frappejs/model'); -const QuotationItem = require('../QuotationItem/QuotationItem'); +import model from 'frappejs/model'; +import QuotationItem from '../QuotationItem/QuotationItem'; -module.exports = model.extend(QuotationItem, { +export default model.extend(QuotationItem, { name: "FulfillmentItem" }); diff --git a/models/doctype/FulfillmentSettings/FulfillmentSettings.js b/models/doctype/FulfillmentSettings/FulfillmentSettings.js index 18269c32..9b0c0015 100644 --- a/models/doctype/FulfillmentSettings/FulfillmentSettings.js +++ b/models/doctype/FulfillmentSettings/FulfillmentSettings.js @@ -1,7 +1,7 @@ -const model = require('frappejs/model'); -const QuotationSettings = require('../QuotationSettings/QuotationSettings'); +import model from 'frappejs/model'; +import QuotationSettings from '../QuotationSettings/QuotationSettings'; -module.exports = model.extend(QuotationSettings, { +export default model.extend(QuotationSettings, { "name": "FulfillmentSettings", "label": "Fulfillment Settings", "fields": [ diff --git a/models/doctype/GSTR3B/GSTR3B.js b/models/doctype/GSTR3B/GSTR3B.js index 1ce216ee..9feee7d1 100644 --- a/models/doctype/GSTR3B/GSTR3B.js +++ b/models/doctype/GSTR3B/GSTR3B.js @@ -1,10 +1,11 @@ -const frappe = require('frappejs'); +import frappe from 'frappejs'; +import GSTR3B from './GSTR3BDocument.js'; -module.exports = { +export default { name: 'GSTR3B', label: 'GSTR 3B', doctype: 'DocType', - documentClass: require('./GSTR3BDocument.js'), + documentClass: GSTR3B, print: { printFormat: 'GSTR3B Print Format' }, diff --git a/models/doctype/GSTR3B/GSTR3BDocument.js b/models/doctype/GSTR3B/GSTR3BDocument.js index 2445c25c..e5394224 100644 --- a/models/doctype/GSTR3B/GSTR3BDocument.js +++ b/models/doctype/GSTR3B/GSTR3BDocument.js @@ -1,8 +1,8 @@ -const BaseDocument = require('frappejs/model/document'); -const frappe = require('frappejs'); -const { format } = require('./GSTR3BFormat'); +import BaseDocument from 'frappejs/model/document'; +import frappe from 'frappejs'; +import format from './GSTR3BFormat'; -module.exports = class GSTR3B extends BaseDocument { +export default class GSTR3B extends BaseDocument { async getData() { const monthIndex = [ 'January', diff --git a/models/doctype/GSTR3B/GSTR3BFormat.js b/models/doctype/GSTR3B/GSTR3BFormat.js index 2d995177..5281be0a 100644 --- a/models/doctype/GSTR3B/GSTR3BFormat.js +++ b/models/doctype/GSTR3B/GSTR3BFormat.js @@ -1,4 +1,4 @@ -const format = { +export default { gstin: '', ret_period: '', inward_sup: { @@ -383,8 +383,4 @@ function generateHTML(data) { `; return template; -} - -module.exports = { - format -}; +} \ No newline at end of file diff --git a/models/doctype/GSTR3B/GSTR3BServer.js b/models/doctype/GSTR3B/GSTR3BServer.js index b09d8595..424f480d 100644 --- a/models/doctype/GSTR3B/GSTR3BServer.js +++ b/models/doctype/GSTR3B/GSTR3BServer.js @@ -1,6 +1,6 @@ -const GSTR3B = require('./GSTR3BDocument'); +import GSTR3B from './GSTR3BDocument'; -module.exports = class GSTR3BServer extends GSTR3B { +export default class GSTR3BServer extends GSTR3B { async validate() { if (this.month.length === 0 || this.year.length != 4) { frappe.call({ diff --git a/models/doctype/GetStarted/GetStarted.js b/models/doctype/GetStarted/GetStarted.js index 9855722a..f3de4d2b 100644 --- a/models/doctype/GetStarted/GetStarted.js +++ b/models/doctype/GetStarted/GetStarted.js @@ -1,4 +1,4 @@ -module.exports = { +export default { name: 'GetStarted', isSingle: 1, fields: [ diff --git a/models/doctype/Item/Item.js b/models/doctype/Item/Item.js index 8f05171e..f0de1daf 100644 --- a/models/doctype/Item/Item.js +++ b/models/doctype/Item/Item.js @@ -1,7 +1,7 @@ -const frappe = require('frappejs'); -const { _ } = require('frappejs/utils'); +import frappe from 'frappejs'; +import { _ } from 'frappejs/utils'; -module.exports = { +export default { name: 'Item', doctype: 'DocType', isSingle: 0, diff --git a/models/doctype/JournalEntry/JournalEntry.js b/models/doctype/JournalEntry/JournalEntry.js index 741268c1..6f7dd513 100644 --- a/models/doctype/JournalEntry/JournalEntry.js +++ b/models/doctype/JournalEntry/JournalEntry.js @@ -1,7 +1,7 @@ -const { ledgerLink } = require('../../../accounting/utils'); -const { DateTime } = require('luxon'); +import { ledgerLink } from '../../../accounting/utils'; +import { DateTime } from 'luxon'; -module.exports = { +export default { label: 'Journal Entry', name: 'JournalEntry', doctype: 'DocType', diff --git a/models/doctype/JournalEntry/JournalEntryServer.js b/models/doctype/JournalEntry/JournalEntryServer.js index c3d8cf8b..69a24fc7 100644 --- a/models/doctype/JournalEntry/JournalEntryServer.js +++ b/models/doctype/JournalEntry/JournalEntryServer.js @@ -1,7 +1,7 @@ -const BaseDocument = require('frappejs/model/document'); -const LedgerPosting = require('../../../accounting/ledgerPosting'); +import BaseDocument from 'frappejs/model/document'; +import LedgerPosting from '../../../accounting/ledgerPosting'; -module.exports = class JournalEntryServer extends BaseDocument { +export default class JournalEntryServer extends BaseDocument { getPosting() { let entries = new LedgerPosting({ reference: this }); diff --git a/models/doctype/JournalEntryAccount/JournalEntryAccount.js b/models/doctype/JournalEntryAccount/JournalEntryAccount.js index 45c9f36c..75b5b611 100644 --- a/models/doctype/JournalEntryAccount/JournalEntryAccount.js +++ b/models/doctype/JournalEntryAccount/JournalEntryAccount.js @@ -1,4 +1,4 @@ -module.exports = { +export default { name: 'JournalEntryAccount', isChild: 1, fields: [ diff --git a/models/doctype/JournalEntrySettings/JournalEntrySettings.js b/models/doctype/JournalEntrySettings/JournalEntrySettings.js index 079af924..a703b766 100644 --- a/models/doctype/JournalEntrySettings/JournalEntrySettings.js +++ b/models/doctype/JournalEntrySettings/JournalEntrySettings.js @@ -1,4 +1,4 @@ -module.exports = { +export default { name: 'JournalEntrySettings', label: 'Journal Entry Setting', doctype: 'DocType', diff --git a/models/doctype/Party/Customer.js b/models/doctype/Party/Customer.js index ae17ee02..86c01c88 100644 --- a/models/doctype/Party/Customer.js +++ b/models/doctype/Party/Customer.js @@ -1,9 +1,9 @@ -const frappe = require('frappejs'); -const { _ } = require('frappejs/utils'); -const router = require('@/router').default; -const PartyWidget = require('./PartyWidget.vue').default; +import frappe from 'frappejs'; +import { _ } from 'frappejs/utils'; +import router from '@/router'; +import PartyWidget from './PartyWidget.vue'; -module.exports = { +export default { name: 'Customer', label: 'Customer', basedOn: 'Party', diff --git a/models/doctype/Party/Party.js b/models/doctype/Party/Party.js index 13cd0f0a..9e0b64ef 100644 --- a/models/doctype/Party/Party.js +++ b/models/doctype/Party/Party.js @@ -1,7 +1,7 @@ -const frappe = require('frappejs'); -let { _ } = require('frappejs/utils'); +import frappe from 'frappejs'; +import { _ } from 'frappejs/utils'; -module.exports = { +export default { name: 'Party', label: 'Party', keywordFields: ['name'], diff --git a/models/doctype/Party/PartyServer.js b/models/doctype/Party/PartyServer.js index 067daa71..93b9d070 100644 --- a/models/doctype/Party/PartyServer.js +++ b/models/doctype/Party/PartyServer.js @@ -1,7 +1,7 @@ -const BaseDocument = require('frappejs/model/document'); -const frappe = require('frappejs'); +import BaseDocument from 'frappejs/model/document'; +import frappe from 'frappejs'; -module.exports = class PartyServer extends BaseDocument { +export default class PartyServer extends BaseDocument { beforeInsert() { if (this.customer && this.supplier) { frappe.call({ diff --git a/models/doctype/Party/RegionalChanges.js b/models/doctype/Party/RegionalChanges.js index e3b77f40..9b9c5df1 100644 --- a/models/doctype/Party/RegionalChanges.js +++ b/models/doctype/Party/RegionalChanges.js @@ -1,4 +1,4 @@ -const party = require('./Party'); +import party from './Party'; party.fields.splice(3, 0, { //insert at 3rd position @@ -18,4 +18,4 @@ party.fields.splice(4, 0, { party.fields.join(); const newParty = party; -module.exports = newParty; +export default newParty; diff --git a/models/doctype/Party/Supplier.js b/models/doctype/Party/Supplier.js index 0a659009..0748b81c 100644 --- a/models/doctype/Party/Supplier.js +++ b/models/doctype/Party/Supplier.js @@ -1,9 +1,9 @@ -const { _ } = require('frappejs/utils'); -const router = require('@/router').default; -const frappe = require('frappejs'); -const PartyWidget = require('./PartyWidget.vue').default; +import { _ } from 'frappejs/utils'; +import router from '@/router'; +import frappe from 'frappejs'; +import PartyWidget from './PartyWidget.vue'; -module.exports = { +export default { name: 'Supplier', label: 'Supplier', basedOn: 'Party', diff --git a/models/doctype/Payment/Payment.js b/models/doctype/Payment/Payment.js index 987f5edd..227924ee 100644 --- a/models/doctype/Payment/Payment.js +++ b/models/doctype/Payment/Payment.js @@ -1,7 +1,7 @@ -const frappe = require('frappejs'); -const utils = require('../../../accounting/utils'); +import frappe from 'frappejs'; +import utils from '../../../accounting/utils'; -module.exports = { +export default { name: 'Payment', label: 'Payment', isSingle: 0, diff --git a/models/doctype/Payment/PaymentServer.js b/models/doctype/Payment/PaymentServer.js index eb0534df..441f25e0 100644 --- a/models/doctype/Payment/PaymentServer.js +++ b/models/doctype/Payment/PaymentServer.js @@ -1,8 +1,8 @@ -const BaseDocument = require('frappejs/model/document'); -const frappe = require('frappejs'); -const LedgerPosting = require('../../../accounting/ledgerPosting'); +import BaseDocument from 'frappejs/model/document'; +import frappe from 'frappejs'; +import LedgerPosting from '../../../accounting/ledgerPosting'; -module.exports = class PaymentServer extends BaseDocument { +export default class PaymentServer extends BaseDocument { async change({ changed }) { if (changed === 'for') { this.amount = 0; diff --git a/models/doctype/PaymentFor/PaymentFor.js b/models/doctype/PaymentFor/PaymentFor.js index f64d7c67..33015b05 100644 --- a/models/doctype/PaymentFor/PaymentFor.js +++ b/models/doctype/PaymentFor/PaymentFor.js @@ -1,4 +1,4 @@ -module.exports = { +export default { name: 'PaymentFor', label: 'Payment For', isSingle: 0, diff --git a/models/doctype/PaymentSettings/PaymentSettings.js b/models/doctype/PaymentSettings/PaymentSettings.js index 418fc639..e016c535 100644 --- a/models/doctype/PaymentSettings/PaymentSettings.js +++ b/models/doctype/PaymentSettings/PaymentSettings.js @@ -1,4 +1,4 @@ -module.exports = { +export default { name: "PaymentSettings", label: "Payment Settings", isSingle: 1, @@ -14,4 +14,4 @@ module.exports = { "default": "PAY" } ] -} \ No newline at end of file +}; \ No newline at end of file diff --git a/models/doctype/PrintSettings/PrintSettings.js b/models/doctype/PrintSettings/PrintSettings.js index 0cb167e3..e4145fd3 100644 --- a/models/doctype/PrintSettings/PrintSettings.js +++ b/models/doctype/PrintSettings/PrintSettings.js @@ -1,6 +1,6 @@ -const theme = require('@/theme'); +import theme from '@/theme'; -module.exports = { +export default { name: 'PrintSettings', label: 'Print Settings', isSingle: 1, diff --git a/models/doctype/PurchaseInvoice/PurchaseInvoice.js b/models/doctype/PurchaseInvoice/PurchaseInvoice.js index 9090ded6..fcde430e 100644 --- a/models/doctype/PurchaseInvoice/PurchaseInvoice.js +++ b/models/doctype/PurchaseInvoice/PurchaseInvoice.js @@ -1,11 +1,12 @@ -const { getActions } = require('../Transaction/Transaction'); -const InvoiceTemplate = require('../SalesInvoice/InvoiceTemplate.vue').default; +import { getActions } from '../Transaction/Transaction'; +import InvoiceTemplate from '../SalesInvoice/InvoiceTemplate.vue'; +import PurchaseInvoice from './PurchaseInvoiceDocument'; -module.exports = { +export default { name: 'PurchaseInvoice', doctype: 'DocType', label: 'Purchase Invoice', - documentClass: require('./PurchaseInvoiceDocument'), + documentClass: PurchaseInvoice, printTemplate: InvoiceTemplate, isSingle: 0, isChild: 0, diff --git a/models/doctype/PurchaseInvoice/PurchaseInvoiceDocument.js b/models/doctype/PurchaseInvoice/PurchaseInvoiceDocument.js index b7f9d3d2..22ae8f33 100644 --- a/models/doctype/PurchaseInvoice/PurchaseInvoiceDocument.js +++ b/models/doctype/PurchaseInvoice/PurchaseInvoiceDocument.js @@ -1,3 +1,3 @@ -const TransactionDocument = require('../Transaction/TransactionDocument'); +import TransactionDocument from '../Transaction/TransactionDocument'; -module.exports = class PurchaseInvoice extends TransactionDocument {}; +export default class PurchaseInvoice extends TransactionDocument {}; diff --git a/models/doctype/PurchaseInvoice/PurchaseInvoiceServer.js b/models/doctype/PurchaseInvoice/PurchaseInvoiceServer.js index 669d727f..1e95f6aa 100644 --- a/models/doctype/PurchaseInvoice/PurchaseInvoiceServer.js +++ b/models/doctype/PurchaseInvoice/PurchaseInvoiceServer.js @@ -1,6 +1,6 @@ -const TransactionServer = require('../Transaction/TransactionServer'); -const PurchaseInvoice = require('./PurchaseInvoiceDocument'); -const LedgerPosting = require('../../../accounting/ledgerPosting'); +import TransactionServer from '../Transaction/TransactionServer'; +import PurchaseInvoice from './PurchaseInvoiceDocument'; +import LedgerPosting from '../../../accounting/ledgerPosting'; class PurchaseInvoiceServer extends PurchaseInvoice { async getPosting() { @@ -24,4 +24,4 @@ class PurchaseInvoiceServer extends PurchaseInvoice { // apply common methods from TransactionServer Object.assign(PurchaseInvoiceServer.prototype, TransactionServer); -module.exports = PurchaseInvoiceServer; +export default PurchaseInvoiceServer; diff --git a/models/doctype/PurchaseInvoiceItem/PurchaseInvoiceItem.js b/models/doctype/PurchaseInvoiceItem/PurchaseInvoiceItem.js index 6915b6b3..e0a0ddc2 100644 --- a/models/doctype/PurchaseInvoiceItem/PurchaseInvoiceItem.js +++ b/models/doctype/PurchaseInvoiceItem/PurchaseInvoiceItem.js @@ -1,4 +1,4 @@ -module.exports = { +export default { name: 'PurchaseInvoiceItem', doctype: 'DocType', isChild: 1, diff --git a/models/doctype/PurchaseInvoiceSettings/PurchaseInvoiceSettings.js b/models/doctype/PurchaseInvoiceSettings/PurchaseInvoiceSettings.js index 663bc7fa..c6b39842 100644 --- a/models/doctype/PurchaseInvoiceSettings/PurchaseInvoiceSettings.js +++ b/models/doctype/PurchaseInvoiceSettings/PurchaseInvoiceSettings.js @@ -1,4 +1,4 @@ -module.exports = { +export default { name: 'PurchaseInvoiceSettings', label: 'Purchase Invoice Settings', doctype: 'DocType', diff --git a/models/doctype/PurchaseOrder/PurchaseOrder.js b/models/doctype/PurchaseOrder/PurchaseOrder.js index 7eba77d1..5292df93 100644 --- a/models/doctype/PurchaseOrder/PurchaseOrder.js +++ b/models/doctype/PurchaseOrder/PurchaseOrder.js @@ -1,7 +1,7 @@ -const model = require('frappejs/model'); -const PurchaseInvoice = require('../PurchaseInvoice/PurchaseInvoice'); +import model from 'frappejs/model'; +import PurchaseInvoice from '../PurchaseInvoice/PurchaseInvoice'; -module.exports = model.extend( +export default model.extend( PurchaseInvoice, { name: 'PurchaseOrder', diff --git a/models/doctype/PurchaseOrderItem/PurchaseOrderItem.js b/models/doctype/PurchaseOrderItem/PurchaseOrderItem.js index 140aba73..506a352f 100644 --- a/models/doctype/PurchaseOrderItem/PurchaseOrderItem.js +++ b/models/doctype/PurchaseOrderItem/PurchaseOrderItem.js @@ -1,6 +1,6 @@ -const model = require('frappejs/model'); -const PurchaseInvoiceItem = require('../PurchaseInvoiceItem/PurchaseInvoiceItem'); +import model from 'frappejs/model'; +import PurchaseInvoiceItem from '../PurchaseInvoiceItem/PurchaseInvoiceItem'; -module.exports = model.extend(PurchaseInvoiceItem, { +export default model.extend(PurchaseInvoiceItem, { name: "PurchaseOrderItem" }); diff --git a/models/doctype/PurchaseOrderSettings/PurchaseOrderSettings.js b/models/doctype/PurchaseOrderSettings/PurchaseOrderSettings.js index b7100db1..f7a5a13d 100644 --- a/models/doctype/PurchaseOrderSettings/PurchaseOrderSettings.js +++ b/models/doctype/PurchaseOrderSettings/PurchaseOrderSettings.js @@ -1,7 +1,7 @@ -const model = require('frappejs/model'); -const PurchaseInvoiceSettings = require('../PurchaseInvoiceSettings/PurchaseInvoiceSettings'); +import model from 'frappejs/model'; +import PurchaseInvoiceSettings from '../PurchaseInvoiceSettings/PurchaseInvoiceSettings'; -module.exports = model.extend(PurchaseInvoiceSettings, { +export default model.extend(PurchaseInvoiceSettings, { "name": "PurchaseOrderSettings", "label": "Purchase Order Settings", "fields": [ diff --git a/models/doctype/PurchaseReceipt/PurchaseReceipt.js b/models/doctype/PurchaseReceipt/PurchaseReceipt.js index 56211354..127241e8 100644 --- a/models/doctype/PurchaseReceipt/PurchaseReceipt.js +++ b/models/doctype/PurchaseReceipt/PurchaseReceipt.js @@ -1,7 +1,7 @@ -const model = require('frappejs/model'); -const PurchaseOrder = require('../PurchaseOrder/PurchaseOrder'); +import model from 'frappejs/model'; +import PurchaseOrder from '../PurchaseOrder/PurchaseOrder'; -module.exports = model.extend(PurchaseOrder, { +export default model.extend(PurchaseOrder, { name: "PurchaseReceipt", label: "Purchase Receipt", settings: "PurchaseReceiptSettings", diff --git a/models/doctype/PurchaseReceiptItem/PurchaseReceiptItem.js b/models/doctype/PurchaseReceiptItem/PurchaseReceiptItem.js index 9cfd6399..7da8f9cd 100644 --- a/models/doctype/PurchaseReceiptItem/PurchaseReceiptItem.js +++ b/models/doctype/PurchaseReceiptItem/PurchaseReceiptItem.js @@ -1,7 +1,7 @@ -const model = require('frappejs/model'); -const PurchaseOrderItem = require('../PurchaseOrderItem/PurchaseOrderItem'); +import model from 'frappejs/model'; +import PurchaseOrderItem from '../PurchaseOrderItem/PurchaseOrderItem'; -module.exports = model.extend(PurchaseOrderItem, { +export default model.extend(PurchaseOrderItem, { name: "PurchaseReceiptItem", fields: [ { diff --git a/models/doctype/PurchaseReceiptSettings/PurchaseReceiptSettings.js b/models/doctype/PurchaseReceiptSettings/PurchaseReceiptSettings.js index 95746021..5efde04b 100644 --- a/models/doctype/PurchaseReceiptSettings/PurchaseReceiptSettings.js +++ b/models/doctype/PurchaseReceiptSettings/PurchaseReceiptSettings.js @@ -1,7 +1,7 @@ -const model = require('frappejs/model'); -const PurchaseOrderSettings = require('../PurchaseOrderSettings/PurchaseOrderSettings'); +import model from 'frappejs/model'; +import PurchaseOrderSettings from '../PurchaseOrderSettings/PurchaseOrderSettings'; -module.exports = model.extend(PurchaseOrderSettings, { +export default model.extend(PurchaseOrderSettings, { "name": "PurchaseReceiptSettings", "label": "Purchase Receipt Settings", "fields": [ diff --git a/models/doctype/Quotation/Quotation.js b/models/doctype/Quotation/Quotation.js index 2ef930bd..f57978e6 100644 --- a/models/doctype/Quotation/Quotation.js +++ b/models/doctype/Quotation/Quotation.js @@ -1,5 +1,5 @@ -const model = require('frappejs/model'); -const SalesInvoice = require('../SalesInvoice/SalesInvoice'); +import model from 'frappejs/model'; +import SalesInvoice from '../SalesInvoice/SalesInvoice'; const Quotation = model.extend( SalesInvoice, @@ -21,4 +21,4 @@ const Quotation = model.extend( } ); -module.exports = Quotation; +export default Quotation; diff --git a/models/doctype/Quotation/QuotationDocument.js b/models/doctype/Quotation/QuotationDocument.js index dd775931..2e1f3484 100644 --- a/models/doctype/Quotation/QuotationDocument.js +++ b/models/doctype/Quotation/QuotationDocument.js @@ -1,3 +1,3 @@ -const SalesInvoiceDocument = require('../SalesInvoice/SalesInvoiceDocument'); +import SalesInvoiceDocument from '../SalesInvoice/SalesInvoiceDocument'; -module.exports = class Quotation extends SalesInvoiceDocument {}; +export default class Quotation extends SalesInvoiceDocument {}; diff --git a/models/doctype/QuotationItem/QuotationItem.js b/models/doctype/QuotationItem/QuotationItem.js index 8203fb90..55d6b627 100644 --- a/models/doctype/QuotationItem/QuotationItem.js +++ b/models/doctype/QuotationItem/QuotationItem.js @@ -1,6 +1,6 @@ -const model = require('frappejs/model'); -const SalesInvoiceItem = require('../SalesInvoiceItem/SalesInvoiceItem'); +import model from 'frappejs/model'; +import SalesInvoiceItem from '../SalesInvoiceItem/SalesInvoiceItem'; -module.exports = model.extend(SalesInvoiceItem, { +export default model.extend(SalesInvoiceItem, { name: "QuotationItem" }); diff --git a/models/doctype/QuotationSettings/QuotationSettings.js b/models/doctype/QuotationSettings/QuotationSettings.js index d270ebfc..9445a472 100644 --- a/models/doctype/QuotationSettings/QuotationSettings.js +++ b/models/doctype/QuotationSettings/QuotationSettings.js @@ -1,7 +1,7 @@ -const model = require('frappejs/model'); -const SalesInvoiceSettings = require('../SalesInvoiceSettings/SalesInvoiceSettings'); +import model from 'frappejs/model'; +import SalesInvoiceSettings from '../SalesInvoiceSettings/SalesInvoiceSettings'; -module.exports = model.extend(SalesInvoiceSettings, { +export default model.extend(SalesInvoiceSettings, { "name": "QuotationSettings", "label": "Quotation Settings", "fields": [ diff --git a/models/doctype/SalesInvoice/SalesInvoice.js b/models/doctype/SalesInvoice/SalesInvoice.js index b923db10..c5fac95a 100644 --- a/models/doctype/SalesInvoice/SalesInvoice.js +++ b/models/doctype/SalesInvoice/SalesInvoice.js @@ -1,11 +1,12 @@ -const { getActions } = require('../Transaction/Transaction'); -const InvoiceTemplate = require('./InvoiceTemplate.vue').default; +import { getActions } from '../Transaction/Transaction'; +import InvoiceTemplate from './InvoiceTemplate.vue'; +import SalesInvoice from './SalesInvoiceDocument'; -module.exports = { +export default { name: 'SalesInvoice', label: 'Sales Invoice', doctype: 'DocType', - documentClass: require('./SalesInvoiceDocument'), + documentClass: SalesInvoice, printTemplate: InvoiceTemplate, isSingle: 0, isChild: 0, diff --git a/models/doctype/SalesInvoice/SalesInvoiceDocument.js b/models/doctype/SalesInvoice/SalesInvoiceDocument.js index d3275619..8631ac5a 100644 --- a/models/doctype/SalesInvoice/SalesInvoiceDocument.js +++ b/models/doctype/SalesInvoice/SalesInvoiceDocument.js @@ -1,3 +1,3 @@ -const TransactionDocument = require('../Transaction/TransactionDocument'); +import TransactionDocument from '../Transaction/TransactionDocument'; -module.exports = class SalesInvoice extends TransactionDocument {}; +export default class SalesInvoice extends TransactionDocument {}; diff --git a/models/doctype/SalesInvoice/SalesInvoiceServer.js b/models/doctype/SalesInvoice/SalesInvoiceServer.js index b615fa3f..46769aa0 100644 --- a/models/doctype/SalesInvoice/SalesInvoiceServer.js +++ b/models/doctype/SalesInvoice/SalesInvoiceServer.js @@ -1,6 +1,6 @@ -const TransactionServer = require('../Transaction/TransactionServer'); -const SalesInvoice = require('./SalesInvoiceDocument'); -const LedgerPosting = require('../../../accounting/ledgerPosting'); +import TransactionServer from '../Transaction/TransactionServer'; +import SalesInvoice from './SalesInvoiceDocument'; +import LedgerPosting from '../../../accounting/ledgerPosting'; class SalesInvoiceServer extends SalesInvoice { async getPosting() { @@ -24,4 +24,4 @@ class SalesInvoiceServer extends SalesInvoice { // apply common methods from TransactionServer Object.assign(SalesInvoiceServer.prototype, TransactionServer); -module.exports = SalesInvoiceServer; +export default SalesInvoiceServer; diff --git a/models/doctype/SalesInvoiceItem/SalesInvoiceItem.js b/models/doctype/SalesInvoiceItem/SalesInvoiceItem.js index d4cfc4f6..b1109bdc 100644 --- a/models/doctype/SalesInvoiceItem/SalesInvoiceItem.js +++ b/models/doctype/SalesInvoiceItem/SalesInvoiceItem.js @@ -1,4 +1,4 @@ -module.exports = { +export default { name: 'SalesInvoiceItem', doctype: 'DocType', isChild: 1, diff --git a/models/doctype/SalesInvoiceSettings/SalesInvoiceSettings.js b/models/doctype/SalesInvoiceSettings/SalesInvoiceSettings.js index 35aa42a4..17047429 100644 --- a/models/doctype/SalesInvoiceSettings/SalesInvoiceSettings.js +++ b/models/doctype/SalesInvoiceSettings/SalesInvoiceSettings.js @@ -1,4 +1,4 @@ -module.exports = { +export default { name: 'SalesInvoiceSettings', label: 'SalesInvoice Settings', doctype: 'DocType', diff --git a/models/doctype/SalesOrder/SalesOrder.js b/models/doctype/SalesOrder/SalesOrder.js index 569c12bd..4342daaf 100644 --- a/models/doctype/SalesOrder/SalesOrder.js +++ b/models/doctype/SalesOrder/SalesOrder.js @@ -1,7 +1,7 @@ -const model = require('frappejs/model'); -const Quotation = require('../Quotation/Quotation'); +import model from 'frappejs/model'; +import Quotation from '../Quotation/Quotation'; -module.exports = model.extend(Quotation, { +export default model.extend(Quotation, { name: 'SalesOrder', label: 'Sales Order', settings: 'SalesOrderSettings', diff --git a/models/doctype/SalesOrderItem/SalesOrderItem.js b/models/doctype/SalesOrderItem/SalesOrderItem.js index a1ac4ea9..99680fd3 100644 --- a/models/doctype/SalesOrderItem/SalesOrderItem.js +++ b/models/doctype/SalesOrderItem/SalesOrderItem.js @@ -1,6 +1,6 @@ -const model = require('frappejs/model'); -const QuotationItem = require('../QuotationItem/QuotationItem'); +import model from 'frappejs/model'; +import QuotationItem from '../QuotationItem/QuotationItem'; -module.exports = model.extend(QuotationItem, { +export default model.extend(QuotationItem, { name: "SalesOrderItem" }); diff --git a/models/doctype/SalesOrderSettings/SalesOrderSettings.js b/models/doctype/SalesOrderSettings/SalesOrderSettings.js index 76250022..a465bef6 100644 --- a/models/doctype/SalesOrderSettings/SalesOrderSettings.js +++ b/models/doctype/SalesOrderSettings/SalesOrderSettings.js @@ -1,7 +1,7 @@ -const model = require('frappejs/model'); -const QuotationSettings = require('../QuotationSettings/QuotationSettings'); +import model from 'frappejs/model'; +import QuotationSettings from '../QuotationSettings/QuotationSettings'; -module.exports = model.extend(QuotationSettings, { +export default model.extend(QuotationSettings, { "name": "SalesOrderSettings", "label": "Sales Order Settings", "fields": [ diff --git a/models/doctype/SetupWizard/SetupWizard.js b/models/doctype/SetupWizard/SetupWizard.js index 955138e3..d771911d 100644 --- a/models/doctype/SetupWizard/SetupWizard.js +++ b/models/doctype/SetupWizard/SetupWizard.js @@ -1,7 +1,7 @@ -const { DateTime } = require('luxon'); -const countryList = require('~/fixtures/countryInfo.json'); +import { DateTime } from 'luxon'; +import countryList from '~/fixtures/countryInfo.json'; -module.exports = { +export default { name: 'SetupWizard', label: 'Setup Wizard', naming: 'name', diff --git a/models/doctype/Tax/RegionalChanges.js b/models/doctype/Tax/RegionalChanges.js index 78036963..48476533 100644 --- a/models/doctype/Tax/RegionalChanges.js +++ b/models/doctype/Tax/RegionalChanges.js @@ -1,4 +1,4 @@ -module.exports = async function generateTaxes(country) { +export default async function generateTaxes(country) { if (country === 'India') { const GSTs = { GST: [28, 18, 12, 6, 5, 3, 0.25, 0], diff --git a/models/doctype/Tax/Tax.js b/models/doctype/Tax/Tax.js index 4116bbcc..37254a46 100644 --- a/models/doctype/Tax/Tax.js +++ b/models/doctype/Tax/Tax.js @@ -1,4 +1,4 @@ -module.exports = { +export default { name: 'Tax', label: 'Tax', doctype: 'DocType', diff --git a/models/doctype/TaxDetail/TaxDetail.js b/models/doctype/TaxDetail/TaxDetail.js index 7f6a9a76..67a4c23a 100644 --- a/models/doctype/TaxDetail/TaxDetail.js +++ b/models/doctype/TaxDetail/TaxDetail.js @@ -1,4 +1,4 @@ -module.exports = { +export default { name: 'TaxDetail', label: 'Tax Detail', doctype: 'DocType', diff --git a/models/doctype/TaxSummary/TaxSummary.js b/models/doctype/TaxSummary/TaxSummary.js index a9401b1c..f5d1f7ba 100644 --- a/models/doctype/TaxSummary/TaxSummary.js +++ b/models/doctype/TaxSummary/TaxSummary.js @@ -1,4 +1,4 @@ -module.exports = { +export default { name: 'TaxSummary', doctype: 'DocType', isChild: 1, diff --git a/models/doctype/Transaction/Transaction.js b/models/doctype/Transaction/Transaction.js index 71f56913..e567ec71 100644 --- a/models/doctype/Transaction/Transaction.js +++ b/models/doctype/Transaction/Transaction.js @@ -1,88 +1,86 @@ -const frappe = require('frappejs'); -const utils = require('../../../accounting/utils'); -const { openQuickEdit } = require('@/utils'); -const Badge = require('@/components/Badge').default; +import frappe from 'frappejs'; +import utils from '../../../accounting/utils'; +import { openQuickEdit } from '@/utils'; +import Badge from '@/components/Badge'; -module.exports = { - getStatusColumn() { - return { - label: 'Status', - fieldname: 'status', - fieldtype: 'Select', - render(doc) { - let status = 'Unpaid'; - let color = 'orange'; - if (!doc.submitted) { - status = 'Draft'; - color = 'gray'; - } - if (doc.submitted === 1 && doc.outstandingAmount === 0.0) { - status = 'Paid'; - color = 'green'; - } - return { - template: `${status}`, - components: { Badge } - }; +export function getStatusColumn() { + return { + label: 'Status', + fieldname: 'status', + fieldtype: 'Select', + render(doc) { + let status = 'Unpaid'; + let color = 'orange'; + if (!doc.submitted) { + status = 'Draft'; + color = 'gray'; } - }; - }, - getActions(doctype) { - return [ - { - label: 'Make Payment', - condition: doc => doc.submitted && doc.outstandingAmount > 0, - action: async function makePayment(doc) { - let payment = await frappe.getNewDoc('Payment'); - payment.once('afterInsert', async () => { - await payment.submit(); - }); - let isSales = doctype === 'SalesInvoice'; - let party = isSales ? doc.customer : doc.supplier; - let paymentType = isSales ? 'Receive' : 'Pay'; - let hideAccountField = isSales ? 'account' : 'paymentAccount'; - openQuickEdit({ - doctype: 'Payment', - name: payment.name, - hideFields: [ - 'party', - 'date', - hideAccountField, - 'paymentType', - 'for' + if (doc.submitted === 1 && doc.outstandingAmount === 0.0) { + status = 'Paid'; + color = 'green'; + } + return { + template: `${status}`, + components: { Badge }, + }; + }, + }; +} + +export function getActions(doctype) { + return [ + { + label: 'Make Payment', + condition: (doc) => doc.submitted && doc.outstandingAmount > 0, + action: async function makePayment(doc) { + let payment = await frappe.getNewDoc('Payment'); + payment.once('afterInsert', async () => { + await payment.submit(); + }); + let isSales = doctype === 'SalesInvoice'; + let party = isSales ? doc.customer : doc.supplier; + let paymentType = isSales ? 'Receive' : 'Pay'; + let hideAccountField = isSales ? 'account' : 'paymentAccount'; + openQuickEdit({ + doctype: 'Payment', + name: payment.name, + hideFields: ['party', 'date', hideAccountField, 'paymentType', 'for'], + defaults: { + party, + [hideAccountField]: doc.account, + date: new Date().toISOString().slice(0, 10), + paymentType, + for: [ + { + referenceType: doc.doctype, + referenceName: doc.name, + amount: doc.outstandingAmount, + }, ], - defaults: { - party, - [hideAccountField]: doc.account, - date: new Date().toISOString().slice(0, 10), - paymentType, - for: [ - { - referenceType: doc.doctype, - referenceName: doc.name, - amount: doc.outstandingAmount - } - ] - } - }); - } + }, + }); }, - { - label: 'Revert', - condition: doc => - doc.submitted && doc.baseGrandTotal === doc.outstandingAmount, - action(doc) { - doc.revert(); - } + }, + { + label: 'Revert', + condition: (doc) => + doc.submitted && doc.baseGrandTotal === doc.outstandingAmount, + action(doc) { + doc.revert(); }, - { - label: 'Print', - condition: doc => doc.submitted, - action(doc, router) { - router.push(`/print/${doc.doctype}/${doc.name}`); - } + }, + { + label: 'Print', + condition: (doc) => doc.submitted, + action(doc, router) { + router.push(`/print/${doc.doctype}/${doc.name}`); }, - utils.ledgerLink - ]; - } -}; + }, + utils.ledgerLink, + ]; +} + +export default { + getStatusColumn, + getActions +} \ No newline at end of file diff --git a/models/doctype/Transaction/TransactionDocument.js b/models/doctype/Transaction/TransactionDocument.js index a5863f13..f4fa7bfa 100644 --- a/models/doctype/Transaction/TransactionDocument.js +++ b/models/doctype/Transaction/TransactionDocument.js @@ -1,9 +1,9 @@ -const BaseDocument = require('frappejs/model/document'); -const frappe = require('frappejs'); -const { round } = require('frappejs/utils/numberFormat'); -const { getExchangeRate } = require('../../../accounting/exchangeRate'); +import BaseDocument from 'frappejs/model/document'; +import frappe from 'frappejs'; +import { round } from 'frappejs/utils/numberFormat'; +import { getExchangeRate } from '../../../accounting/exchangeRate'; -module.exports = class TransactionDocument extends BaseDocument { +export default class TransactionDocument extends BaseDocument { async getExchangeRate() { if (!this.currency) return; diff --git a/models/doctype/Transaction/TransactionServer.js b/models/doctype/Transaction/TransactionServer.js index 1a4e0780..3634b3b5 100644 --- a/models/doctype/Transaction/TransactionServer.js +++ b/models/doctype/Transaction/TransactionServer.js @@ -1,6 +1,6 @@ -const frappe = require('frappejs'); +import frappe from 'frappejs'; -module.exports = { +export default { async getPayments() { let payments = await frappe.db.getAll({ doctype: 'PaymentFor', diff --git a/models/index.js b/models/index.js index 15df9d08..0288d118 100644 --- a/models/index.js +++ b/models/index.js @@ -1,69 +1,105 @@ -module.exports = { - SetupWizard: require('./doctype/SetupWizard/SetupWizard'), - Currency: require('./doctype/Currency/Currency'), - Color: require('./doctype/Color/Color'), - Account: require('./doctype/Account/Account.js'), - AccountingSettings: require('./doctype/AccountingSettings/AccountingSettings'), - CompanySettings: require('./doctype/CompanySettings/CompanySettings'), - AccountingLedgerEntry: require('./doctype/AccountingLedgerEntry/AccountingLedgerEntry.js'), - Party: require('./doctype/Party/Party.js'), - Customer: require('./doctype/Party/Customer'), - Supplier: require('./doctype/Party/Supplier'), +import SetupWizard from './doctype/SetupWizard/SetupWizard.js'; +import Currency from './doctype/Currency/Currency.js'; +import Color from './doctype/Color/Color.js'; +import Account from './doctype/Account/Account.js'; +import AccountingSettings from './doctype/AccountingSettings/AccountingSettings.js'; +import CompanySettings from './doctype/CompanySettings/CompanySettings.js'; +import AccountingLedgerEntry from './doctype/AccountingLedgerEntry/AccountingLedgerEntry.js'; +import Party from './doctype/Party/Party.js'; +import Customer from './doctype/Party/Customer.js'; +import Supplier from './doctype/Party/Supplier.js'; +import Payment from './doctype/Payment/Payment.js'; +import PaymentFor from './doctype/PaymentFor/PaymentFor.js'; +import PaymentSettings from './doctype/PaymentSettings/PaymentSettings.js'; +import Item from './doctype/Item/Item.js'; +import SalesInvoice from './doctype/SalesInvoice/SalesInvoice.js'; +import SalesInvoiceItem from './doctype/SalesInvoiceItem/SalesInvoiceItem.js'; +import SalesInvoiceSettings from './doctype/SalesInvoiceSettings/SalesInvoiceSettings.js'; +import PurchaseInvoice from './doctype/PurchaseInvoice/PurchaseInvoice.js'; +import PurchaseInvoiceItem from './doctype/PurchaseInvoiceItem/PurchaseInvoiceItem.js'; +import PurchaseInvoiceSettings from './doctype/PurchaseInvoiceSettings/PurchaseInvoiceSettings.js'; +import Tax from './doctype/Tax/Tax.js'; +import TaxDetail from './doctype/TaxDetail/TaxDetail.js'; +import TaxSummary from './doctype/TaxSummary/TaxSummary.js'; +import GSTR3B from './doctype/GSTR3B/GSTR3B.js'; +import Address from './doctype/Address/Address.js'; +import Contact from './doctype/Contact/Contact.js'; +import JournalEntry from './doctype/JournalEntry/JournalEntry.js'; +import JournalEntryAccount from './doctype/JournalEntryAccount/JournalEntryAccount.js'; +import JournalEntrySettings from './doctype/JournalEntrySettings/JournalEntrySettings.js'; +import Quotation from './doctype/Quotation/Quotation.js'; +import QuotationItem from './doctype/QuotationItem/QuotationItem.js'; +import QuotationSettings from './doctype/QuotationSettings/QuotationSettings.js'; +import SalesOrder from './doctype/SalesOrder/SalesOrder.js'; +import SalesOrderItem from './doctype/SalesOrderItem/SalesOrderItem.js'; +import SalesOrderSettings from './doctype/SalesOrderSettings/SalesOrderSettings.js'; +import Fulfillment from './doctype/Fulfillment/Fulfillment.js'; +import FulfillmentItem from './doctype/FulfillmentItem/FulfillmentItem.js'; +import FulfillmentSettings from './doctype/FulfillmentSettings/FulfillmentSettings.js'; +import PurchaseOrder from './doctype/PurchaseOrder/PurchaseOrder.js'; +import PurchaseOrderItem from './doctype/PurchaseOrderItem/PurchaseOrderItem.js'; +import PurchaseOrderSettings from './doctype/PurchaseOrderSettings/PurchaseOrderSettings.js'; +import PurchaseReceipt from './doctype/PurchaseReceipt/PurchaseReceipt.js'; +import PurchaseReceiptItem from './doctype/PurchaseReceiptItem/PurchaseReceiptItem.js'; +import PurchaseReceiptSettings from './doctype/PurchaseReceiptSettings/PurchaseReceiptSettings.js'; +import Event from './doctype/Event/Event.js'; +import EventSchedule from './doctype/EventSchedule/EventSchedule.js'; +import EventSettings from './doctype/EventSettings/EventSettings.js'; +import Email from './doctype/Email/Email.js'; +import EmailAccount from './doctype/EmailAccount/EmailAccount.js'; +import PrintSettings from './doctype/PrintSettings/PrintSettings.js'; +import GetStarted from './doctype/GetStarted/GetStarted.js'; - Payment: require('./doctype/Payment/Payment.js'), - PaymentFor: require('./doctype/PaymentFor/PaymentFor.js'), - PaymentSettings: require('./doctype/PaymentSettings/PaymentSettings.js'), - - Item: require('./doctype/Item/Item.js'), - - SalesInvoice: require('./doctype/SalesInvoice/SalesInvoice.js'), - SalesInvoiceItem: require('./doctype/SalesInvoiceItem/SalesInvoiceItem.js'), - SalesInvoiceSettings: require('./doctype/SalesInvoiceSettings/SalesInvoiceSettings.js'), - - PurchaseInvoice: require('./doctype/PurchaseInvoice/PurchaseInvoice.js'), - PurchaseInvoiceItem: require('./doctype/PurchaseInvoiceItem/PurchaseInvoiceItem.js'), - PurchaseInvoiceSettings: require('./doctype/PurchaseInvoiceSettings/PurchaseInvoiceSettings.js'), - - Tax: require('./doctype/Tax/Tax.js'), - TaxDetail: require('./doctype/TaxDetail/TaxDetail.js'), - TaxSummary: require('./doctype/TaxSummary/TaxSummary.js'), - - GSTR3B: require('./doctype/GSTR3B/GSTR3B.js'), - - Address: require('./doctype/Address/Address.js'), - Contact: require('./doctype/Contact/Contact.js'), - - JournalEntry: require('./doctype/JournalEntry/JournalEntry.js'), - JournalEntryAccount: require('./doctype/JournalEntryAccount/JournalEntryAccount.js'), - JournalEntrySettings: require('./doctype/JournalEntrySettings/JournalEntrySettings.js'), - - Quotation: require('./doctype/Quotation/Quotation.js'), - QuotationItem: require('./doctype/QuotationItem/QuotationItem.js'), - QuotationSettings: require('./doctype/QuotationSettings/QuotationSettings.js'), - - SalesOrder: require('./doctype/SalesOrder/SalesOrder.js'), - SalesOrderItem: require('./doctype/SalesOrderItem/SalesOrderItem.js'), - SalesOrderSettings: require('./doctype/SalesOrderSettings/SalesOrderSettings.js'), - - Fulfillment: require('./doctype/Fulfillment/Fulfillment.js'), - FulfillmentItem: require('./doctype/FulfillmentItem/FulfillmentItem.js'), - FulfillmentSettings: require('./doctype/FulfillmentSettings/FulfillmentSettings.js'), - - PurchaseOrder: require('./doctype/PurchaseOrder/PurchaseOrder.js'), - PurchaseOrderItem: require('./doctype/PurchaseOrderItem/PurchaseOrderItem.js'), - PurchaseOrderSettings: require('./doctype/PurchaseOrderSettings/PurchaseOrderSettings.js'), - - PurchaseReceipt: require('./doctype/PurchaseReceipt/PurchaseReceipt.js'), - PurchaseReceiptItem: require('./doctype/PurchaseReceiptItem/PurchaseReceiptItem.js'), - PurchaseReceiptSettings: require('./doctype/PurchaseReceiptSettings/PurchaseReceiptSettings.js'), - - Event: require('./doctype/Event/Event'), - EventSchedule: require('./doctype/EventSchedule/EventSchedule'), - EventSettings: require('./doctype/EventSettings/EventSettings'), - - Email: require('./doctype/Email/Email'), - EmailAccount: require('./doctype/EmailAccount/EmailAccount'), - - PrintSettings: require('./doctype/PrintSettings/PrintSettings'), - GetStarted: require('./doctype/GetStarted/GetStarted') +export default { + SetupWizard, + Currency, + Color, + Account, + AccountingSettings, + CompanySettings, + AccountingLedgerEntry, + Party, + Customer, + Supplier, + Payment, + PaymentFor, + PaymentSettings, + Item, + SalesInvoice, + SalesInvoiceItem, + SalesInvoiceSettings, + PurchaseInvoice, + PurchaseInvoiceItem, + PurchaseInvoiceSettings, + Tax, + TaxDetail, + TaxSummary, + GSTR3B, + Address, + Contact, + JournalEntry, + JournalEntryAccount, + JournalEntrySettings, + Quotation, + QuotationItem, + QuotationSettings, + SalesOrder, + SalesOrderItem, + SalesOrderSettings, + Fulfillment, + FulfillmentItem, + FulfillmentSettings, + PurchaseOrder, + PurchaseOrderItem, + PurchaseOrderSettings, + PurchaseReceipt, + PurchaseReceiptItem, + PurchaseReceiptSettings, + Event, + EventSchedule, + EventSettings, + Email, + EmailAccount, + PrintSettings, + GetStarted, }; diff --git a/package.json b/package.json index 577cd7f0..74e1cf5d 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@popperjs/core": "^2.10.2", "core-js": "^3.19.0", "csvjson-csv2json": "^5.0.6", - "electron-store": "^5.1.0", + "electron-store": "^8.0.1", "frappe-charts": "1.6.1", "frappejs": "https://github.com/frappe/frappejs", "knex": "^0.95.12", @@ -39,7 +39,7 @@ "@vue/cli-plugin-router": "^4.5.0", "@vue/cli-service": "^4.5.0", "autoprefixer": "^9", - "electron": "^8.5.5", + "electron": "^15.3.0", "electron-devtools-installer": "^3.2.0", "electron-notarize": "^1.1.1", "electron-updater": "^4.3.9", diff --git a/reports/AccountsReceivablePayable/AccountsReceivablePayable.js b/reports/AccountsReceivablePayable/AccountsReceivablePayable.js index 8eff2898..ada10d0c 100644 --- a/reports/AccountsReceivablePayable/AccountsReceivablePayable.js +++ b/reports/AccountsReceivablePayable/AccountsReceivablePayable.js @@ -1,6 +1,6 @@ -const frappe = require('frappejs'); +import frappe from 'frappejs'; -module.exports = class AccountsReceivablePayable { +export default class AccountsReceivablePayable { async run(reportType, { date }) { const rows = await getReceivablePayable({ reportType, diff --git a/reports/BalanceSheet/BalanceSheet.js b/reports/BalanceSheet/BalanceSheet.js index f6547373..3edc8848 100644 --- a/reports/BalanceSheet/BalanceSheet.js +++ b/reports/BalanceSheet/BalanceSheet.js @@ -1,6 +1,6 @@ -const frappe = require('frappejs'); -const { unique } = require('frappejs/utils'); -const { getData } = require('../FinancialStatements/FinancialStatements'); +import frappe from 'frappejs'; +import { unique } from 'frappejs/utils'; +import { getData } from '../FinancialStatements/FinancialStatements'; class BalanceSheet { async run({ fromDate, toDate, periodicity }) { @@ -48,4 +48,4 @@ class BalanceSheet { } } -module.exports = BalanceSheet; +export default BalanceSheet; diff --git a/reports/BalanceSheet/viewConfig.js b/reports/BalanceSheet/viewConfig.js index fdc3e858..12912993 100644 --- a/reports/BalanceSheet/viewConfig.js +++ b/reports/BalanceSheet/viewConfig.js @@ -1,6 +1,6 @@ -const frappe = require('frappejs'); +import frappe from 'frappejs'; -module.exports = { +export default { title: 'Balance Sheet', method: 'balance-sheet', filterFields: [ diff --git a/reports/BankReconciliation/BankReconciliation.js b/reports/BankReconciliation/BankReconciliation.js index 552c3da6..c3c4abc2 100644 --- a/reports/BankReconciliation/BankReconciliation.js +++ b/reports/BankReconciliation/BankReconciliation.js @@ -1,4 +1,4 @@ -const frappe = require('frappejs'); +import frappe from 'frappejs'; class BankReconciliation { async run(params) { @@ -51,4 +51,4 @@ class BankReconciliation { } } -module.exports = BankReconciliation; +export default BankReconciliation; diff --git a/reports/BankReconciliation/BankReconciliationImport.js b/reports/BankReconciliation/BankReconciliationImport.js index d2d19e88..de646fc4 100644 --- a/reports/BankReconciliation/BankReconciliationImport.js +++ b/reports/BankReconciliation/BankReconciliationImport.js @@ -1,6 +1,6 @@ -const csv2json = require('csvjson-csv2json'); -const frappe = require('frappejs'); -import Vue from 'vue'; +import csv2json from 'csvjson-csv2json'; +import frappe from 'frappejs'; +import ReconciliationValidation from '../../src/components/ReconciliationValidation'; export const fileImportHandler = (file, report) => { const reader = new FileReader(); @@ -12,34 +12,34 @@ export const fileImportHandler = (file, report) => { reader.readAsBinaryString(file); }; -export const csvToJsonHandler = csv => { +export const csvToJsonHandler = (csv) => { const json = csv2json(csv, { parseNumbers: true }); return json; }; export const findMatchingReferences = async (json, report) => { - const referenceField = Object.keys(json[0]).filter(field => { + const referenceField = Object.keys(json[0]).filter((field) => { return field.toLowerCase().indexOf('ref') > -1 ? true : false; }); - const clearanceDateField = Object.keys(json[0]).filter(field => { + const clearanceDateField = Object.keys(json[0]).filter((field) => { return field.toLowerCase().indexOf('date') > -1 ? true : false; }); - const debitField = Object.keys(json[0]).filter(field => { + const debitField = Object.keys(json[0]).filter((field) => { return field.toLowerCase().indexOf('debit') > -1 || field.toLowerCase().indexOf('deposit') > -1 ? true : false; }); - const creditField = Object.keys(json[0]).filter(field => { + const creditField = Object.keys(json[0]).filter((field) => { return field.toLowerCase().indexOf('credit') > -1 || field.toLowerCase().indexOf('withdraw') > -1 ? true : false; }); - const balanceField = Object.keys(json[0]).filter(field => { + const balanceField = Object.keys(json[0]).filter((field) => { return field.toLowerCase().indexOf('balance') > -1 ? true : false; }); - const references = json.map(row => { + const references = json.map((row) => { return row[referenceField]; }); const payments = await frappe.db.getAll({ @@ -48,17 +48,17 @@ export const findMatchingReferences = async (json, report) => { filters: { referenceId: ['in', references], paymentAccount: report.currentFilters.paymentAccount, - clearanceDate: ['in', [null, undefined, '']] - } + clearanceDate: ['in', [null, undefined, '']], + }, }); if (payments.length) { - const entries = payments.map(payment => { - const jsonEntry = json.filter(row => { + const entries = payments.map((payment) => { + const jsonEntry = json.filter((row) => { return row[referenceField] === payment.referenceId; }); return Object.assign(payment, jsonEntry[0]); }); - const normalizedEntries = entries.map(entry => { + const normalizedEntries = entries.map((entry) => { return { 'Posting Date': frappe.format(entry.date, 'Date'), 'Payment Entry': entry.name, @@ -67,30 +67,29 @@ export const findMatchingReferences = async (json, report) => { frappe.parseNumber(entry[debitField]) > 0 ? entry[debitField] + ' Dr.' : entry[creditField] + ' Cr.', - 'Clearance Date': entry[clearanceDateField] + 'Clearance Date': entry[clearanceDateField], }; }); report.$modal.show({ modalProps: { title: `Validate Matching Entries`, - noFooter: true + noFooter: true, }, - component: require('../../src/components/ReconciliationValidation') - .default, + component: ReconciliationValidation, props: { entries: normalizedEntries, afterReconcile: async () => { await report.getReportData(report.currentFilters); - } - } + }, + }, }); } else { frappe.call({ method: 'show-dialog', args: { title: 'Message', - message: 'No entries found with matching Ref / Cheque ID' - } + message: 'No entries found with matching Ref / Cheque ID', + }, }); } }; diff --git a/reports/BankReconciliation/viewConfig.js b/reports/BankReconciliation/viewConfig.js index ac0c6eca..12e60490 100644 --- a/reports/BankReconciliation/viewConfig.js +++ b/reports/BankReconciliation/viewConfig.js @@ -1,5 +1,8 @@ const title = 'Bank Reconciliation'; -module.exports = { +import ImportWizard from '../../src/components/ImportWizart'; +import BankReconciliationImport from './BankReconciliationImport'; + +export default { title: title, method: 'bank-reconciliation', filterFields: [ @@ -13,9 +16,9 @@ module.exports = { getFilters: () => { return { accountType: 'Bank', - isGroup: 0 + isGroup: 0, }; - } + }, }, { fieldtype: 'Link', @@ -23,105 +26,104 @@ module.exports = { size: 'small', label: 'Party', placeholder: 'Party', - fieldname: 'party' + fieldname: 'party', }, { fieldtype: 'Date', size: 'small', placeholder: 'From Date', label: 'From Date', - fieldname: 'fromDate' + fieldname: 'fromDate', }, { fieldtype: 'Date', size: 'small', placeholder: 'To Date', label: 'To Date', - fieldname: 'toDate' - } + fieldname: 'toDate', + }, ], linkFields: [ { label: 'Reconcile', type: 'secondary', - condition: report => report.currentFilters.paymentAccount, - action: async report => { + condition: (report) => report.currentFilters.paymentAccount, + action: async (report) => { report.$modal.show({ modalProps: { title: `Import Bank Account Statement`, - noFooter: true + noFooter: true, }, - component: require('../../src/components/ImportWizard').default, + component: ImportWizard, props: { - importHandler: require('./BankReconciliationImport') - .fileImportHandler, - report - } + importHandler: BankReconciliationImport.fileImportHandler, + report, + }, }); - } + }, }, { label: 'Clear Filters', type: 'secondary', - action: async report => { + action: async (report) => { await report.getReportData({}); report.usedToReRender += 1; - } - } + }, + }, ], getColumns() { return [ { label: 'Posting Date', fieldtype: 'Date', - fieldname: 'date' + fieldname: 'date', }, { label: 'Payment Account', - fieldtype: 'Link' + fieldtype: 'Link', }, { label: 'Debit', - fieldtype: 'Currency' + fieldtype: 'Currency', }, { label: 'Credit', - fieldtype: 'Currency' + fieldtype: 'Currency', }, { label: 'Balance', - fieldtype: 'Currency' + fieldtype: 'Currency', }, { label: 'Ref/Cheque ID', fieldtype: 'Data', - fieldname: 'referenceId' + fieldname: 'referenceId', }, { label: 'Clearance Date', fieldtype: 'Date', - fieldname: 'clearanceDate' + fieldname: 'clearanceDate', }, { label: 'Ref. Type', fieldtype: 'Data', - fieldname: 'referenceType' + fieldname: 'referenceType', }, { label: 'Ref. Name', fieldtype: 'Data', - fieldname: 'referenceName' + fieldname: 'referenceName', }, { label: 'Ref. Date', fieldtype: 'Date', - fieldname: 'referenceDate' + fieldname: 'referenceDate', }, { label: 'Party', - fieldtype: 'Link' - } + fieldtype: 'Link', + }, ]; - } + }, }; diff --git a/reports/Cashflow/Cashflow.js b/reports/Cashflow/Cashflow.js index 69d1a444..d8cb961e 100644 --- a/reports/Cashflow/Cashflow.js +++ b/reports/Cashflow/Cashflow.js @@ -1,6 +1,6 @@ -const frappe = require('frappejs'); -const { getPeriodList } = require('../FinancialStatements/FinancialStatements'); -const { DateTime } = require('luxon'); +import frappe from 'frappejs'; +import { getPeriodList } from '../FinancialStatements/FinancialStatements'; +import { DateTime } from 'luxon'; class Cashflow { async run({ fromDate, toDate, periodicity }) { @@ -51,4 +51,4 @@ class Cashflow { } } -module.exports = Cashflow; +export default Cashflow; diff --git a/reports/FinancialStatements/FinancialStatements.js b/reports/FinancialStatements/FinancialStatements.js index e299435f..d9aaf1b7 100644 --- a/reports/FinancialStatements/FinancialStatements.js +++ b/reports/FinancialStatements/FinancialStatements.js @@ -1,8 +1,8 @@ -const frappe = require('frappejs'); -const { DateTime } = require('luxon'); -const { unique } = require('frappejs/utils'); +import frappe from 'frappejs'; +import { DateTime } from 'luxon'; +import { unique } from 'frappejs/utils'; -async function getData({ +export async function getData({ rootType, balanceMustBe = 'Debit', fromDate, @@ -65,7 +65,7 @@ async function getData({ return { accounts, totalRow, periodList }; } -async function getTrialBalance({ rootType, fromDate, toDate }) { +export async function getTrialBalance({ rootType, fromDate, toDate }) { let accounts = await getAccounts(rootType); let ledgerEntries = await getLedgerEntries(null, toDate, accounts); @@ -134,7 +134,7 @@ async function getTrialBalance({ rootType, fromDate, toDate }) { return accounts; } -function getPeriodList(fromDate, toDate, periodicity, fiscalYear) { +export function getPeriodList(fromDate, toDate, periodicity, fiscalYear) { if (!fromDate) { fromDate = fiscalYear.start; } @@ -284,7 +284,7 @@ async function getFiscalYear() { }; } -module.exports = { +export default { getData, getTrialBalance, getPeriodList diff --git a/reports/GeneralLedger/GeneralLedger.js b/reports/GeneralLedger/GeneralLedger.js index 2833af90..dd323bd3 100644 --- a/reports/GeneralLedger/GeneralLedger.js +++ b/reports/GeneralLedger/GeneralLedger.js @@ -1,4 +1,4 @@ -const frappe = require('frappejs'); +import frappe from 'frappejs'; class GeneralLedger { async run(params) { @@ -84,4 +84,4 @@ class GeneralLedger { } } -module.exports = GeneralLedger; +export default GeneralLedger; diff --git a/reports/GoodsAndServiceTax/BaseGSTR.js b/reports/GoodsAndServiceTax/BaseGSTR.js index 3bbc62a2..b69e7f87 100644 --- a/reports/GoodsAndServiceTax/BaseGSTR.js +++ b/reports/GoodsAndServiceTax/BaseGSTR.js @@ -1,4 +1,4 @@ -const frappe = require('frappejs'); +import frappe from 'frappejs'; class BaseGSTR { async getCompleteReport(gstrType, filters) { @@ -65,4 +65,4 @@ class BaseGSTR { } } -module.exports = BaseGSTR; +export default BaseGSTR; diff --git a/reports/GoodsAndServiceTax/BaseViewConfig.js b/reports/GoodsAndServiceTax/BaseViewConfig.js index 6cf87aff..d771fbe9 100644 --- a/reports/GoodsAndServiceTax/BaseViewConfig.js +++ b/reports/GoodsAndServiceTax/BaseViewConfig.js @@ -1,4 +1,6 @@ -module.exports = { +import ExportWizard from '../../src/components/ExportWizard'; + +export default { filterFields: [ { fieldtype: 'Select', @@ -62,7 +64,7 @@ module.exports = { title: `Export ${title}`, noFooter: true }, - component: require('../../src/components/ExportWizard').default, + component: ExportWizard, props: await getReportDetails() }); } diff --git a/reports/GoodsAndServiceTax/GSTR1.js b/reports/GoodsAndServiceTax/GSTR1.js index 8ff352cd..12f4e3bf 100644 --- a/reports/GoodsAndServiceTax/GSTR1.js +++ b/reports/GoodsAndServiceTax/GSTR1.js @@ -1,4 +1,4 @@ -const BaseGSTR = require('./BaseGSTR'); +import BaseGSTR from './BaseGSTR'; class GSTR1 extends BaseGSTR { async run(params) { @@ -25,4 +25,4 @@ class GSTR1 extends BaseGSTR { } } -module.exports = GSTR1; +export default GSTR1; diff --git a/reports/GoodsAndServiceTax/GSTR1View.js b/reports/GoodsAndServiceTax/GSTR1View.js index 95160b6c..d35482fc 100644 --- a/reports/GoodsAndServiceTax/GSTR1View.js +++ b/reports/GoodsAndServiceTax/GSTR1View.js @@ -1,6 +1,7 @@ const title = 'GSTR 1'; -const baseConfig = require('./BaseViewConfig'); -module.exports = { +import baseConfig from './BaseViewConfig'; + +export default { title: title, method: 'gstr-1', filterFields: baseConfig.filterFields, diff --git a/reports/GoodsAndServiceTax/GSTR2.js b/reports/GoodsAndServiceTax/GSTR2.js index 6dbf497a..b8aaca85 100644 --- a/reports/GoodsAndServiceTax/GSTR2.js +++ b/reports/GoodsAndServiceTax/GSTR2.js @@ -1,4 +1,4 @@ -const BaseGSTR = require('./BaseGSTR'); +import BaseGSTR from './BaseGSTR'; class GSTR2 extends BaseGSTR { async run(params) { @@ -25,4 +25,4 @@ class GSTR2 extends BaseGSTR { } } -module.exports = GSTR2; +export default GSTR2; diff --git a/reports/GoodsAndServiceTax/GSTR2View.js b/reports/GoodsAndServiceTax/GSTR2View.js index 6a7864ed..615583b3 100644 --- a/reports/GoodsAndServiceTax/GSTR2View.js +++ b/reports/GoodsAndServiceTax/GSTR2View.js @@ -1,6 +1,7 @@ const title = 'GSTR 2'; -const baseConfig = require('./BaseViewConfig'); -module.exports = { +import baseConfig from './BaseViewConfig'; + +export default { title: title, method: 'gstr-2', filterFields: baseConfig.filterFields, diff --git a/reports/ProfitAndLoss/ProfitAndLoss.js b/reports/ProfitAndLoss/ProfitAndLoss.js index d9400cd8..0f562fbd 100644 --- a/reports/ProfitAndLoss/ProfitAndLoss.js +++ b/reports/ProfitAndLoss/ProfitAndLoss.js @@ -1,6 +1,6 @@ -const frappe = require('frappejs'); -const { unique } = require('frappejs/utils'); -const { getData } = require('../FinancialStatements/FinancialStatements'); +import frappe from 'frappejs'; +import { unique } from 'frappejs/utils'; +import { getData } from '../FinancialStatements/FinancialStatements'; class ProfitAndLoss { async run({ fromDate, toDate, periodicity }) { @@ -81,4 +81,4 @@ class ProfitAndLoss { } } -module.exports = ProfitAndLoss; +export default ProfitAndLoss; diff --git a/reports/ProfitAndLoss/viewConfig.js b/reports/ProfitAndLoss/viewConfig.js index e3ae138f..b24f271d 100644 --- a/reports/ProfitAndLoss/viewConfig.js +++ b/reports/ProfitAndLoss/viewConfig.js @@ -1,7 +1,8 @@ -const frappe = require('frappejs'); +import frappe from 'frappejs'; const title = 'Profit and Loss'; -module.exports = { + +export default { title: title, method: 'profit-and-loss', treeView: true, diff --git a/reports/PurchaseRegister/PurchaseRegister.js b/reports/PurchaseRegister/PurchaseRegister.js index f70fc095..51025286 100644 --- a/reports/PurchaseRegister/PurchaseRegister.js +++ b/reports/PurchaseRegister/PurchaseRegister.js @@ -1,4 +1,4 @@ -const frappe = require('frappejs'); +import frappe from 'frappejs'; class PurchaseRegister { async run({ fromDate, toDate, supplier }) { @@ -53,4 +53,4 @@ class PurchaseRegister { } } -module.exports = PurchaseRegister; +export default PurchaseRegister; diff --git a/reports/PurchaseRegister/viewConfig.js b/reports/PurchaseRegister/viewConfig.js index 3a26b5f9..f6e83474 100644 --- a/reports/PurchaseRegister/viewConfig.js +++ b/reports/PurchaseRegister/viewConfig.js @@ -1,5 +1,6 @@ const title = 'Purchase Register'; -module.exports = { + +export default { title: title, method: 'purchase-register', filterFields: [ diff --git a/reports/SalesRegister/SalesRegister.js b/reports/SalesRegister/SalesRegister.js index ac5cb3c7..198130aa 100644 --- a/reports/SalesRegister/SalesRegister.js +++ b/reports/SalesRegister/SalesRegister.js @@ -1,4 +1,4 @@ -const frappe = require('frappejs'); +import frappe from 'frappejs'; class SalesRegister { async run({ fromDate, toDate, customer }) { @@ -52,4 +52,4 @@ class SalesRegister { } } -module.exports = SalesRegister; +export default SalesRegister; diff --git a/reports/SalesRegister/viewConfig.js b/reports/SalesRegister/viewConfig.js index 525c9c82..1163d6da 100644 --- a/reports/SalesRegister/viewConfig.js +++ b/reports/SalesRegister/viewConfig.js @@ -1,5 +1,6 @@ const title = 'Sales Register'; -module.exports = { + +export default { title: title, method: 'sales-register', filterFields: [ diff --git a/reports/TrialBalance/TrialBalance.js b/reports/TrialBalance/TrialBalance.js index 624ec926..deb79321 100644 --- a/reports/TrialBalance/TrialBalance.js +++ b/reports/TrialBalance/TrialBalance.js @@ -1,9 +1,7 @@ -const frappe = require('frappejs'); -const { - getTrialBalance -} = require('../FinancialStatements/FinancialStatements'); +import frappe from 'frappejs'; +import { getTrialBalance } from '../FinancialStatements/FinancialStatements'; -module.exports = class TrialBalance { +export default class TrialBalance { async run({ fromDate, toDate }) { if (!fromDate && !toDate) { return { rows: [] }; diff --git a/reports/TrialBalance/viewConfig.js b/reports/TrialBalance/viewConfig.js index 57bf1041..d1dba6f1 100644 --- a/reports/TrialBalance/viewConfig.js +++ b/reports/TrialBalance/viewConfig.js @@ -1,7 +1,8 @@ -const frappe = require('frappejs'); +import frappe from 'frappejs'; const title = 'Trial Balance'; -module.exports = { + +export default { title: title, method: 'trial-balance', treeView: true, diff --git a/reports/index.js b/reports/index.js index 4b548f69..40a783cf 100644 --- a/reports/index.js +++ b/reports/index.js @@ -1,14 +1,14 @@ -const frappe = require('frappejs'); -const GeneralLedger = require('./GeneralLedger/GeneralLedger'); -const ProfitAndLoss = require('./ProfitAndLoss/ProfitAndLoss'); -const BalanceSheet = require('./BalanceSheet/BalanceSheet'); -const TrialBalance = require('./TrialBalance/TrialBalance'); -const SalesRegister = require('./SalesRegister/SalesRegister'); -const PurchaseRegister = require('./PurchaseRegister/PurchaseRegister'); -const BankReconciliation = require('./BankReconciliation/BankReconciliation'); -const GSTR1 = require('./GoodsAndServiceTax/GSTR1'); -const GSTR2 = require('./GoodsAndServiceTax/GSTR2'); -const AccountsReceivablePayable = require('./AccountsReceivablePayable/AccountsReceivablePayable'); +import frappe from 'frappejs'; +import GeneralLedger from './GeneralLedger/GeneralLedger'; +import ProfitAndLoss from './ProfitAndLoss/ProfitAndLoss'; +import BalanceSheet from './BalanceSheet/BalanceSheet'; +import TrialBalance from './TrialBalance/TrialBalance'; +import SalesRegister from './SalesRegister/SalesRegister'; +import PurchaseRegister from './PurchaseRegister/PurchaseRegister'; +import BankReconciliation from './BankReconciliation/BankReconciliation'; +import GSTR1 from './GoodsAndServiceTax/GSTR1'; +import GSTR2 from './GoodsAndServiceTax/GSTR2'; +import AccountsReceivablePayable from './AccountsReceivablePayable/AccountsReceivablePayable'; // called on server side function registerReportMethods() { @@ -73,4 +73,4 @@ function getReportData(ReportClass) { return args => new ReportClass().run(args); } -module.exports = registerReportMethods; +export default registerReportMethods; diff --git a/reports/view.js b/reports/view.js index 1bdac72f..209bb1e3 100644 --- a/reports/view.js +++ b/reports/view.js @@ -1,11 +1,21 @@ -module.exports = { - 'general-ledger': require('./GeneralLedger/viewConfig').default, - 'sales-register': require('./SalesRegister/viewConfig'), - 'purchase-register': require('./PurchaseRegister/viewConfig'), - 'balance-sheet': require('./BalanceSheet/viewConfig'), - 'profit-and-loss': require('./ProfitAndLoss/viewConfig'), - 'trial-balance': require('./TrialBalance/viewConfig') - // 'bank-reconciliation': require('./BankReconciliation/viewConfig'), - // 'gstr-1': require('./GoodsAndServiceTax/GSTR1View'), - // 'gstr-2': require('./GoodsAndServiceTax/GSTR2View') +import GeneralLedgerViewConfig from './GeneralLedger/viewConfig'; +import SalesRegisterViewConfig from './SalesRegister/viewConfig'; +import PurchaseRegisterViewConfig from './PurchaseRegister/viewConfig'; +import BalanceSheetViewConfig from './BalanceSheet/viewConfig'; +import ProfitAndLossViewConfig from './ProfitAndLoss/viewConfig'; +import TrialBalanceViewConfig from './TrialBalance/viewConfig'; +// import BankReconciliationViewConfig from './BankReconciliation/viewConfig'; +// import GoodsAndServiceTaxGSTR1View from './GoodsAndServiceTax/GSTR1View'; +// import GoodsAndServiceTaxGSTR2View from './GoodsAndServiceTax/GSTR2View'; + +export default { + 'general-ledger' : GeneralLedgerViewConfig, + 'sales-register' : SalesRegisterViewConfig, + 'purchase-register' : PurchaseRegisterViewConfig, + 'balance-sheet' : BalanceSheetViewConfig, + 'profit-and-loss' : ProfitAndLossViewConfig, + 'trial-balance' : TrialBalanceViewConfig, + // 'bank-reconciliation' : BankReconciliationViewConfig, + // 'gstr-1' : GoodsAndServiceTaxGSTR1View, + // 'gstr-2' : GoodsAndServiceTaxGSTR2View, }; diff --git a/server/index.js b/server/index.js index 77b6272f..7d50de17 100644 --- a/server/index.js +++ b/server/index.js @@ -1,12 +1,12 @@ - -const server = require('frappejs/server'); -const postStart = require('./postStart'); +import models from '../models'; +import server from 'frappejs/server'; +import postStart from './postStart'; async function start() { await server.start({ backend: 'sqlite', connectionParams: { dbPath: 'test.db', enableCORS: true }, - models: require('../models') + models }) await postStart(); @@ -14,6 +14,6 @@ async function start() { start(); -module.exports = { +export default { start -} \ No newline at end of file +}; \ No newline at end of file diff --git a/server/postStart.js b/server/postStart.js index f6d7a13e..492a1928 100644 --- a/server/postStart.js +++ b/server/postStart.js @@ -1,15 +1,22 @@ -const frappe = require('frappejs'); -const naming = require('frappejs/model/naming'); -const registerServerMethods = require('./registerServerMethods'); +import frappe from 'frappejs'; +import naming from 'frappejs/model/naming'; +import registerServerMethods from './registerServerMethods'; -module.exports = async function postStart() { +import SalesInvoiceServer from '../models/doctype/SalesInvoice/SalesInvoiceServer.js' +import PaymentServer from '../models/doctype/Payment/PaymentServer.js' +import PartyServer from '../models/doctype/Party/PartyServer.js' +import PurchaseInvoiceServer from '../models/doctype/PurchaseInvoice/PurchaseInvoiceServer.js' +import JournalEntryServer from '../models/doctype/JournalEntry/JournalEntryServer.js' +import GSTR3BServer from '../models/doctype/GSTR3B/GSTR3BServer.js' + +export default async function postStart() { // set server-side modules - frappe.models.SalesInvoice.documentClass = require('../models/doctype/SalesInvoice/SalesInvoiceServer.js'); - frappe.models.Payment.documentClass = require('../models/doctype/Payment/PaymentServer.js'); - frappe.models.Party.documentClass = require('../models/doctype/Party/PartyServer.js'); - frappe.models.PurchaseInvoice.documentClass = require('../models/doctype/PurchaseInvoice/PurchaseInvoiceServer.js'); - frappe.models.JournalEntry.documentClass = require('../models/doctype/JournalEntry/JournalEntryServer.js'); - frappe.models.GSTR3B.documentClass = require('../models/doctype/GSTR3B/GSTR3BServer.js'); + frappe.models.SalesInvoice.documentClass = SalesInvoiceServer; + frappe.models.Payment.documentClass = PaymentServer; + frappe.models.Party.documentClass = PartyServer; + frappe.models.PurchaseInvoice.documentClass = PurchaseInvoiceServer; + frappe.models.JournalEntry.documentClass = JournalEntryServer; + frappe.models.GSTR3B.documentClass = GSTR3BServer; frappe.metaCache = {}; diff --git a/server/registerServerMethods.js b/server/registerServerMethods.js index 79ce185c..364f920d 100644 --- a/server/registerServerMethods.js +++ b/server/registerServerMethods.js @@ -1,14 +1,14 @@ -const frappe = require('frappejs'); -const registerReportMethods = require('../reports'); +import frappe from 'frappejs'; +import importCharts from '../accounting/importCOA'; +import registerReportMethods from '../reports'; -module.exports = function registerServerMethods() { +export default function registerServerMethods() { registerReportMethods(); frappe.registerMethod({ method: 'import-coa', async handler() { - const importCOA = require('../accounting/importCOA'); - await importCOA(); + await importCharts(); } }); }; diff --git a/src/background.js b/src/background.js index a9a22c4f..b3aa329e 100644 --- a/src/background.js +++ b/src/background.js @@ -7,8 +7,10 @@ import electron, { BrowserWindow, ipcMain, Menu, + shell, } from 'electron'; import { autoUpdater } from 'electron-updater'; +import Store from 'electron-store'; import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'; import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'; @@ -30,6 +32,8 @@ protocol.registerSchemesAsPrivileged([ { scheme: 'app', privileges: { secure: true, standard: true } }, ]); +Store.initRenderer(); + /* ----------------------------- * Main process helper functions * -----------------------------*/ @@ -37,7 +41,6 @@ protocol.registerSchemesAsPrivileged([ function getMainWindowSize() { let height; if (app.isReady()) { - // const screen = require('electron').screen; const screen = electron.screen; height = screen.getPrimaryDisplay().workAreaSize.height; height = height > 907 ? 907 : height; @@ -57,6 +60,7 @@ function createWindow() { width, height, webPreferences: { + contextIsolation: false, // TODO: Switch this off nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION, }, frame: isLinux, @@ -96,6 +100,7 @@ function createSettingsWindow(tab = 'General') { height: 577, backgroundColor: theme.backgroundColor.gray['200'], webPreferences: { + contextIsolation: false, // TODO: Switch this off nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION, }, resizable: false, @@ -122,7 +127,7 @@ ipcMain.on(IPC_MESSAGES.OPEN_SETTINGS, (event, tab) => { createSettingsWindow(tab); }); -ipcMain.on(IPC_MESSAGES.OPEN_SETTINGS, (event) => { +ipcMain.on(IPC_MESSAGES.OPEN_MENU, (event) => { const window = event.sender.getOwnerBrowserWindow(); const menu = Menu.getApplicationMenu(); menu.popup({ window }); @@ -147,6 +152,10 @@ ipcMain.on(IPC_MESSAGES.MINIMIZE_CURRENT_WINDOW, (event) => { event.sender.getOwnerBrowserWindow().minimize(); }); +ipcMain.on(IPC_MESSAGES.OPEN_EXTERNAL, (event, link) => { + shell.openExternal(link); +}); + /* ---------------------------------- * Register ipcMain function handlers * ----------------------------------*/ diff --git a/src/components/Controls/AttachImage.vue b/src/components/Controls/AttachImage.vue index e8d6e100..4bcb680d 100644 --- a/src/components/Controls/AttachImage.vue +++ b/src/components/Controls/AttachImage.vue @@ -44,6 +44,8 @@ import frappe from 'frappejs'; import { ipcRenderer } from 'electron'; import Base from './Base'; import { IPC_ACTIONS } from '@/messages' +import fs from 'fs'; +import path from 'path'; export default { name: 'AttachImage', @@ -69,8 +71,6 @@ export default { } }, getDataURL(filePath) { - let fs = require('fs'); - let path = require('path'); let typedArray = fs.readFileSync(filePath); let extension = path.extname(filePath).slice(1); let blob = new Blob([typedArray.buffer], { type: 'image/' + extension }); diff --git a/src/components/ExportWizard.vue b/src/components/ExportWizard.vue index e104028a..db6066c7 100644 --- a/src/components/ExportWizard.vue +++ b/src/components/ExportWizard.vue @@ -28,9 +28,7 @@