mirror of
https://github.com/frappe/books.git
synced 2024-12-23 03:19:01 +00:00
Prevented error message on navigation
This commit is contained in:
parent
aa6a565f9b
commit
f8ff30156b
@ -52,6 +52,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import frappe from 'frappejs';
|
import frappe from 'frappejs';
|
||||||
import { getStatusColumn } from '../Transaction/Transaction';
|
import { getStatusColumn } from '../Transaction/Transaction';
|
||||||
|
import { routeTo } from '@/utils';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PartyWidget',
|
name: 'PartyWidget',
|
||||||
@ -99,7 +100,7 @@ export default {
|
|||||||
return statusColumn.render(doc);
|
return statusColumn.render(doc);
|
||||||
},
|
},
|
||||||
routeToForm(doc) {
|
routeToForm(doc) {
|
||||||
this.$router.push(`/edit/${this.invoiceDoctype}/${doc.name}`);
|
routeTo(`/edit/${this.invoiceDoctype}/${doc.name}`);
|
||||||
},
|
},
|
||||||
fullyPaid(invoice) {
|
fullyPaid(invoice) {
|
||||||
return invoice.outstandingAmount == 0;
|
return invoice.outstandingAmount == 0;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import frappe from 'frappejs';
|
import frappe from 'frappejs';
|
||||||
import utils from '../../../accounting/utils';
|
import utils from '../../../accounting/utils';
|
||||||
import { openQuickEdit, getInvoiceStatus, statusColor } from '@/utils';
|
import { openQuickEdit, getInvoiceStatus, statusColor, routeTo } from '@/utils';
|
||||||
import Badge from '@/components/Badge';
|
import Badge from '@/components/Badge';
|
||||||
|
|
||||||
export function getStatusColumn() {
|
export function getStatusColumn() {
|
||||||
@ -64,8 +64,8 @@ export function getActions(doctype) {
|
|||||||
{
|
{
|
||||||
label: 'Print',
|
label: 'Print',
|
||||||
condition: (doc) => doc.submitted,
|
condition: (doc) => doc.submitted,
|
||||||
action(doc, router) {
|
action(doc) {
|
||||||
router.push(`/print/${doc.doctype}/${doc.name}`);
|
routeTo(`/print/${doc.doctype}/${doc.name}`);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
utils.ledgerLink,
|
utils.ledgerLink,
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
import frappe from 'frappejs';
|
import frappe from 'frappejs';
|
||||||
import reports from '../../reports/view';
|
import reports from '../../reports/view';
|
||||||
import Dropdown from '@/components/Dropdown';
|
import Dropdown from '@/components/Dropdown';
|
||||||
|
import { routeTo } from '@/utils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@ -81,7 +82,8 @@ export default {
|
|||||||
let searchList = [...doctypes, ...reports, ...views];
|
let searchList = [...doctypes, ...reports, ...views];
|
||||||
this.searchList = searchList.map(d => {
|
this.searchList = searchList.map(d => {
|
||||||
if (d.route) {
|
if (d.route) {
|
||||||
d.action = () => this.routeTo(d.route);
|
d.action = () => routeTo(d.route);
|
||||||
|
this.inputValue = '';
|
||||||
}
|
}
|
||||||
return d;
|
return d;
|
||||||
});
|
});
|
||||||
@ -118,10 +120,6 @@ export default {
|
|||||||
group: 'List'
|
group: 'List'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
},
|
|
||||||
routeTo(route) {
|
|
||||||
this.$router.push(route);
|
|
||||||
this.inputValue = '';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<div class="window-no-drag">
|
<div class="window-no-drag">
|
||||||
<WindowControls v-if="platform === 'Mac'" class="px-3 mb-6" />
|
<WindowControls v-if="platform === 'Mac'" class="px-3 mb-6" />
|
||||||
<div class="px-3">
|
<div class="px-3">
|
||||||
<h6 class="text-lg font-semibold" @click="$router.push('/')">
|
<h6 class="text-lg font-semibold" @click="routeTo('/')">
|
||||||
{{ companyName }}
|
{{ companyName }}
|
||||||
</h6>
|
</h6>
|
||||||
</div>
|
</div>
|
||||||
@ -46,6 +46,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import sidebarConfig from '../sidebarConfig';
|
import sidebarConfig from '../sidebarConfig';
|
||||||
import WindowControls from './WindowControls';
|
import WindowControls from './WindowControls';
|
||||||
|
import { routeTo } from '@/utils';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@ -84,6 +85,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
routeTo,
|
||||||
itemActiveClass(item) {
|
itemActiveClass(item) {
|
||||||
let { path: currentRoute, params } = this.$route;
|
let { path: currentRoute, params } = this.$route;
|
||||||
let routeMatch = currentRoute === item.route;
|
let routeMatch = currentRoute === item.route;
|
||||||
@ -98,7 +100,7 @@ export default {
|
|||||||
group.action();
|
group.action();
|
||||||
}
|
}
|
||||||
if (group.route) {
|
if (group.route) {
|
||||||
this.routeTo(group.route);
|
routeTo(group.route);
|
||||||
}
|
}
|
||||||
this.activeGroup = group;
|
this.activeGroup = group;
|
||||||
},
|
},
|
||||||
@ -107,11 +109,8 @@ export default {
|
|||||||
item.action();
|
item.action();
|
||||||
}
|
}
|
||||||
if (item.route) {
|
if (item.route) {
|
||||||
this.routeTo(item.route);
|
routeTo(item.route);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
routeTo(route) {
|
|
||||||
this.$router.push(route);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -73,6 +73,7 @@ import Button from '@/components/Button';
|
|||||||
import PeriodSelector from './PeriodSelector';
|
import PeriodSelector from './PeriodSelector';
|
||||||
import SectionHeader from './SectionHeader';
|
import SectionHeader from './SectionHeader';
|
||||||
import { getDatesAndPeriodicity } from './getDatesAndPeriodicity';
|
import { getDatesAndPeriodicity } from './getDatesAndPeriodicity';
|
||||||
|
import { routeTo } from '@/utils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'UnpaidInvoices',
|
name: 'UnpaidInvoices',
|
||||||
@ -144,7 +145,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async newInvoice(invoice) {
|
async newInvoice(invoice) {
|
||||||
let doc = await frappe.getNewDoc(invoice.doctype);
|
let doc = await frappe.getNewDoc(invoice.doctype);
|
||||||
this.$router.push(`/edit/${invoice.doctype}/${doc.name}`);
|
routeTo(`/edit/${invoice.doctype}/${doc.name}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -90,6 +90,7 @@ import Button from '@/components/Button';
|
|||||||
import { openSettings } from '@/utils';
|
import { openSettings } from '@/utils';
|
||||||
import { ipcRenderer } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
import { IPC_MESSAGES } from '@/messages';
|
import { IPC_MESSAGES } from '@/messages';
|
||||||
|
import { routeTo } from '@/utils';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'GetStarted',
|
name: 'GetStarted',
|
||||||
@ -149,7 +150,7 @@ export default {
|
|||||||
description:
|
description:
|
||||||
'Review your chart of accounts, add any account or tax heads as needed',
|
'Review your chart of accounts, add any account or tax heads as needed',
|
||||||
action: () => {
|
action: () => {
|
||||||
this.$router.push('/chart-of-accounts');
|
routeTo('/chart-of-accounts');
|
||||||
this.updateChecks({ chartOfAccountsReviewed: 1 });
|
this.updateChecks({ chartOfAccountsReviewed: 1 });
|
||||||
},
|
},
|
||||||
fieldname: 'chartOfAccountsReviewed',
|
fieldname: 'chartOfAccountsReviewed',
|
||||||
@ -171,7 +172,7 @@ export default {
|
|||||||
icon: 'percentage',
|
icon: 'percentage',
|
||||||
description:
|
description:
|
||||||
'Setup your tax templates for your sales or purchase transactions',
|
'Setup your tax templates for your sales or purchase transactions',
|
||||||
action: () => this.$router.push('/list/Tax'),
|
action: () => routeTo('/list/Tax'),
|
||||||
documentation:
|
documentation:
|
||||||
'https://frappebooks.com/docs/setting-up#2-add-taxes'
|
'https://frappebooks.com/docs/setting-up#2-add-taxes'
|
||||||
}
|
}
|
||||||
@ -187,7 +188,7 @@ export default {
|
|||||||
icon: 'item',
|
icon: 'item',
|
||||||
description:
|
description:
|
||||||
'Add products or services that you sell to your customers',
|
'Add products or services that you sell to your customers',
|
||||||
action: () => this.$router.push('/list/Item'),
|
action: () => routeTo('/list/Item'),
|
||||||
fieldname: 'itemCreated',
|
fieldname: 'itemCreated',
|
||||||
documentation:
|
documentation:
|
||||||
'https://frappebooks.com/docs/setting-up#3-add-items'
|
'https://frappebooks.com/docs/setting-up#3-add-items'
|
||||||
@ -197,7 +198,7 @@ export default {
|
|||||||
label: _('Add Customers'),
|
label: _('Add Customers'),
|
||||||
icon: 'customer',
|
icon: 'customer',
|
||||||
description: 'Add a few customers to create your first invoice',
|
description: 'Add a few customers to create your first invoice',
|
||||||
action: () => this.$router.push('/list/Customer'),
|
action: () => routeTo('/list/Customer'),
|
||||||
fieldname: 'customerCreated',
|
fieldname: 'customerCreated',
|
||||||
documentation:
|
documentation:
|
||||||
'https://frappebooks.com/docs/setting-up#4-add-customers'
|
'https://frappebooks.com/docs/setting-up#4-add-customers'
|
||||||
@ -208,7 +209,7 @@ export default {
|
|||||||
icon: 'sales-invoice',
|
icon: 'sales-invoice',
|
||||||
description:
|
description:
|
||||||
'Create your first invoice and mail it to your customer',
|
'Create your first invoice and mail it to your customer',
|
||||||
action: () => this.$router.push('/list/SalesInvoice'),
|
action: () => routeTo('/list/SalesInvoice'),
|
||||||
fieldname: 'invoiceCreated',
|
fieldname: 'invoiceCreated',
|
||||||
documentation: 'https://frappebooks.com/docs/invoices'
|
documentation: 'https://frappebooks.com/docs/invoices'
|
||||||
}
|
}
|
||||||
@ -224,7 +225,7 @@ export default {
|
|||||||
icon: 'item',
|
icon: 'item',
|
||||||
description:
|
description:
|
||||||
'Add products or services that you buy from your suppliers',
|
'Add products or services that you buy from your suppliers',
|
||||||
action: () => this.$router.push('/list/Item'),
|
action: () => routeTo('/list/Item'),
|
||||||
fieldname: 'itemCreated'
|
fieldname: 'itemCreated'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -232,7 +233,7 @@ export default {
|
|||||||
label: _('Add Suppliers'),
|
label: _('Add Suppliers'),
|
||||||
icon: 'supplier',
|
icon: 'supplier',
|
||||||
description: 'Add a few suppliers to create your first bill',
|
description: 'Add a few suppliers to create your first bill',
|
||||||
action: () => this.$router.push('/list/Supplier'),
|
action: () => routeTo('/list/Supplier'),
|
||||||
fieldname: 'supplierCreated'
|
fieldname: 'supplierCreated'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -241,7 +242,7 @@ export default {
|
|||||||
icon: 'purchase-invoice',
|
icon: 'purchase-invoice',
|
||||||
description:
|
description:
|
||||||
'Create your first bill and mail it to your supplier',
|
'Create your first bill and mail it to your supplier',
|
||||||
action: () => this.$router.push('/list/PurchaseInvoice'),
|
action: () => routeTo('/list/PurchaseInvoice'),
|
||||||
fieldname: 'billCreated',
|
fieldname: 'billCreated',
|
||||||
documentation: 'https://frappebooks.com/docs/bills'
|
documentation: 'https://frappebooks.com/docs/bills'
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
v-if="doc.submitted"
|
v-if="doc.submitted"
|
||||||
class="text-gray-900 text-xs ml-2"
|
class="text-gray-900 text-xs ml-2"
|
||||||
:icon="true"
|
:icon="true"
|
||||||
@click="$router.push(`/print/${doc.doctype}/${doc.name}`)"
|
@click="routeTo(`/print/${doc.doctype}/${doc.name}`)"
|
||||||
>
|
>
|
||||||
Print
|
Print
|
||||||
</Button>
|
</Button>
|
||||||
@ -185,6 +185,7 @@ import {
|
|||||||
getActionsForDocument,
|
getActionsForDocument,
|
||||||
getInvoiceStatus,
|
getInvoiceStatus,
|
||||||
showMessageDialog,
|
showMessageDialog,
|
||||||
|
routeTo
|
||||||
} from '@/utils';
|
} from '@/utils';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -240,7 +241,7 @@ export default {
|
|||||||
window.d = this.doc;
|
window.d = this.doc;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof frappe.errors.NotFoundError) {
|
if (error instanceof frappe.errors.NotFoundError) {
|
||||||
this.routeToList();
|
routeTo(`/list/${this.doctype}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.handleError(error);
|
this.handleError(error);
|
||||||
@ -260,6 +261,7 @@ export default {
|
|||||||
this.status = getInvoiceStatus(this.doc);
|
this.status = getInvoiceStatus(this.doc);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
routeTo,
|
||||||
async onSaveClick() {
|
async onSaveClick() {
|
||||||
await this.doc.set(
|
await this.doc.set(
|
||||||
'items',
|
'items',
|
||||||
@ -294,9 +296,6 @@ export default {
|
|||||||
openInvoiceSettings() {
|
openInvoiceSettings() {
|
||||||
openSettings('Invoice');
|
openSettings('Invoice');
|
||||||
},
|
},
|
||||||
routeToList() {
|
|
||||||
this.$router.push(`/list/${this.doctype}`);
|
|
||||||
},
|
|
||||||
formattedValue(fieldname, doc) {
|
formattedValue(fieldname, doc) {
|
||||||
if (!doc) {
|
if (!doc) {
|
||||||
doc = this.doc;
|
doc = this.doc;
|
||||||
|
@ -127,7 +127,7 @@ import DropdownWithActions from '@/components/DropdownWithActions';
|
|||||||
import FormControl from '@/components/Controls/FormControl';
|
import FormControl from '@/components/Controls/FormControl';
|
||||||
import BackLink from '@/components/BackLink';
|
import BackLink from '@/components/BackLink';
|
||||||
import StatusBadge from '@/components/StatusBadge';
|
import StatusBadge from '@/components/StatusBadge';
|
||||||
import { handleErrorWithDialog, getActionsForDocument } from '@/utils';
|
import { handleErrorWithDialog, getActionsForDocument, routeTo } from '@/utils';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'JournalEntryForm',
|
name: 'JournalEntryForm',
|
||||||
@ -187,7 +187,7 @@ export default {
|
|||||||
window.je = this.doc;
|
window.je = this.doc;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof frappe.errors.NotFoundError) {
|
if (error instanceof frappe.errors.NotFoundError) {
|
||||||
this.$router.push(`/list/${this.doctype}`);
|
routeTo(`/list/${this.doctype}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.handleError(error);
|
this.handleError(error);
|
||||||
|
@ -60,7 +60,7 @@ import frappe from 'frappejs';
|
|||||||
import Row from '@/components/Row';
|
import Row from '@/components/Row';
|
||||||
import ListCell from './ListCell';
|
import ListCell from './ListCell';
|
||||||
import Avatar from '@/components/Avatar';
|
import Avatar from '@/components/Avatar';
|
||||||
import { openQuickEdit } from '@/utils';
|
import { openQuickEdit, routeTo } from '@/utils';
|
||||||
import Button from '@/components/Button';
|
import Button from '@/components/Button';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -108,7 +108,7 @@ export default {
|
|||||||
},
|
},
|
||||||
openForm(doc) {
|
openForm(doc) {
|
||||||
if (this.listConfig.formRoute) {
|
if (this.listConfig.formRoute) {
|
||||||
this.$router.push(this.listConfig.formRoute(doc.name));
|
routeTo(this.listConfig.formRoute(doc.name));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
openQuickEdit({
|
openQuickEdit({
|
||||||
|
@ -35,6 +35,7 @@ import List from './List';
|
|||||||
import listConfigs from './listConfig';
|
import listConfigs from './listConfig';
|
||||||
// import Icon from '@/components/Icon';
|
// import Icon from '@/components/Icon';
|
||||||
import FilterDropdown from '@/components/FilterDropdown';
|
import FilterDropdown from '@/components/FilterDropdown';
|
||||||
|
import { routeTo } from '@/utils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ListView',
|
name: 'ListView',
|
||||||
@ -63,7 +64,7 @@ export default {
|
|||||||
doc.set(this.filters);
|
doc.set(this.filters);
|
||||||
}
|
}
|
||||||
let path = this.getFormPath(doc.name);
|
let path = this.getFormPath(doc.name);
|
||||||
this.$router.push(path);
|
routeTo(path);
|
||||||
doc.on('afterInsert', () => {
|
doc.on('afterInsert', () => {
|
||||||
let path = this.getFormPath(doc.name);
|
let path = this.getFormPath(doc.name);
|
||||||
this.$router.replace(path);
|
this.$router.replace(path);
|
||||||
|
@ -2,7 +2,6 @@ import frappe from 'frappejs';
|
|||||||
import { openSettings } from '@/utils';
|
import { openSettings } from '@/utils';
|
||||||
import { _ } from 'frappejs/utils';
|
import { _ } from 'frappejs/utils';
|
||||||
import Icon from './components/Icon';
|
import Icon from './components/Icon';
|
||||||
import router from './router';
|
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
getTitle: async () => {
|
getTitle: async () => {
|
||||||
@ -23,9 +22,7 @@ const config = {
|
|||||||
{
|
{
|
||||||
title: _('Sales'),
|
title: _('Sales'),
|
||||||
icon: getIcon('sales'),
|
icon: getIcon('sales'),
|
||||||
action() {
|
route: '/list/SalesInvoice',
|
||||||
router.push('/list/SalesInvoice');
|
|
||||||
},
|
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
label: _('Invoices'),
|
label: _('Invoices'),
|
||||||
@ -57,9 +54,7 @@ const config = {
|
|||||||
{
|
{
|
||||||
title: _('Purchases'),
|
title: _('Purchases'),
|
||||||
icon: getIcon('purchase'),
|
icon: getIcon('purchase'),
|
||||||
action() {
|
route: '/list/PurchaseInvoice',
|
||||||
router.push('/list/PurchaseInvoice');
|
|
||||||
},
|
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
label: _('Bills'),
|
label: _('Bills'),
|
||||||
@ -91,9 +86,7 @@ const config = {
|
|||||||
{
|
{
|
||||||
title: _('Reports'),
|
title: _('Reports'),
|
||||||
icon: getIcon('reports'),
|
icon: getIcon('reports'),
|
||||||
action() {
|
route: '/report/general-ledger',
|
||||||
router.push('/report/general-ledger');
|
|
||||||
},
|
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
label: _('General Ledger'),
|
label: _('General Ledger'),
|
||||||
@ -116,6 +109,7 @@ const config = {
|
|||||||
{
|
{
|
||||||
title: _('Setup'),
|
title: _('Setup'),
|
||||||
icon: getIcon('settings'),
|
icon: getIcon('settings'),
|
||||||
|
route: '/chart-of-accounts',
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
label: _('Chart of Accounts'),
|
label: _('Chart of Accounts'),
|
||||||
|
@ -226,7 +226,7 @@ export function getActionsForDocument(doc) {
|
|||||||
action: () =>
|
action: () =>
|
||||||
deleteDocWithPrompt(doc).then((res) => {
|
deleteDocWithPrompt(doc).then((res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
router.push(`/list/${doc.doctype}`);
|
routeTo(`/list/${doc.doctype}`);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
@ -282,3 +282,9 @@ export function getInvoiceStatus(doc) {
|
|||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function routeTo(route) {
|
||||||
|
if (route !== router.currentRoute.fullPath) {
|
||||||
|
router.push(route);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user