mirror of
https://github.com/frappe/books.git
synced 2024-11-09 23:30:56 +00:00
fix(ux): minor ux fixes
This commit is contained in:
parent
a879f04ad5
commit
eaaa4caa9e
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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',
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
@ -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' },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -42,7 +42,7 @@
|
||||
},
|
||||
{
|
||||
"fieldname": "costOfGoodsSold",
|
||||
"label": "Cost Of Goods Sold",
|
||||
"label": "Cost Of Goods Sold Acc.",
|
||||
"fieldtype": "Link",
|
||||
"target": "Account"
|
||||
}
|
||||
|
@ -5,10 +5,11 @@
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "location",
|
||||
"label": "Dest.",
|
||||
"label": "To Loc.",
|
||||
"fieldtype": "Link",
|
||||
"target": "Location",
|
||||
"required": true
|
||||
"required": true,
|
||||
"create": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -5,10 +5,11 @@
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "location",
|
||||
"label": "Source",
|
||||
"label": "From Loc.",
|
||||
"fieldtype": "Link",
|
||||
"target": "Location",
|
||||
"required": true
|
||||
"required": true,
|
||||
"create": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user