fix: import bugs

This commit is contained in:
Ahmed Bouhuolia
2025-12-18 21:21:54 +02:00
parent 8a2a8eed3b
commit 58f609353c
26 changed files with 297 additions and 106 deletions

View File

@@ -3,6 +3,7 @@
"field.description": "Description",
"field.slug": "Account slug",
"field.code": "Account code",
"field.code_hint": "Unique number to identify the account.",
"field.root_type": "Root type",
"field.normal": "Account normal",
"field.normal.credit": "Credit",
@@ -13,5 +14,6 @@
"field.balance": "Balance",
"field.bank_balance": "Bank Balance",
"field.parent_account": "Parent Account",
"field.created_at": "Created at"
"field.created_at": "Created at",
"field.account_hint": "Matches the account name or code."
}

View File

@@ -0,0 +1,27 @@
{
"field.vendor": "Vendor",
"field.bill_number": "Bill No.",
"field.bill_date": "Date",
"field.due_date": "Due Date",
"field.reference_no": "Reference No.",
"field.exchange_rate": "Exchange Rate",
"field.note": "Note",
"field.open": "Open",
"field.entries": "Entries",
"field.item": "Item",
"field.item_hint": "Matches the item name or code.",
"field.rate": "Rate",
"field.quantity": "Quantity",
"field.description": "Line Description",
"field.amount": "Amount",
"field.payment_amount": "Payment Amount",
"field.status": "Status",
"field.status.paid": "Paid",
"field.status.partially-paid": "Partially Paid",
"field.status.overdue": "Overdue",
"field.status.unpaid": "Unpaid",
"field.status.opened": "Opened",
"field.status.draft": "Draft",
"field.created_at": "Created At"
}

View File

@@ -0,0 +1,15 @@
{
"field.vendor": "Vendor",
"field.payment_date": "Payment Date",
"field.payment_number": "Payment No.",
"field.payment_account": "Payment Account",
"field.exchange_rate": "Exchange Rate",
"field.note": "Note",
"field.reference": "Reference",
"field.entries": "Entries",
"field.entries.bill": "Bill",
"field.entries.payment_amount": "Payment Amount",
"field.payment_number_hint": "The payment number should be unique.",
"field.bill_hint": "Matches the bill number."
}

View File

@@ -0,0 +1,16 @@
{
"field.customer": "Customer",
"field.exchange_rate": "Exchange Rate",
"field.credit_note_date": "Credit Note Date",
"field.reference_no": "Reference No.",
"field.note": "Note",
"field.terms_conditions": "Terms & Conditions",
"field.credit_note_number": "Credit Note Number",
"field.open": "Open",
"field.entries": "Entries",
"field.item": "Item",
"field.rate": "Rate",
"field.quantity": "Quantity",
"field.description": "Description"
}

View File

@@ -0,0 +1,21 @@
{
"field.customer": "Customer",
"field.estimate_date": "Estimate Date",
"field.expiration_date": "Expiration Date",
"field.estimate_number": "Estimate No.",
"field.reference_no": "Reference No.",
"field.exchange_rate": "Exchange Rate",
"field.currency": "Currency",
"field.note": "Note",
"field.terms_conditions": "Terms & Conditions",
"field.delivered": "Delivered",
"field.entries": "Entries",
"field.amount": "Amount",
"field.status": "Status",
"field.status.draft": "Draft",
"field.status.delivered": "Delivered",
"field.status.rejected": "Rejected",
"field.status.approved": "Approved",
"field.created_at": "Created At"
}

View File

@@ -26,6 +26,7 @@
"field.due_amount": "Due amount",
"field.delivered": "Delivered",
"field.item_name": "Item Name",
"field.item_hint": "Matches the item name or code.",
"field.rate": "Rate",
"field.quantity": "Quantity",
"field.description": "Description",
@@ -38,5 +39,7 @@
"field.status.draft": "Draft",
"field.created_at": "Created at",
"field.currency": "Currency",
"field.entries": "Entries"
"field.entries": "Entries",
"field.branch": "Branch",
"field.warehouse": "Warehouse"
}

View File

@@ -17,6 +17,7 @@
"field.quantity_on_hand": "Quantity on Hand",
"field.note": "Note",
"field.category": "Category",
"field.category_hint": "Matches the category name.",
"field.active": "Active",
"field.created_at": "Created At"
}

View File

@@ -0,0 +1,17 @@
{
"field.customer": "Customer",
"field.payment_date": "Payment Date",
"field.amount": "Amount",
"field.reference_no": "Reference No.",
"field.deposit_account": "Deposit Account",
"field.payment_receive_no": "Payment No.",
"field.statement": "Statement",
"field.entries": "Entries",
"field.exchange_rate": "Exchange Rate",
"field.invoice": "Invoice",
"field.entries.payment_amount": "Payment Amount",
"field.created_at": "Created At",
"field.payment_no_hint": "The payment number should be unique.",
"field.invoice_hint": "Matches the invoice number."
}

View File

@@ -10,5 +10,21 @@
"paper.receipt_amount": "Receipt amount",
"paper.total": "Total",
"paper.balance_due": "Balance Due",
"paper.payment_amount": "Payment Amount"
"paper.payment_amount": "Payment Amount",
"field.receipt_date": "Receipt Date",
"field.customer": "Customer",
"field.deposit_account": "Deposit Account",
"field.exchange_rate": "Exchange Rate",
"field.receipt_number": "Receipt Number",
"field.reference_no": "Reference No.",
"field.closed": "Closed",
"field.entries": "Entries",
"field.statement": "Statement",
"field.receipt_message": "Receipt Message",
"field.amount": "Amount",
"field.status": "Status",
"field.status.draft": "Draft",
"field.status.closed": "Closed",
"field.created_at": "Created At"
}

View File

@@ -2,5 +2,18 @@
"view.draft": "Draft",
"view.published": "Published",
"view.open": "Open",
"view.closed": "Closed"
"view.closed": "Closed",
"field.vendor": "Vendor",
"field.vendor_credit_number": "Vendor Credit No.",
"field.vendor_credit_date": "Vendor Credit Date",
"field.reference_no": "Reference No.",
"field.exchange_rate": "Exchange Rate",
"field.note": "Note",
"field.open": "Open",
"field.entries": "Entries",
"field.item": "Item",
"field.rate": "Rate",
"field.quantity": "Quantity",
"field.description": "Description"
}

View File

@@ -156,7 +156,7 @@ export const AccountMeta = {
minLength: 3,
maxLength: 6,
unique: true,
importHint: 'Unique number to identify the account.',
importHint: 'account.field.code_hint',
},
accountType: {
name: 'account.field.type',

View File

@@ -167,7 +167,7 @@ export const BillPaymentMeta = {
name: 'bill_payment.field.payment_number',
fieldType: 'text',
unique: true,
importHint: 'The payment number should be unique.',
importHint: 'bill_payment.field.payment_number_hint',
},
paymentAccountId: {
name: 'bill_payment.field.payment_account',
@@ -175,7 +175,7 @@ export const BillPaymentMeta = {
relationModel: 'Account',
relationImportMatch: ['name', 'code'],
required: true,
importHint: 'Matches the account name or code.',
importHint: 'account.field.account_hint',
},
exchangeRate: {
name: 'bill_payment.field.exchange_rate',
@@ -203,7 +203,7 @@ export const BillPaymentMeta = {
relationModel: 'Bill',
relationImportMatch: 'billNumber',
required: true,
importHint: 'Matches the bill number.',
importHint: 'bill_payment.field.bill_hint',
},
paymentAmount: {
name: 'bill_payment.field.entries.payment_amount',
@@ -213,7 +213,7 @@ export const BillPaymentMeta = {
},
},
branchId: {
name: 'Branch',
name: 'invoice.field.branch',
fieldType: 'relation',
relationModel: 'Branch',
relationImportMatch: ['name', 'code'],

View File

@@ -184,76 +184,76 @@ export const BillMeta = {
},
fields2: {
billNumber: {
name: 'Bill No.',
name: 'bill.field.bill_number',
fieldType: 'text',
required: true,
},
referenceNo: {
name: 'Reference No.',
name: 'bill.field.reference_no',
fieldType: 'text',
},
billDate: {
name: 'Date',
name: 'bill.field.bill_date',
fieldType: 'date',
required: true,
},
dueDate: {
name: 'Due Date',
name: 'bill.field.due_date',
fieldType: 'date',
required: true,
},
vendorId: {
name: 'Vendor',
name: 'bill.field.vendor',
fieldType: 'relation',
relationModel: 'Contact',
relationImportMatch: 'displayName',
required: true,
},
exchangeRate: {
name: 'Exchange Rate',
name: 'bill.field.exchange_rate',
fieldType: 'number',
},
note: {
name: 'Note',
name: 'bill.field.note',
fieldType: 'text',
},
open: {
name: 'Open',
name: 'bill.field.open',
fieldType: 'boolean',
},
entries: {
name: 'Entries',
name: 'bill.field.entries',
fieldType: 'collection',
collectionOf: 'object',
collectionMinLength: 1,
required: true,
fields: {
itemId: {
name: 'Item',
name: 'bill.field.item',
fieldType: 'relation',
relationModel: 'Item',
relationImportMatch: ['name', 'code'],
required: true,
importHint: 'Matches the item name or code.',
importHint: 'bill.field.item_hint',
},
rate: {
name: 'Rate',
name: 'bill.field.rate',
fieldType: 'number',
required: true,
},
quantity: {
name: 'Quantity',
name: 'bill.field.quantity',
fieldType: 'number',
required: true,
},
description: {
name: 'Line Description',
name: 'bill.field.description',
fieldType: 'text',
},
},
},
branchId: {
name: 'Branch',
name: 'invoice.field.branch',
fieldType: 'relation',
relationModel: 'Branch',
relationImportMatch: ['name', 'code'],
@@ -261,7 +261,7 @@ export const BillMeta = {
required: true,
},
warehouseId: {
name: 'Warehouse',
name: 'invoice.field.warehouse',
fieldType: 'relation',
relationModel: 'Warehouse',
relationImportMatch: ['name', 'code'],

View File

@@ -164,73 +164,73 @@ export const CreditNoteMeta = {
},
fields2: {
customerId: {
name: 'Customer',
name: 'credit_note.field.customer',
fieldType: 'relation',
relationModel: 'Contact',
relationImportMatch: 'displayName',
required: true,
},
exchangeRate: {
name: 'Exchange Rate',
name: 'credit_note.field.exchange_rate',
fieldType: 'number',
},
creditNoteDate: {
name: 'Credit Note Date',
name: 'credit_note.field.credit_note_date',
fieldType: 'date',
required: true,
},
referenceNo: {
name: 'Reference No.',
name: 'credit_note.field.reference_no',
fieldType: 'text',
},
note: {
name: 'Note',
name: 'credit_note.field.note',
fieldType: 'text',
},
termsConditions: {
name: 'Terms & Conditions',
name: 'credit_note.field.terms_conditions',
fieldType: 'text',
},
creditNoteNumber: {
name: 'Credit Note Number',
name: 'credit_note.field.credit_note_number',
fieldType: 'text',
},
open: {
name: 'Open',
name: 'credit_note.field.open',
fieldType: 'boolean',
},
entries: {
name: 'Entries',
name: 'credit_note.field.entries',
fieldType: 'collection',
collectionOf: 'object',
collectionMinLength: 1,
fields: {
itemId: {
name: 'Item',
name: 'credit_note.field.item',
fieldType: 'relation',
relationModel: 'Item',
relationImportMatch: ['name', 'code'],
required: true,
importHint: 'Matches the item name or code.',
importHint: 'invoice.field.item_hint',
},
rate: {
name: 'Rate',
name: 'credit_note.field.rate',
fieldType: 'number',
required: true,
},
quantity: {
name: 'Quantity',
name: 'credit_note.field.quantity',
fieldType: 'number',
required: true,
},
description: {
name: 'Description',
name: 'credit_note.field.description',
fieldType: 'text',
},
},
},
branchId: {
name: 'Branch',
name: 'invoice.field.branch',
fieldType: 'relation',
relationModel: 'Branch',
relationImportMatch: ['name', 'code'],
@@ -238,7 +238,7 @@ export const CreditNoteMeta = {
required: true,
},
warehouseId: {
name: 'Warehouse',
name: 'invoice.field.warehouse',
fieldType: 'relation',
relationModel: 'Warehouse',
relationImportMatch: ['name', 'code'],

View File

@@ -135,7 +135,7 @@ export const ExpenseMeta = {
relationModel: 'Account',
relationImportMatch: ['name', 'code'],
required: true,
importHint: 'Matches the account name or code.',
importHint: 'account.field.account_hint',
},
referenceNo: {
name: 'expense.field.reference_no',
@@ -169,7 +169,7 @@ export const ExpenseMeta = {
relationModel: 'Account',
relationImportMatch: ['name', 'code'],
required: true,
importHint: 'Matches the account name or code.',
importHint: 'account.field.account_hint',
},
amount: {
name: 'expense.field.amount',
@@ -187,7 +187,7 @@ export const ExpenseMeta = {
fieldType: 'boolean',
},
branchId: {
name: 'Branch',
name: 'invoice.field.branch',
fieldType: 'relation',
relationModel: 'Branch',
relationImportMatch: ['name', 'code'],

View File

@@ -19,7 +19,8 @@ export class ImportFileDataValidator {
/**
* Validates the given mapped DTOs and returns errors with their index.
* @param {Record<string, any>} mappedDTOs
* @param {ResourceMetaFieldsMap} importableFields - Already localized fields from ResourceService
* @param {Record<string, any>} data
* @returns {Promise<void | ImportInsertError[]>}
*/
public async validateData(

View File

@@ -24,7 +24,7 @@ export class ImportFileUploadService {
@Inject(ImportModel.name)
private readonly importModel: typeof ImportModel,
) {}
) { }
/**
* Imports the specified file for the given resource.

View File

@@ -267,28 +267,28 @@ export const ItemMeta = {
fieldType: 'relation',
relationModel: 'Account',
relationImportMatch: ['name', 'code'],
importHint: 'Matches the account name or code.',
importHint: 'account.field.account_hint',
},
sellAccountId: {
name: 'item.field.sell_account',
fieldType: 'relation',
relationModel: 'Account',
relationImportMatch: ['name', 'code'],
importHint: 'Matches the account name or code.',
importHint: 'account.field.account_hint',
},
inventoryAccountId: {
name: 'item.field.inventory_account',
fieldType: 'relation',
relationModel: 'Account',
relationImportMatch: ['name', 'code'],
importHint: 'Matches the account name or code.',
importHint: 'account.field.account_hint',
},
sellDescription: {
name: 'Sell Description',
name: 'item.field.sell_description',
fieldType: 'text',
},
purchaseDescription: {
name: 'Purchase Description',
name: 'item.field.purchase_description',
fieldType: 'text',
},
note: {
@@ -300,7 +300,7 @@ export const ItemMeta = {
fieldType: 'relation',
relationModel: 'ItemCategory',
relationImportMatch: ['name'],
importHint: 'Matches the category name.',
importHint: 'item.field.category_hint',
},
active: {
name: 'item.field.active',

View File

@@ -165,12 +165,12 @@ export const PaymentReceivedMeta = {
relationModel: 'Account',
relationImportMatch: ['name', 'code'],
required: true,
importHint: 'Matches the account name or code.',
importHint: 'account.field.account_hint',
},
paymentReceiveNo: {
name: 'payment_receive.field.payment_receive_no',
fieldType: 'text',
importHint: 'The payment number should be unique.',
importHint: 'payment_receive.field.payment_no_hint',
},
statement: {
name: 'payment_receive.field.statement',
@@ -189,7 +189,7 @@ export const PaymentReceivedMeta = {
relationModel: 'SaleInvoice',
relationImportMatch: 'invoiceNo',
required: true,
importHint: 'Matches the invoice number.',
importHint: 'payment_receive.field.invoice_hint',
},
paymentAmount: {
name: 'payment_receive.field.entries.payment_amount',
@@ -199,7 +199,7 @@ export const PaymentReceivedMeta = {
},
},
branchId: {
name: 'Branch',
name: 'invoice.field.branch',
fieldType: 'relation',
relationModel: 'Branch',
relationImportMatch: ['name', 'code'],

View File

@@ -1,5 +1,6 @@
import { ModuleRef } from '@nestjs/core';
import { pickBy } from 'lodash';
import { pickBy, mapValues } from 'lodash';
import { I18nService } from 'nestjs-i18n';
import { WarehousesSettings } from '../Warehouses/WarehousesSettings';
import { Injectable } from '@nestjs/common';
import { BranchesSettingsService } from '../Branches/BranchesSettings';
@@ -20,7 +21,8 @@ export class ResourceService {
private readonly branchesSettings: BranchesSettingsService,
private readonly warehousesSettings: WarehousesSettings,
private readonly moduleRef: ModuleRef,
) {}
private readonly i18nService: I18nService,
) { }
/**
* Retrieve resource model object.
@@ -96,7 +98,45 @@ export class ResourceService {
};
/**
* Retrieve the resource fields.
* Localizes a single field by translating its name and importHint.
* @param {IModelMetaField2} field - The field to localize.
* @returns {IModelMetaField2} - The localized field.
*/
private localizeField(field: IModelMetaField2): IModelMetaField2 {
const localizedField = {
...field,
name: this.i18nService.t(field.name, { defaultValue: field.name }),
} as IModelMetaField2;
if (field.importHint) {
localizedField.importHint = this.i18nService.t(field.importHint, {
defaultValue: field.importHint,
});
}
// Recursively localize nested fields (for collection types)
if (field.fields) {
localizedField.fields = this.localizeFields(
field.fields as unknown as Record<string, IModelMetaField2>,
) as unknown as typeof field.fields;
}
return localizedField;
}
/**
* Localizes all fields in a fields map.
* @param {Record<string, IModelMetaField2>} fields - The fields to localize.
* @returns {Record<string, IModelMetaField2>} - The localized fields.
*/
private localizeFields(
fields: Record<string, IModelMetaField2>,
): Record<string, IModelMetaField2> {
return mapValues(fields, (field) => this.localizeField(field));
}
/**
* Retrieve the resource fields with localized names and hints.
* @param {string} modelName
* @returns {IModelMetaField2}
*/
@@ -104,8 +144,11 @@ export class ResourceService {
[key: string]: IModelMetaField2;
} {
const meta = this.getResourceMeta(modelName);
const filteredFields = this.filterSupportFeatures(meta.fields2);
return this.filterSupportFeatures(meta.fields2);
return this.localizeFields(
filteredFields as Record<string, IModelMetaField2>,
);
}
/**

View File

@@ -191,52 +191,52 @@ export const SaleEstimateMeta = {
},
fields2: {
customerId: {
name: 'Customer',
name: 'estimate.field.customer',
fieldType: 'relation',
relationModel: 'Contact',
relationImportMatch: ['displayName'],
required: true,
},
estimateDate: {
name: 'Estimate Date',
name: 'estimate.field.estimate_date',
fieldType: 'date',
required: true,
},
expirationDate: {
name: 'Expiration Date',
name: 'estimate.field.expiration_date',
fieldType: 'date',
required: true,
},
estimateNumber: {
name: 'Estimate No.',
name: 'estimate.field.estimate_number',
fieldType: 'text',
},
reference: {
name: 'Reference No.',
name: 'estimate.field.reference_no',
fieldType: 'text',
},
exchangeRate: {
name: 'Exchange Rate',
name: 'estimate.field.exchange_rate',
fieldType: 'number',
},
currencyCode: {
name: 'Currency',
name: 'estimate.field.currency',
fieldType: 'text',
},
note: {
name: 'Note',
name: 'estimate.field.note',
fieldType: 'text',
},
termsConditions: {
name: 'Terms & Conditions',
name: 'estimate.field.terms_conditions',
fieldType: 'text',
},
delivered: {
name: 'Delivered',
name: 'estimate.field.delivered',
type: 'boolean',
},
entries: {
name: 'Entries',
name: 'estimate.field.entries',
fieldType: 'collection',
collectionOf: 'object',
collectionMinLength: 1,
@@ -248,7 +248,7 @@ export const SaleEstimateMeta = {
relationModel: 'Item',
relationImportMatch: ['name', 'code'],
required: true,
importHint: 'Matches the item name or code.',
importHint: 'invoice.field.item_hint',
},
rate: {
name: 'invoice.field.rate',
@@ -261,13 +261,13 @@ export const SaleEstimateMeta = {
required: true,
},
description: {
name: 'Line Description',
name: 'invoice.field.description',
fieldType: 'text',
},
},
},
branchId: {
name: 'Branch',
name: 'invoice.field.branch',
fieldType: 'relation',
relationModel: 'Branch',
relationImportMatch: ['name', 'code'],
@@ -275,7 +275,7 @@ export const SaleEstimateMeta = {
required: true,
},
warehouseId: {
name: 'Warehouse',
name: 'invoice.field.warehouse',
fieldType: 'relation',
relationModel: 'Warehouse',
relationImportMatch: ['name', 'code'],

View File

@@ -259,7 +259,7 @@ export const SaleInvoiceMeta = {
relationModel: 'Item',
relationImportMatch: ['name', 'code'],
required: true,
importHint: 'Matches the item name or code.',
importHint: 'invoice.field.item_hint',
},
rate: {
name: 'invoice.field.rate',
@@ -283,7 +283,7 @@ export const SaleInvoiceMeta = {
printable: false,
},
branchId: {
name: 'Branch',
name: 'invoice.field.branch',
fieldType: 'relation',
relationModel: 'Branch',
relationImportMatch: ['name', 'code'],
@@ -291,7 +291,7 @@ export const SaleInvoiceMeta = {
required: true,
},
warehouseId: {
name: 'Warehouse',
name: 'invoice.field.warehouse',
fieldType: 'relation',
relationModel: 'Warehouse',
relationImportMatch: ['name', 'code'],

View File

@@ -186,42 +186,42 @@ export const SaleReceiptMeta = {
},
fields2: {
receiptDate: {
name: 'Receipt Date',
name: 'receipt.field.receipt_date',
fieldType: 'date',
required: true,
},
customerId: {
name: 'Customer',
name: 'receipt.field.customer',
fieldType: 'relation',
relationModel: 'Contact',
relationImportMatch: 'displayName',
required: true,
},
depositAccountId: {
name: 'Deposit Account',
name: 'receipt.field.deposit_account',
fieldType: 'relation',
relationModel: 'Account',
relationImportMatch: ['name', 'code'],
required: true,
},
exchangeRate: {
name: 'Exchange Rate',
name: 'receipt.field.exchange_rate',
fieldType: 'number',
},
receiptNumber: {
name: 'Receipt Number',
name: 'receipt.field.receipt_number',
fieldType: 'text',
},
referenceNo: {
name: 'Reference No.',
name: 'receipt.field.reference_no',
fieldType: 'text',
},
closed: {
name: 'Closed',
name: 'receipt.field.closed',
fieldType: 'boolean',
},
entries: {
name: 'Entries',
name: 'receipt.field.entries',
fieldType: 'collection',
collectionOf: 'object',
collectionMinLength: 1,
@@ -233,7 +233,7 @@ export const SaleReceiptMeta = {
relationModel: 'Item',
relationImportMatch: ['name', 'code'],
required: true,
importHint: 'Matches the item name or code.',
importHint: 'invoice.field.item_hint',
},
rate: {
name: 'invoice.field.rate',
@@ -252,15 +252,15 @@ export const SaleReceiptMeta = {
},
},
statement: {
name: 'Statement',
name: 'receipt.field.statement',
fieldType: 'text',
},
receiptMessage: {
name: 'Receipt Message',
name: 'receipt.field.receipt_message',
fieldType: 'text',
},
branchId: {
name: 'Branch',
name: 'invoice.field.branch',
fieldType: 'relation',
relationModel: 'Branch',
relationImportMatch: ['name', 'code'],
@@ -268,7 +268,7 @@ export const SaleReceiptMeta = {
required: true,
},
warehouseId: {
name: 'Warehouse',
name: 'invoice.field.warehouse',
fieldType: 'relation',
relationModel: 'Warehouse',
relationImportMatch: ['name', 'code'],

View File

@@ -177,70 +177,70 @@ export const VendorCreditMeta = {
},
fields2: {
vendorId: {
name: 'Vendor',
name: 'vendor_credit.field.vendor',
fieldType: 'relation',
relationModel: 'Contact',
relationImportMatch: 'displayName',
required: true,
},
exchangeRate: {
name: 'Echange Rate',
name: 'vendor_credit.field.exchange_rate',
fieldType: 'text',
},
vendorCreditNumber: {
name: 'Vendor Credit No.',
name: 'vendor_credit.field.vendor_credit_number',
fieldType: 'text',
},
referenceNo: {
name: 'Refernece No.',
name: 'vendor_credit.field.reference_no',
fieldType: 'text',
},
vendorCreditDate: {
name: 'Vendor Credit Date',
name: 'vendor_credit.field.vendor_credit_date',
fieldType: 'date',
required: true,
},
note: {
name: 'Note',
name: 'vendor_credit.field.note',
fieldType: 'text',
},
open: {
name: 'Open',
name: 'vendor_credit.field.open',
fieldType: 'boolean',
},
entries: {
name: 'Entries',
name: 'vendor_credit.field.entries',
fieldType: 'collection',
collectionOf: 'object',
collectionMinLength: 1,
required: true,
fields: {
itemId: {
name: 'Item Name',
name: 'vendor_credit.field.item',
fieldType: 'relation',
relationModel: 'Item',
relationImportMatch: ['name', 'code'],
required: true,
importHint: 'Matches the item name or code.',
importHint: 'invoice.field.item_hint',
},
rate: {
name: 'Rate',
name: 'vendor_credit.field.rate',
fieldType: 'number',
required: true,
},
quantity: {
name: 'Quantity',
name: 'vendor_credit.field.quantity',
fieldType: 'number',
required: true,
},
description: {
name: 'Description',
name: 'vendor_credit.field.description',
fieldType: 'text',
},
},
},
branchId: {
name: 'Branch',
name: 'invoice.field.branch',
fieldType: 'relation',
relationModel: 'Branch',
relationImportMatch: ['name', 'code'],
@@ -248,7 +248,7 @@ export const VendorCreditMeta = {
required: true
},
warehouseId: {
name: 'Warehouse',
name: 'invoice.field.warehouse',
fieldType: 'relation',
relationModel: 'Warehouse',
relationImportMatch: ['name', 'code'],

View File

@@ -7,6 +7,10 @@
color: #738091;
font-weight: 700;
padding: 0 11px;
:global(.bp4-dark) &{
color: var(--color-light-gray1);
}
}
.table {
@@ -24,6 +28,11 @@
padding-bottom: 8px;
color: #738091;
font-weight: 500;
:global(.bp4-dark) &{
color: var(--color-light-gray1);
border-top: 1px solid rgba(255, 255, 255, 0.2);
}
}
}

View File

@@ -7,6 +7,9 @@
border-top: 1px solid #d9d9da;
padding: 6px 0;
:global(.bp4-dark) &{
border-top-color: rgba(255, 255, 255, 0.1);
}
&:last-child{
padding-bottom: 0;
}
@@ -31,6 +34,10 @@ table.skippedTable {
tr:hover td{
background: #F6F7F9;
:global(.bp4-dark) &{
background: var(--color-dark-gray2);
}
}
}
}