2
0
mirror of https://github.com/frappe/books.git synced 2024-12-22 19:09:01 +00:00

incr: add window controls

- minor fixes
This commit is contained in:
18alantom 2022-04-29 00:27:10 +05:30
parent a2cd1bac21
commit ecfae41635
10 changed files with 38 additions and 23 deletions

View File

@ -348,7 +348,9 @@ export default class DatabaseCore extends DatabaseBase {
} }
async #removeColumns(schemaName: string, targetColumns: string[]) { async #removeColumns(schemaName: string, targetColumns: string[]) {
const fields = this.schemaMap[schemaName]?.fields.map((f) => f.fieldname); const fields = this.schemaMap[schemaName]?.fields
.filter((f) => f.fieldtype !== FieldTypeEnum.Table)
.map((f) => f.fieldname);
const tableRows = await this.getAll(schemaName, { fields }); const tableRows = await this.getAll(schemaName, { fields });
this.prestigeTheTable(schemaName, tableRows); this.prestigeTheTable(schemaName, tableRows);
} }

View File

@ -177,11 +177,13 @@ export class Doc extends Observable<DocValue | Doc[]> {
async setMultiple(docValueMap: DocValueMap): Promise<boolean> { async setMultiple(docValueMap: DocValueMap): Promise<boolean> {
let hasSet = false; let hasSet = false;
for (const fieldname in docValueMap) { for (const fieldname in docValueMap) {
hasSet ||= await this.set( const isSet = await this.set(
fieldname, fieldname,
docValueMap[fieldname] as DocValue | Doc[] docValueMap[fieldname] as DocValue | Doc[]
); );
hasSet ||= isSet;
} }
return hasSet; return hasSet;
} }

View File

@ -107,7 +107,7 @@ export class Party extends Doc {
static getActions(fyo: Fyo): Action[] { static getActions(fyo: Fyo): Action[] {
return [ return [
{ {
label: fyo.t`Create Bill`, label: fyo.t`Create Purchase`,
condition: (doc: Doc) => condition: (doc: Doc) =>
!doc.notInserted && (doc.role as PartyRole) !== 'Customer', !doc.notInserted && (doc.role as PartyRole) !== 'Customer',
action: async (partyDoc, router) => { action: async (partyDoc, router) => {
@ -125,7 +125,7 @@ export class Party extends Doc {
}, },
}, },
{ {
label: fyo.t`View Bills`, label: fyo.t`View Purchases`,
condition: (doc: Doc) => condition: (doc: Doc) =>
!doc.notInserted && (doc.role as PartyRole) !== 'Customer', !doc.notInserted && (doc.role as PartyRole) !== 'Customer',
action: async (partyDoc, router) => { action: async (partyDoc, router) => {
@ -142,7 +142,7 @@ export class Party extends Doc {
}, },
}, },
{ {
label: fyo.t`Create Invoice`, label: fyo.t`Create Sale`,
condition: (doc: Doc) => condition: (doc: Doc) =>
!doc.notInserted && (doc.role as PartyRole) !== 'Supplier', !doc.notInserted && (doc.role as PartyRole) !== 'Supplier',
action: async (partyDoc, router) => { action: async (partyDoc, router) => {
@ -160,7 +160,7 @@ export class Party extends Doc {
}, },
}, },
{ {
label: fyo.t`View Invoices`, label: fyo.t`View Sales`,
condition: (doc: Doc) => condition: (doc: Doc) =>
!doc.notInserted && (doc.role as PartyRole) !== 'Supplier', !doc.notInserted && (doc.role as PartyRole) !== 'Supplier',
action: async (partyDoc, router) => { action: async (partyDoc, router) => {

View File

@ -142,12 +142,6 @@
"fieldtype": "Check" "fieldtype": "Check"
} }
], ],
"quickEditFields": [ "quickEditFields": ["name", "rootType", "parentAccount", "accountType"],
"name",
"rootType",
"parentAccount",
"accountType",
"isGroup"
],
"keywordFields": ["name", "rootType", "accountType"] "keywordFields": ["name", "rootType", "accountType"]
} }

View File

@ -4,12 +4,13 @@
class="h-screen flex flex-col font-sans overflow-hidden antialiased" class="h-screen flex flex-col font-sans overflow-hidden antialiased"
> >
<WindowsTitleBar v-if="platform === 'Windows'" /> <WindowsTitleBar v-if="platform === 'Windows'" />
<!-- Main Contents -->
<Desk <Desk
class="flex-1" class="flex-1"
v-if="activeScreen === 'Desk'" v-if="activeScreen === 'Desk'"
@change-db-file="changeDbFile" @change-db-file="changeDbFile"
/> />
<DatabaseSelector <DatabaseSelector
v-if="activeScreen === 'DatabaseSelector'" v-if="activeScreen === 'DatabaseSelector'"
@file-selected="fileSelected" @file-selected="fileSelected"
@ -19,6 +20,8 @@
@setup-complete="setupComplete" @setup-complete="setupComplete"
@setup-canceled="changeDbFile" @setup-canceled="changeDbFile"
/> />
<!-- Render target for toasts -->
<div <div
id="toast-container" id="toast-container"
class="absolute bottom-0 flex flex-col items-end mb-3 pr-6" class="absolute bottom-0 flex flex-col items-end mb-3 pr-6"
@ -26,6 +29,8 @@
> >
<div id="toast-target" /> <div id="toast-target" />
</div> </div>
<!-- Prompt to Set Telemetry -->
<TelemetryModal /> <TelemetryModal />
</div> </div>
</template> </template>
@ -35,7 +40,7 @@ import { ConfigKeys } from 'fyo/core/types';
import { import {
getSetupComplete, getSetupComplete,
incrementOpenCount, incrementOpenCount,
startTelemetry, startTelemetry
} from 'src/utils/misc'; } from 'src/utils/misc';
import TelemetryModal from './components/once/TelemetryModal.vue'; import TelemetryModal from './components/once/TelemetryModal.vue';
import WindowsTitleBar from './components/WindowsTitleBar.vue'; import WindowsTitleBar from './components/WindowsTitleBar.vue';

View File

@ -143,8 +143,10 @@ export default {
this.fetchAccounts(); this.fetchAccounts();
}, },
async activated() { async activated() {
window.coa = this;
this.fetchAccounts(); this.fetchAccounts();
if (fyo.store.isDevelopment) {
window.coa = this;
}
}, },
methods: { methods: {
async fetchAccounts() { async fetchAccounts() {
@ -158,7 +160,7 @@ export default {
this.accounts = await this.getChildren(); this.accounts = await this.getChildren();
}, },
onClick(account) { onClick(account) {
if (account.isGroup === 0) { if (!account.isGroup) {
openQuickEdit({ openQuickEdit({
schemaName: ModelNameEnum.Account, schemaName: ModelNameEnum.Account,
name: account.name, name: account.name,

View File

@ -86,7 +86,7 @@ export default {
data: () => ({ data: () => ({
invoices: [ invoices: [
{ {
title: t`Invoices`, title: t`Sales Invoices`,
doctype: 'SalesInvoice', doctype: 'SalesInvoice',
total: 0, total: 0,
unpaid: 0, unpaid: 0,
@ -97,7 +97,7 @@ export default {
barWidth: 40, barWidth: 40,
}, },
{ {
title: t`Bills`, title: t`Purchase Invoices`,
doctype: 'PurchaseInvoice', doctype: 'PurchaseInvoice',
total: 0, total: 0,
unpaid: 0, unpaid: 0,

View File

@ -6,6 +6,7 @@
'window-drag': platform !== 'Windows', 'window-drag': platform !== 'Windows',
}" }"
> >
<WindowControls v-if="platform === 'Mac'" class="absolute top-6 left-5" />
<div <div
class="w-full w-600 shadow rounded-lg border relative" class="w-full w-600 shadow rounded-lg border relative"
style="height: 700px" style="height: 700px"
@ -140,6 +141,7 @@ import fs from 'fs';
import { cloneDeep } from 'lodash'; import { cloneDeep } from 'lodash';
import { DateTime } from 'luxon'; import { DateTime } from 'luxon';
import LanguageSelector from 'src/components/Controls/LanguageSelector.vue'; import LanguageSelector from 'src/components/Controls/LanguageSelector.vue';
import WindowControls from 'src/components/WindowControls.vue';
import { fyo } from 'src/initFyo'; import { fyo } from 'src/initFyo';
import { getSavePath } from 'src/utils/ipcCalls'; import { getSavePath } from 'src/utils/ipcCalls';
import { IPC_ACTIONS } from 'utils/messages'; import { IPC_ACTIONS } from 'utils/messages';
@ -205,6 +207,6 @@ export default {
this.$emit('file-selected', filePath, !!isNew); this.$emit('file-selected', filePath, !!isNew);
}, },
}, },
components: { LanguageSelector }, components: { LanguageSelector, WindowControls },
}; };
</script> </script>

View File

@ -2,6 +2,8 @@
<div <div
class="py-10 flex-1 bg-white flex justify-center items-center window-drag" class="py-10 flex-1 bg-white flex justify-center items-center window-drag"
> >
<WindowControls v-if="platform === 'Mac'" class="absolute top-6 left-5" />
<!-- 0: Language Selection Slide --> <!-- 0: Language Selection Slide -->
<Slide <Slide
@primary-clicked="handlePrimary" @primary-clicked="handlePrimary"
@ -95,6 +97,7 @@ import { ipcRenderer } from 'electron';
import FormControl from 'src/components/Controls/FormControl.vue'; import FormControl from 'src/components/Controls/FormControl.vue';
import LanguageSelector from 'src/components/Controls/LanguageSelector.vue'; import LanguageSelector from 'src/components/Controls/LanguageSelector.vue';
import TwoColumnForm from 'src/components/TwoColumnForm'; import TwoColumnForm from 'src/components/TwoColumnForm';
import WindowControls from 'src/components/WindowControls.vue';
import { fyo } from 'src/initFyo'; import { fyo } from 'src/initFyo';
import { getErrorMessage } from 'src/utils'; import { getErrorMessage } from 'src/utils';
import { getSetupWizardDoc } from 'src/utils/misc'; import { getSetupWizardDoc } from 'src/utils/misc';
@ -125,6 +128,7 @@ export default {
FormControl, FormControl,
Slide, Slide,
LanguageSelector, LanguageSelector,
WindowControls,
}, },
async mounted() { async mounted() {
if (fyo.config.get('language') !== undefined) { if (fyo.config.get('language') !== undefined) {

View File

@ -57,7 +57,11 @@ describe('setupInstance', function () {
dbValue = dbValue.toISOString().split('T')[0]; dbValue = dbValue.toISOString().split('T')[0];
} }
assert.strictEqual(dbValue as string, optionsValue, `${field} mismatch`); assert.strictEqual(
dbValue as string,
optionsValue,
`${field} mismatch (${dbValue},${optionsValue})`
);
} }
}); });