2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 11:29:00 +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 doc = await frappe.getDoc('AccountingSettings');
const conCode = countries[doc.country].code; const conCode = countries[doc.country].code;
const countryCOA = path.resolve( try {
path.join('./fixtures/verified/', conCode + '.json') const countryCoa = require('../../../fixtures/verified/' +
); conCode +
'.json');
if (fs.existsSync(countryCOA)) { return countryCoa.tree;
const jsonText = fs.readFileSync(countryCOA, 'utf-8'); } catch (e) {
const json = JSON.parse(jsonText);
return json.tree;
} else {
return standardCOA; return standardCOA;
} }
} }

View File

@ -45,7 +45,6 @@ frappe.events.on(
country, country,
name, name,
email, email,
abbreviation,
bankName, bankName,
fiscalYearStart, fiscalYearStart,
fiscalYearEnd fiscalYearEnd
@ -64,10 +63,16 @@ frappe.events.on(
}); });
await doc.update(); await doc.update();
await frappe.call({ method: 'import-coa' }); await frappe.call({
method: 'import-coa'
frappe.events.trigger('show-desk'); });
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; window.frappe = frappe;