2
0
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:
thefalconx33 2019-07-22 17:11:09 +05:30
parent 2d2c9d4e6a
commit ebf6800d65
2 changed files with 15 additions and 13 deletions

View File

@ -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;
}
}

View File

@ -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;