2
0
mirror of https://github.com/frappe/books.git synced 2024-11-08 23:00:56 +00:00

incr: set user email on created, modded

- set specific purposed payment paths in search
This commit is contained in:
18alantom 2022-05-06 12:21:58 +05:30
parent b7f0757d69
commit 58dce76d10
4 changed files with 28 additions and 2 deletions

View File

@ -40,6 +40,14 @@ export class AuthHandler {
}
}
set user(value: string) {
this.#session.user = value;
}
get user(): string {
return this.#session.user;
}
get session(): Readonly<Session> {
return { ...this.#session };
}

View File

@ -30,6 +30,7 @@ export async function initializeInstance(
await fyo.initializeAndRegister(models, regionalModels);
await setSingles(fyo);
await setCreds(fyo);
await setCurrencySymbols(fyo);
}
@ -38,6 +39,15 @@ async function setSingles(fyo: Fyo) {
await fyo.doc.getSingle(ModelNameEnum.GetStarted);
}
async function setCreds(fyo: Fyo) {
const email = (await fyo.getValue(
ModelNameEnum.AccountingSettings,
'email'
)) as string | undefined;
const user = fyo.auth.user;
fyo.auth.user = email ?? user;
}
async function setCurrencySymbols(fyo: Fyo) {
const currencies = (await fyo.db.getAll(ModelNameEnum.Currency, {
fields: ['name', 'symbol'],

View File

@ -165,6 +165,10 @@ function getListViewList(): SearchItem[] {
label: t`Sales Items`,
route: `/list/Item/for/Sales/${t`Sales Items`}`,
},
{
label: t`Sales Payments`,
route: `/list/Payment/paymentType/Receive/${t`Sales Payments`}`,
},
{
label: t`Purchase Items`,
route: `/list/Item/for/Purchases/${t`Purchase Items`}`,
@ -173,6 +177,10 @@ function getListViewList(): SearchItem[] {
label: t`Common Items`,
route: `/list/Item/for/Both/${t`Common Items`}`,
},
{
label: t`Purchase Payments`,
route: `/list/Payment/paymentType/Pay/${t`Purchase Payments`}`,
},
].map((i) => ({ ...i, group: 'List' } as SearchItem));
return [standardLists, filteredLists].flat();

View File

@ -55,7 +55,7 @@ function getCompleteSidebar(): SidebarConfig {
schemaName: 'SalesInvoice',
},
{
label: t`Payments`,
label: t`Sales Payments`,
name: 'payments',
route: '/list/Payment/paymentType/Receive',
schemaName: 'Payment',
@ -87,7 +87,7 @@ function getCompleteSidebar(): SidebarConfig {
schemaName: 'PurchaseInvoice',
},
{
label: t`Payments`,
label: t`Purchase Payments`,
name: 'payments',
route: '/list/Payment/paymentType/Pay',
schemaName: 'Payment',