mirror of
https://github.com/frappe/books.git
synced 2025-01-03 15:17:30 +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 {
|
getPayment(): Payment | null {
|
||||||
if (!this.isSubmitted) {
|
if (!this.isSubmitted) {
|
||||||
return null;
|
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 { 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 { Invoice } from '../Invoice/Invoice';
|
||||||
import { PurchaseInvoiceItem } from '../PurchaseInvoiceItem/PurchaseInvoiceItem';
|
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 { 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 { Invoice } from '../Invoice/Invoice';
|
||||||
import { SalesInvoiceItem } from '../SalesInvoiceItem/SalesInvoiceItem';
|
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 { Invoice } from './baseModels/Invoice/Invoice';
|
||||||
import { InvoiceStatus, ModelNameEnum } from './types';
|
import { InvoiceStatus, ModelNameEnum } from './types';
|
||||||
|
|
||||||
export function getInvoiceActions(fyo: Fyo): Action[] {
|
export function getInvoiceActions(
|
||||||
|
fyo: Fyo,
|
||||||
|
schemaName: ModelNameEnum.SalesInvoice | ModelNameEnum.PurchaseInvoice
|
||||||
|
): Action[] {
|
||||||
return [
|
return [
|
||||||
getMakePaymentAction(fyo),
|
getMakePaymentAction(fyo),
|
||||||
getMakeStockTransferAction(fyo),
|
getMakeStockTransferAction(fyo, schemaName),
|
||||||
getLedgerLinkAction(fyo),
|
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 {
|
return {
|
||||||
label: fyo.t`Stock Transfer`,
|
label,
|
||||||
group: fyo.t`Create`,
|
group: fyo.t`Create`,
|
||||||
condition: (doc: Doc) => doc.isSubmitted && !!doc.stockNotTransferred,
|
condition: (doc: Doc) => doc.isSubmitted && !!doc.stockNotTransferred,
|
||||||
action: async (doc: Doc) => {
|
action: async (doc: Doc) => {
|
||||||
@ -71,7 +82,7 @@ export function getLedgerLinkAction(
|
|||||||
fyo: Fyo,
|
fyo: Fyo,
|
||||||
isStock: boolean = false
|
isStock: boolean = false
|
||||||
): Action {
|
): Action {
|
||||||
let label = fyo.t`Ledger Entries`;
|
let label = fyo.t`Accounting Entries`;
|
||||||
let reportClassName = 'GeneralLedger';
|
let reportClassName = 'GeneralLedger';
|
||||||
|
|
||||||
if (isStock) {
|
if (isStock) {
|
||||||
|
@ -226,4 +226,10 @@ export abstract class StockTransfer extends Transfer {
|
|||||||
doc.backReference = undefined;
|
doc.backReference = undefined;
|
||||||
return doc;
|
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 fieldtype = col.fieldtype;
|
||||||
|
|
||||||
const rawValue = row[fieldname] as RawValue;
|
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 align = isNumeric(fieldtype) ? 'right' : 'left';
|
||||||
|
|
||||||
const isColoured = fieldname in colouredMap;
|
const isColoured = fieldname in colouredMap;
|
||||||
@ -352,6 +359,7 @@ export class StockLedger extends Report {
|
|||||||
{ label: t`None`, value: 'none' },
|
{ label: t`None`, value: 'none' },
|
||||||
{ label: t`Item`, value: 'item' },
|
{ label: t`Item`, value: 'item' },
|
||||||
{ label: t`Location`, value: 'location' },
|
{ label: t`Location`, value: 'location' },
|
||||||
|
{ label: t`Reference`, value: 'referenceName' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "costOfGoodsSold",
|
"fieldname": "costOfGoodsSold",
|
||||||
"label": "Cost Of Goods Sold",
|
"label": "Cost Of Goods Sold Acc.",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"target": "Account"
|
"target": "Account"
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,11 @@
|
|||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"fieldname": "location",
|
"fieldname": "location",
|
||||||
"label": "Dest.",
|
"label": "To Loc.",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"target": "Location",
|
"target": "Location",
|
||||||
"required": true
|
"required": true,
|
||||||
|
"create": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,11 @@
|
|||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"fieldname": "location",
|
"fieldname": "location",
|
||||||
"label": "Source",
|
"label": "From Loc.",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"target": "Location",
|
"target": "Location",
|
||||||
"required": true
|
"required": true,
|
||||||
|
"create": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user