mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
fix: Replace route if same doctype
This commit is contained in:
parent
7916619754
commit
945dee6836
@ -54,6 +54,7 @@ import Row from '@/components/Row';
|
|||||||
import ListCell from './ListCell';
|
import ListCell from './ListCell';
|
||||||
import Button from '@/components/Button';
|
import Button from '@/components/Button';
|
||||||
import Avatar from '@/components/Avatar';
|
import Avatar from '@/components/Avatar';
|
||||||
|
import { openQuickEdit } from '@/utils';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'List',
|
name: 'List',
|
||||||
@ -103,14 +104,9 @@ export default {
|
|||||||
this.$router.push(this.listConfig.formRoute(doc.name));
|
this.$router.push(this.listConfig.formRoute(doc.name));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let method = this.$route.query.edit ? 'replace' : 'push';
|
openQuickEdit({
|
||||||
this.$router[method]({
|
doctype: this.doctype,
|
||||||
path: `/list/${this.doctype}`,
|
name: doc.name
|
||||||
query: {
|
|
||||||
edit: 1,
|
|
||||||
doctype: this.doctype,
|
|
||||||
name: doc.name
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async updateData(filters) {
|
async updateData(filters) {
|
||||||
|
@ -128,7 +128,14 @@ export function partyWithAvatar(party) {
|
|||||||
|
|
||||||
export function openQuickEdit({ doctype, name, hideFields, defaults = {} }) {
|
export function openQuickEdit({ doctype, name, hideFields, defaults = {} }) {
|
||||||
let currentRoute = router.currentRoute;
|
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: {
|
query: {
|
||||||
edit: 1,
|
edit: 1,
|
||||||
doctype,
|
doctype,
|
||||||
|
Loading…
Reference in New Issue
Block a user