mirror of
https://github.com/frappe/books.git
synced 2025-01-03 15:17:30 +00:00
incr: add shortcuts for linked entries
- fix quickedit shortcut - most settings to tab - fix coa auto select in SetupWizard - remove sections and tabs if empty
This commit is contained in:
parent
1cc5607132
commit
202ddf829b
@ -142,7 +142,13 @@ export class SetupWizard extends Doc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const countryInfo = getCountryInfo();
|
const countryInfo = getCountryInfo();
|
||||||
return countryInfo[country]?.currency;
|
const code = countryInfo[country]?.code;
|
||||||
|
if (!code) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const coaList = getCOAList();
|
||||||
|
const coa = coaList.find(({ countryCode }) => countryCode === code);
|
||||||
|
return coa?.name ?? coaList[0].name;
|
||||||
},
|
},
|
||||||
dependsOn: ['country'],
|
dependsOn: ['country'],
|
||||||
},
|
},
|
||||||
|
@ -113,14 +113,15 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"default": "Party",
|
"default": "Party",
|
||||||
"section": "Settings"
|
"hidden": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "currency",
|
"fieldname": "currency",
|
||||||
"label": "Customer Currency",
|
"label": "Customer Currency",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"target": "Currency",
|
"target": "Currency",
|
||||||
"section": "Settings"
|
"readOnly": true,
|
||||||
|
"tab": "Settings"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "exchangeRate",
|
"fieldname": "exchangeRate",
|
||||||
@ -128,7 +129,7 @@
|
|||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"default": 1,
|
"default": 1,
|
||||||
"readOnly": true,
|
"readOnly": true,
|
||||||
"section": "Settings"
|
"tab": "Settings"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "discountAfterTax",
|
"fieldname": "discountAfterTax",
|
||||||
@ -136,7 +137,7 @@
|
|||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"default": false,
|
"default": false,
|
||||||
"readOnly": false,
|
"readOnly": false,
|
||||||
"section": "Settings"
|
"tab": "Settings"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "outstandingAmount",
|
"fieldname": "outstandingAmount",
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
<!-- Data Rows -->
|
<!-- Data Rows -->
|
||||||
<div
|
<div
|
||||||
class="overflow-auto"
|
class="overflow-auto custom-scroll"
|
||||||
:style="{ 'max-height': maxHeight }"
|
:style="{ 'max-height': maxHeight }"
|
||||||
v-if="value"
|
v-if="value"
|
||||||
>
|
>
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="p-3 d-flex align-items-center">
|
|
||||||
<indicator :color="indicatorColor" class="me-2 ms-1" />
|
|
||||||
{{ message }}
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { indicators } from '../colors';
|
|
||||||
export default {
|
|
||||||
name: 'MessageDialog',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
indicatorColor: indicators.ORANGE,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
message: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
@ -106,6 +106,10 @@ export default defineComponent({
|
|||||||
shortcut: [ShortcutKey.pmod, 'P'],
|
shortcut: [ShortcutKey.pmod, 'P'],
|
||||||
description: t`Open Print View if Print is available.`,
|
description: t`Open Print View if Print is available.`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
shortcut: [ShortcutKey.pmod, 'L'],
|
||||||
|
description: t`Toggle Linked Entries widget, not available in Quick Edit view.`,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -245,6 +245,13 @@ export default defineComponent({
|
|||||||
|
|
||||||
this.printButton?.$el.click();
|
this.printButton?.$el.click();
|
||||||
});
|
});
|
||||||
|
this.shortcuts?.pmod.set(this.context, ['KeyL'], () => {
|
||||||
|
if (!this.canShowLinks && !this.showLinks) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.showLinks = !this.showLinks;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
deactivated(): void {
|
deactivated(): void {
|
||||||
docsPathRef.value = '';
|
docsPathRef.value = '';
|
||||||
@ -298,7 +305,7 @@ export default defineComponent({
|
|||||||
return !this.doc.isCancelled && !this.doc.dirty && this.isPrintable;
|
return !this.doc.isCancelled && !this.doc.dirty && this.isPrintable;
|
||||||
},
|
},
|
||||||
canShowLinks(): boolean {
|
canShowLinks(): boolean {
|
||||||
if (!this.hasDoc || this.hasQeDoc || this.showLinks) {
|
if (!this.hasDoc || this.hasQeDoc) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,15 +162,20 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Doc } from 'fyo/model/doc';
|
import { Doc } from 'fyo/model/doc';
|
||||||
import { isPesa } from 'fyo/utils';
|
import { isPesa } from 'fyo/utils';
|
||||||
import { MovementType } from 'models/inventory/types';
|
|
||||||
import { ModelNameEnum } from 'models/types';
|
import { ModelNameEnum } from 'models/types';
|
||||||
import Button from 'src/components/Button.vue';
|
import Button from 'src/components/Button.vue';
|
||||||
import { getBgColorClass, getBgTextColorClass } from 'src/utils/colors';
|
import { getBgTextColorClass } from 'src/utils/colors';
|
||||||
import { getLinkedEntries } from 'src/utils/doc';
|
import { getLinkedEntries } from 'src/utils/doc';
|
||||||
|
import { shortcutsKey } from 'src/utils/injectionKeys';
|
||||||
import { getFormRoute, routeTo } from 'src/utils/ui';
|
import { getFormRoute, routeTo } from 'src/utils/ui';
|
||||||
import { defineComponent, PropType } from 'vue';
|
import { PropType, defineComponent, inject } from 'vue';
|
||||||
|
|
||||||
|
const COMPONENT_NAME = 'LinkedEntries';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
setup() {
|
||||||
|
return { shortcuts: inject(shortcutsKey) };
|
||||||
|
},
|
||||||
emits: ['close'],
|
emits: ['close'],
|
||||||
props: { doc: { type: Object as PropType<Doc>, required: true } },
|
props: { doc: { type: Object as PropType<Doc>, required: true } },
|
||||||
data() {
|
data() {
|
||||||
@ -183,6 +188,10 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
await this.setLinkedEntries();
|
await this.setLinkedEntries();
|
||||||
|
this.shortcuts?.set(COMPONENT_NAME, ['Escape'], () => this.$emit('close'));
|
||||||
|
},
|
||||||
|
unmounted() {
|
||||||
|
this.shortcuts?.delete(COMPONENT_NAME);
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
sequence(): string[] {
|
sequence(): string[] {
|
||||||
|
@ -178,9 +178,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
this.shortcuts.set(this.context, ['Escape'], () => {
|
this.setShortcuts();
|
||||||
this.routeToPrevious();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
if (this.defaults) {
|
if (this.defaults) {
|
||||||
@ -193,6 +191,8 @@ export default {
|
|||||||
if (fyo.store.isDevelopment) {
|
if (fyo.store.isDevelopment) {
|
||||||
window.qef = this;
|
window.qef = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setShortcuts();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isChild() {
|
isChild() {
|
||||||
@ -244,6 +244,15 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
setShortcuts() {
|
||||||
|
if (this.shortcuts.has(this.context, ['Escape'])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.shortcuts.set(this.context, ['Escape'], () => {
|
||||||
|
this.routeToPrevious();
|
||||||
|
});
|
||||||
|
},
|
||||||
async fetchFieldsAndDoc() {
|
async fetchFieldsAndDoc() {
|
||||||
if (!this.schema) {
|
if (!this.schema) {
|
||||||
return;
|
return;
|
||||||
|
@ -320,6 +320,9 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
deactivated(): void {
|
deactivated(): void {
|
||||||
docsPathRef.value = '';
|
docsPathRef.value = '';
|
||||||
|
if (this.editMode) {
|
||||||
|
this.disableEditMode();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setShortcuts() {
|
setShortcuts() {
|
||||||
|
@ -327,7 +327,7 @@ export function getFieldsGroupedByTabAndSection(
|
|||||||
): UIGroupedFields {
|
): UIGroupedFields {
|
||||||
const grouped: UIGroupedFields = new Map();
|
const grouped: UIGroupedFields = new Map();
|
||||||
for (const field of schema?.fields ?? []) {
|
for (const field of schema?.fields ?? []) {
|
||||||
const tab = field.tab ?? 'Default';
|
const tab = field.tab ?? 'Main';
|
||||||
const section = field.section ?? 'Default';
|
const section = field.section ?? 'Default';
|
||||||
if (!grouped.has(tab)) {
|
if (!grouped.has(tab)) {
|
||||||
grouped.set(tab, new Map());
|
grouped.set(tab, new Map());
|
||||||
@ -349,6 +349,26 @@ export function getFieldsGroupedByTabAndSection(
|
|||||||
tabbed.get(section)!.push(field);
|
tabbed.get(section)!.push(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete empty tabs and sections
|
||||||
|
for (const tkey of grouped.keys()) {
|
||||||
|
const section = grouped.get(tkey);
|
||||||
|
if (!section) {
|
||||||
|
grouped.delete(tkey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const skey of section.keys()) {
|
||||||
|
const fields = section.get(skey);
|
||||||
|
if (!fields || !fields.length) {
|
||||||
|
section.delete(skey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!section?.size) {
|
||||||
|
grouped.delete(tkey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return grouped;
|
return grouped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
onMounted,
|
onMounted,
|
||||||
onUnmounted,
|
onUnmounted,
|
||||||
reactive,
|
reactive,
|
||||||
ref
|
ref,
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import { getIsMac } from './misc';
|
import { getIsMac } from './misc';
|
||||||
import { Shortcuts } from './shortcuts';
|
import { Shortcuts } from './shortcuts';
|
||||||
@ -16,7 +16,7 @@ import {
|
|||||||
commonDocSync,
|
commonDocSync,
|
||||||
commongDocDelete,
|
commongDocDelete,
|
||||||
showCannotCancelOrDeleteToast,
|
showCannotCancelOrDeleteToast,
|
||||||
showCannotSaveOrSubmitToast
|
showCannotSaveOrSubmitToast,
|
||||||
} from './ui';
|
} from './ui';
|
||||||
|
|
||||||
export function useKeys() {
|
export function useKeys() {
|
||||||
|
Loading…
Reference in New Issue
Block a user