mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
feat: Customer/Supplier doctype based on Party
This commit is contained in:
parent
eb348c7210
commit
0f89720770
8
models/doctype/Party/Customer.js
Normal file
8
models/doctype/Party/Customer.js
Normal file
@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
name: 'Customer',
|
||||
label: 'Customer',
|
||||
basedOn: 'Party',
|
||||
filters: {
|
||||
customer: 1
|
||||
}
|
||||
};
|
@ -1,10 +1,7 @@
|
||||
import { _ } from 'frappejs/utils';
|
||||
|
||||
export default {
|
||||
doctype: 'Party',
|
||||
doctype: 'Customer',
|
||||
title: _('Customer'),
|
||||
columns: ['name', 'defaultAccount', 'address'],
|
||||
filters: {
|
||||
customer: 1
|
||||
}
|
||||
columns: ['name', 'defaultAccount', 'address']
|
||||
};
|
||||
|
@ -51,6 +51,12 @@ module.exports = {
|
||||
}
|
||||
],
|
||||
|
||||
quickEditFields: [
|
||||
'address',
|
||||
'defaultAccount',
|
||||
'currency'
|
||||
],
|
||||
|
||||
getFormTitle(doc) {
|
||||
if (doc.customer) return 'Customer';
|
||||
return 'Supplier';
|
||||
|
8
models/doctype/Party/Supplier.js
Normal file
8
models/doctype/Party/Supplier.js
Normal file
@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
name: 'Supplier',
|
||||
label: 'Supplier',
|
||||
basedOn: 'Party',
|
||||
filters: {
|
||||
supplier: 1
|
||||
}
|
||||
};
|
@ -1,10 +1,7 @@
|
||||
import { _ } from 'frappejs/utils';
|
||||
|
||||
export default {
|
||||
doctype: 'Party',
|
||||
doctype: 'Supplier',
|
||||
title: _('Supplier'),
|
||||
columns: ['name', 'defaultAccount', 'address'],
|
||||
filters: {
|
||||
supplier: 1
|
||||
}
|
||||
columns: ['name', 'defaultAccount', 'address']
|
||||
};
|
||||
|
@ -10,6 +10,8 @@ module.exports = {
|
||||
CompanySettings: require('./doctype/CompanySettings/CompanySettings'),
|
||||
AccountingLedgerEntry: require('./doctype/AccountingLedgerEntry/AccountingLedgerEntry.js'),
|
||||
Party: require('./doctype/Party/Party.js'),
|
||||
Customer: require('./doctype/Party/Customer'),
|
||||
Supplier: require('./doctype/Party/Supplier'),
|
||||
|
||||
Payment: require('./doctype/Payment/Payment.js'),
|
||||
PaymentFor: require('./doctype/PaymentFor/PaymentFor.js'),
|
||||
|
11
src/components/Icons/Search.vue
Normal file
11
src/components/Icons/Search.vue
Normal file
@ -0,0 +1,11 @@
|
||||
<template>
|
||||
<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M7 13A6 6 0 107 1a6 6 0 000 12zm8 2l-3.758-3.758"
|
||||
fill="none"
|
||||
fill-rule="evenodd"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
</template>
|
@ -1,25 +1,8 @@
|
||||
<template>
|
||||
<div class="mt-4 px-8 flex justify-between">
|
||||
<h1 class="text-xl font-bold" v-if="title">{{ title }}</h1>
|
||||
<div class="flex">
|
||||
<Button type="primary">
|
||||
<Add class="w-3 h-3 stroke-current text-white" />
|
||||
</Button>
|
||||
<SearchBar class="ml-2" />
|
||||
<slot name="title" />
|
||||
<div class="flex items-center">
|
||||
<slot name="actions" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import Button from './Button';
|
||||
import Add from './Icons/Add';
|
||||
import SearchBar from './SearchBar';
|
||||
|
||||
export default {
|
||||
props: ['title', 'breadcrumbs'],
|
||||
components: {
|
||||
Button,
|
||||
Add,
|
||||
SearchBar
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<div v-on-outside-click="clearInput" class="relative">
|
||||
<div class="rounded-lg relative flex items-center overflow-hidden">
|
||||
<div class="absolute ml-3">
|
||||
<feather-icon class="text-gray-500" name="search"></feather-icon>
|
||||
<div class="absolute flex justify-center w-8">
|
||||
<SearchIcon class="w-3 h-3 stroke-current text-gray-600" />
|
||||
</div>
|
||||
<input
|
||||
type="search"
|
||||
class="bg-gray-200 text-sm p-2 pl-10 focus:outline-none"
|
||||
class="bg-gray-200 text-sm p-1 pl-8 focus:outline-none"
|
||||
@click="focus(0)"
|
||||
@keydown.down="navigate('down')"
|
||||
@keydown.up="navigate('up')"
|
||||
@ -37,6 +37,7 @@
|
||||
import frappe from 'frappejs';
|
||||
import ListRow from '../pages/ListView/ListRow';
|
||||
import ListCell from '../pages/ListView/ListCell';
|
||||
import SearchIcon from '@/components/Icons/Search';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@ -48,7 +49,8 @@ export default {
|
||||
},
|
||||
components: {
|
||||
ListRow,
|
||||
ListCell
|
||||
ListCell,
|
||||
SearchIcon
|
||||
},
|
||||
methods: {
|
||||
focus(key) {
|
||||
|
@ -1,13 +1,21 @@
|
||||
<template>
|
||||
<div class="flex">
|
||||
<div class="flex flex-col flex-1">
|
||||
<PageHeader :title="title" />
|
||||
<PageHeader>
|
||||
<h1 slot="title" class="text-xl font-bold" v-if="title">{{ title }}</h1>
|
||||
<template slot="actions">
|
||||
<Button type="primary" @click="openNewForm">
|
||||
<Add class="w-3 h-3 stroke-current text-white" />
|
||||
</Button>
|
||||
<SearchBar class="ml-2" />
|
||||
</template>
|
||||
</PageHeader>
|
||||
<div class="flex-1">
|
||||
<List :listConfig="listConfig" :filters="filters" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<router-view class="w-64 flex-1" />
|
||||
<router-view class="w-80 flex-1" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -15,6 +23,9 @@
|
||||
import frappe from 'frappejs';
|
||||
import Observable from 'frappejs/utils/observable';
|
||||
import PageHeader from '@/components/PageHeader';
|
||||
import Button from '@/components/Button';
|
||||
import Add from '@/components/Icons/Add';
|
||||
import SearchBar from '@/components/SearchBar';
|
||||
import List from './List';
|
||||
import listConfigs from './listConfig';
|
||||
|
||||
@ -23,7 +34,10 @@ export default {
|
||||
props: ['listName', 'filters'],
|
||||
components: {
|
||||
PageHeader,
|
||||
List
|
||||
List,
|
||||
Button,
|
||||
Add,
|
||||
SearchBar
|
||||
},
|
||||
created() {
|
||||
frappe.listView = new Observable();
|
||||
@ -38,9 +52,9 @@ export default {
|
||||
if (this.filters) {
|
||||
doc.set(this.filters);
|
||||
}
|
||||
this.$router.push(`/edit/${doctype}/${doc.name}`);
|
||||
this.$router.push(`/list/${this.listName}/${doc.name}`);
|
||||
doc.on('afterInsert', () => {
|
||||
this.$router.push(`/edit/${doctype}/${doc.name}`);
|
||||
this.$router.push(`/list/${this.listName}/${doc.name}`);
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -60,11 +74,12 @@ export default {
|
||||
}
|
||||
},
|
||||
title() {
|
||||
try {
|
||||
return this.listConfig.title(this.filters);
|
||||
} catch (e) {
|
||||
return this.listConfig.title;
|
||||
if (this.listConfig) {
|
||||
return typeof this.listConfig.title === 'function'
|
||||
? this.listConfig.title(this.filters)
|
||||
: this.listConfig.title;
|
||||
}
|
||||
return this.listName;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -2,6 +2,7 @@ import SalesInvoice from '../../../models/doctype/SalesInvoice/SalesInvoiceList'
|
||||
import PurchaseInvoice from '../../../models/doctype/PurchaseInvoice/PurchaseInvoiceList';
|
||||
import Customer from '../../../models/doctype/Party/CustomerList';
|
||||
import Supplier from '../../../models/doctype/Party/SupplierList';
|
||||
import Party from '../../../models/doctype/Party/PartyList';
|
||||
import Item from '../../../models/doctype/Item/ItemList';
|
||||
import Payment from '../../../models/doctype/Payment/PaymentList';
|
||||
import Tax from '../../../models/doctype/Tax/TaxList';
|
||||
@ -14,6 +15,7 @@ export default {
|
||||
PurchaseInvoice,
|
||||
Customer,
|
||||
Supplier,
|
||||
Party,
|
||||
Item,
|
||||
Payment,
|
||||
Tax,
|
||||
|
Loading…
Reference in New Issue
Block a user