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:
parent
7916619754
commit
945dee6836
@ -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) {
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user