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[]) {
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 });
this.prestigeTheTable(schemaName, tableRows);
}

View File

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

View File

@ -107,7 +107,7 @@ export class Party extends Doc {
static getActions(fyo: Fyo): Action[] {
return [
{
label: fyo.t`Create Bill`,
label: fyo.t`Create Purchase`,
condition: (doc: Doc) =>
!doc.notInserted && (doc.role as PartyRole) !== 'Customer',
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) =>
!doc.notInserted && (doc.role as PartyRole) !== 'Customer',
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) =>
!doc.notInserted && (doc.role as PartyRole) !== 'Supplier',
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) =>
!doc.notInserted && (doc.role as PartyRole) !== 'Supplier',
action: async (partyDoc, router) => {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,6 +2,8 @@
<div
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 -->
<Slide
@primary-clicked="handlePrimary"
@ -95,6 +97,7 @@ import { ipcRenderer } from 'electron';
import FormControl from 'src/components/Controls/FormControl.vue';
import LanguageSelector from 'src/components/Controls/LanguageSelector.vue';
import TwoColumnForm from 'src/components/TwoColumnForm';
import WindowControls from 'src/components/WindowControls.vue';
import { fyo } from 'src/initFyo';
import { getErrorMessage } from 'src/utils';
import { getSetupWizardDoc } from 'src/utils/misc';
@ -125,6 +128,7 @@ export default {
FormControl,
Slide,
LanguageSelector,
WindowControls,
},
async mounted() {
if (fyo.config.get('language') !== undefined) {

View File

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