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

refactor: use one schema for Customer and Supplier

This commit is contained in:
18alantom 2022-04-08 11:00:52 +05:30
parent a66e2bcc45
commit 9e71466b82
6 changed files with 90 additions and 14 deletions

View File

@ -1,7 +1,6 @@
{ {
"name": "Party", "name": "Party",
"label": "Party", "label": "Party",
"isAbstract": true,
"fields": [ "fields": [
{ {
"fieldname": "name", "fieldname": "name",
@ -15,6 +14,27 @@
"label": "Image", "label": "Image",
"fieldtype": "AttachImage" "fieldtype": "AttachImage"
}, },
{
"fieldname": "role",
"label": "Role",
"fieldtype": "Select",
"default": "Both",
"options": [
{
"value": "Both",
"label": "Both"
},
{
"value": "Supplier",
"label": "Supplier"
},
{
"value": "Customer",
"label": "Customer"
}
],
"required": true
},
{ {
"fieldname": "defaultAccount", "fieldname": "defaultAccount",
"label": "Default Account", "label": "Default Account",
@ -56,6 +76,7 @@
], ],
"quickEditFields": [ "quickEditFields": [
"email", "email",
"role",
"phone", "phone",
"address", "address",
"defaultAccount", "defaultAccount",

View File

@ -1,5 +0,0 @@
{
"name": "Supplier",
"label": "Supplier",
"extends": "Party"
}

View File

@ -5,13 +5,12 @@ import Address from './app/Address.json';
import Color from './app/Color.json'; import Color from './app/Color.json';
import CompanySettings from './app/CompanySettings.json'; import CompanySettings from './app/CompanySettings.json';
import Currency from './app/Currency.json'; import Currency from './app/Currency.json';
import Customer from './app/Customer.json';
import GetStarted from './app/GetStarted.json'; import GetStarted from './app/GetStarted.json';
import Item from './app/Item.json'; import Item from './app/Item.json';
import JournalEntry from './app/JournalEntry.json'; import JournalEntry from './app/JournalEntry.json';
import JournalEntryAccount from './app/JournalEntryAccount.json'; import JournalEntryAccount from './app/JournalEntryAccount.json';
import NumberSeries from './app/NumberSeries.json'; import NumberSeries from './app/NumberSeries.json';
import Party from './app/Party.json'; import Party from './tests/Party.json';
import Payment from './app/Payment.json'; import Payment from './app/Payment.json';
import PaymentFor from './app/PaymentFor.json'; import PaymentFor from './app/PaymentFor.json';
import PrintSettings from './app/PrintSettings.json'; import PrintSettings from './app/PrintSettings.json';
@ -21,7 +20,6 @@ import SalesInvoice from './app/SalesInvoice.json';
import SalesInvoiceItem from './app/SalesInvoiceItem.json'; import SalesInvoiceItem from './app/SalesInvoiceItem.json';
import SalesInvoiceSettings from './app/SalesInvoiceSettings.json'; import SalesInvoiceSettings from './app/SalesInvoiceSettings.json';
import SetupWizard from './app/SetupWizard.json'; import SetupWizard from './app/SetupWizard.json';
import Supplier from './app/Supplier.json';
import Tax from './app/Tax.json'; import Tax from './app/Tax.json';
import TaxDetail from './app/TaxDetail.json'; import TaxDetail from './app/TaxDetail.json';
import TaxSummary from './app/TaxSummary.json'; import TaxSummary from './app/TaxSummary.json';
@ -63,9 +61,6 @@ export const appSchemas: Schema[] | SchemaStub[] = [
AccountingLedgerEntry as Schema, AccountingLedgerEntry as Schema,
Party as Schema, Party as Schema,
Supplier as SchemaStub,
Customer as SchemaStub,
Address as Schema, Address as Schema,
Item as Schema, Item as Schema,

65
schemas/tests/Party.json Normal file
View File

@ -0,0 +1,65 @@
{
"name": "Party",
"label": "Party",
"isAbstract": true,
"fields": [
{
"fieldname": "name",
"label": "Name",
"fieldtype": "Data",
"required": true,
"placeholder": "Full Name"
},
{
"fieldname": "image",
"label": "Image",
"fieldtype": "AttachImage"
},
{
"fieldname": "defaultAccount",
"label": "Default Account",
"fieldtype": "Link",
"target": "Account"
},
{
"fieldname": "outstandingAmount",
"label": "Outstanding Amount",
"fieldtype": "Currency"
},
{
"fieldname": "currency",
"label": "Currency",
"fieldtype": "Link",
"target": "Currency",
"placeholder": "INR"
},
{
"fieldname": "email",
"label": "Email",
"fieldtype": "Data",
"placeholder": "john@doe.com"
},
{
"fieldname": "phone",
"label": "Phone",
"fieldtype": "Data",
"placeholder": "Phone"
},
{
"fieldname": "address",
"label": "Address",
"fieldtype": "Link",
"target": "Address",
"placeholder": "Click to create",
"inline": true
}
],
"quickEditFields": [
"email",
"phone",
"address",
"defaultAccount",
"currency"
],
"keywordFields": ["name"]
}

View File

@ -1,11 +1,11 @@
import { cloneDeep } from 'lodash'; import { cloneDeep } from 'lodash';
import Account from '../app/Account.json'; import Account from '../app/Account.json';
import Customer from '../app/Customer.json';
import JournalEntry from '../app/JournalEntry.json'; import JournalEntry from '../app/JournalEntry.json';
import JournalEntryAccount from '../app/JournalEntryAccount.json'; import JournalEntryAccount from '../app/JournalEntryAccount.json';
import Party from '../app/Party.json';
import PartyRegional from '../regional/in/Party.json'; import PartyRegional from '../regional/in/Party.json';
import { Schema, SchemaStub, SchemaStubMap } from '../types'; import { Schema, SchemaStub, SchemaStubMap } from '../types';
import Customer from './Customer.json';
import Party from './Party.json';
interface AppSchemaMap extends SchemaStubMap { interface AppSchemaMap extends SchemaStubMap {
Account: SchemaStub; Account: SchemaStub;