mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
FIX: incorrect path to country coa json after building
This commit is contained in:
parent
2d2c9d4e6a
commit
ebf6800d65
@ -58,15 +58,12 @@ async function getCountryCOA() {
|
||||
const doc = await frappe.getDoc('AccountingSettings');
|
||||
const conCode = countries[doc.country].code;
|
||||
|
||||
const countryCOA = path.resolve(
|
||||
path.join('./fixtures/verified/', conCode + '.json')
|
||||
);
|
||||
|
||||
if (fs.existsSync(countryCOA)) {
|
||||
const jsonText = fs.readFileSync(countryCOA, 'utf-8');
|
||||
const json = JSON.parse(jsonText);
|
||||
return json.tree;
|
||||
} else {
|
||||
try {
|
||||
const countryCoa = require('../../../fixtures/verified/' +
|
||||
conCode +
|
||||
'.json');
|
||||
return countryCoa.tree;
|
||||
} catch (e) {
|
||||
return standardCOA;
|
||||
}
|
||||
}
|
||||
|
13
src/main.js
13
src/main.js
@ -45,7 +45,6 @@ frappe.events.on(
|
||||
country,
|
||||
name,
|
||||
email,
|
||||
abbreviation,
|
||||
bankName,
|
||||
fiscalYearStart,
|
||||
fiscalYearEnd
|
||||
@ -64,10 +63,16 @@ frappe.events.on(
|
||||
});
|
||||
|
||||
await doc.update();
|
||||
await frappe.call({ method: 'import-coa' });
|
||||
|
||||
await frappe.call({
|
||||
method: 'import-coa'
|
||||
});
|
||||
const generateRegionalTaxes = require('../models/doctype/Tax/RegionalChanges');
|
||||
await generateRegionalTaxes(country);
|
||||
if (country === 'India') {
|
||||
frappe.models.Party = require('../models/doctype/Party/RegionalChanges');
|
||||
await frappe.db.migrate();
|
||||
}
|
||||
frappe.events.trigger('show-desk');
|
||||
}
|
||||
);
|
||||
|
||||
window.frappe = frappe;
|
||||
|
Loading…
Reference in New Issue
Block a user