2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 11:29:00 +00:00

fix: Replace route if same doctype

This commit is contained in:
Faris Ansari 2019-12-04 22:56:17 +05:30
parent 7916619754
commit 945dee6836
2 changed files with 12 additions and 9 deletions

View File

@ -54,6 +54,7 @@ import Row from '@/components/Row';
import ListCell from './ListCell';
import Button from '@/components/Button';
import Avatar from '@/components/Avatar';
import { openQuickEdit } from '@/utils';
export default {
name: 'List',
@ -103,14 +104,9 @@ export default {
this.$router.push(this.listConfig.formRoute(doc.name));
return;
}
let method = this.$route.query.edit ? 'replace' : 'push';
this.$router[method]({
path: `/list/${this.doctype}`,
query: {
edit: 1,
doctype: this.doctype,
name: doc.name
}
openQuickEdit({
doctype: this.doctype,
name: doc.name
});
},
async updateData(filters) {

View File

@ -128,7 +128,14 @@ export function partyWithAvatar(party) {
export function openQuickEdit({ doctype, name, hideFields, defaults = {} }) {
let currentRoute = router.currentRoute;
router.push({
let query = currentRoute.query;
let method = 'push';
if (query.edit && query.doctype === doctype) {
// replace the current route if we are
// editing another document of the same doctype
method = 'replace';
}
router[method]({
query: {
edit: 1,
doctype,