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

fix(ux): minor ux fixes

This commit is contained in:
18alantom 2022-12-01 14:01:23 +05:30
parent a879f04ad5
commit eaaa4caa9e
9 changed files with 54 additions and 19 deletions

View File

@ -477,10 +477,6 @@ export abstract class Invoice extends Transactional {
}
}
static getActions(fyo: Fyo): Action[] {
return getInvoiceActions(fyo);
}
getPayment(): Payment | null {
if (!this.isSubmitted) {
return null;

View File

@ -1,6 +1,8 @@
import { ListViewSettings } from 'fyo/model/types';
import { Fyo } from 'fyo';
import { Action, ListViewSettings } from 'fyo/model/types';
import { LedgerPosting } from 'models/Transactional/LedgerPosting';
import { getTransactionStatusColumn } from '../../helpers';
import { ModelNameEnum } from 'models/types';
import { getInvoiceActions, getTransactionStatusColumn } from '../../helpers';
import { Invoice } from '../Invoice/Invoice';
import { PurchaseInvoiceItem } from '../PurchaseInvoiceItem/PurchaseInvoiceItem';
@ -46,4 +48,8 @@ export class PurchaseInvoice extends Invoice {
],
};
}
static getActions(fyo: Fyo): Action[] {
return getInvoiceActions(fyo, ModelNameEnum.PurchaseInvoice);
}
}

View File

@ -1,6 +1,8 @@
import { ListViewSettings } from 'fyo/model/types';
import { Fyo } from 'fyo';
import { Action, ListViewSettings } from 'fyo/model/types';
import { LedgerPosting } from 'models/Transactional/LedgerPosting';
import { getTransactionStatusColumn } from '../../helpers';
import { ModelNameEnum } from 'models/types';
import { getInvoiceActions, getTransactionStatusColumn } from '../../helpers';
import { Invoice } from '../Invoice/Invoice';
import { SalesInvoiceItem } from '../SalesInvoiceItem/SalesInvoiceItem';
@ -46,4 +48,8 @@ export class SalesInvoice extends Invoice {
],
};
}
static getActions(fyo: Fyo): Action[] {
return getInvoiceActions(fyo, ModelNameEnum.SalesInvoice);
}
}

View File

@ -16,17 +16,28 @@ import {
import { Invoice } from './baseModels/Invoice/Invoice';
import { InvoiceStatus, ModelNameEnum } from './types';
export function getInvoiceActions(fyo: Fyo): Action[] {
export function getInvoiceActions(
fyo: Fyo,
schemaName: ModelNameEnum.SalesInvoice | ModelNameEnum.PurchaseInvoice
): Action[] {
return [
getMakePaymentAction(fyo),
getMakeStockTransferAction(fyo),
getMakeStockTransferAction(fyo, schemaName),
getLedgerLinkAction(fyo),
];
}
export function getMakeStockTransferAction(fyo: Fyo): Action {
export function getMakeStockTransferAction(
fyo: Fyo,
schemaName: ModelNameEnum.SalesInvoice | ModelNameEnum.PurchaseInvoice
): Action {
let label = fyo.t`Shipment`;
if (schemaName === ModelNameEnum.PurchaseInvoice) {
label = fyo.t`Purchase Receipt`;
}
return {
label: fyo.t`Stock Transfer`,
label,
group: fyo.t`Create`,
condition: (doc: Doc) => doc.isSubmitted && !!doc.stockNotTransferred,
action: async (doc: Doc) => {
@ -71,7 +82,7 @@ export function getLedgerLinkAction(
fyo: Fyo,
isStock: boolean = false
): Action {
let label = fyo.t`Ledger Entries`;
let label = fyo.t`Accounting Entries`;
let reportClassName = 'GeneralLedger';
if (isStock) {

View File

@ -226,4 +226,10 @@ export abstract class StockTransfer extends Transfer {
doc.backReference = undefined;
return doc;
}
static createFilters: FiltersMap = {
party: (doc: Doc) => ({
role: doc.isSales ? 'Customer' : 'Supplier',
}),
};
}

View File

@ -194,7 +194,14 @@ export class StockLedger extends Report {
const fieldtype = col.fieldtype;
const rawValue = row[fieldname] as RawValue;
const value = this.fyo.format(rawValue, fieldtype);
let value;
if (col.fieldname === 'referenceType' && typeof rawValue === 'string') {
value = this.fyo.schemaMap[rawValue]?.label ?? rawValue;
} else {
value = this.fyo.format(rawValue, fieldtype);
}
const align = isNumeric(fieldtype) ? 'right' : 'left';
const isColoured = fieldname in colouredMap;
@ -352,6 +359,7 @@ export class StockLedger extends Report {
{ label: t`None`, value: 'none' },
{ label: t`Item`, value: 'item' },
{ label: t`Location`, value: 'location' },
{ label: t`Reference`, value: 'referenceName' },
],
},
{

View File

@ -42,7 +42,7 @@
},
{
"fieldname": "costOfGoodsSold",
"label": "Cost Of Goods Sold",
"label": "Cost Of Goods Sold Acc.",
"fieldtype": "Link",
"target": "Account"
}

View File

@ -5,10 +5,11 @@
"fields": [
{
"fieldname": "location",
"label": "Dest.",
"label": "To Loc.",
"fieldtype": "Link",
"target": "Location",
"required": true
"required": true,
"create": true
}
]
}

View File

@ -5,10 +5,11 @@
"fields": [
{
"fieldname": "location",
"label": "Source",
"label": "From Loc.",
"fieldtype": "Link",
"target": "Location",
"required": true
"required": true,
"create": true
}
]
}