2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

feat: add numberSeries field to docs

This commit is contained in:
18alantom 2022-03-08 12:14:05 +05:30
parent 0bd1706e2b
commit c9631c27a6
10 changed files with 121 additions and 1 deletions

View File

@ -2,3 +2,14 @@ export const DEFAULT_INTERNAL_PRECISION = 11;
export const DEFAULT_DISPLAY_PRECISION = 2; export const DEFAULT_DISPLAY_PRECISION = 2;
export const DEFAULT_LOCALE = 'en-IN'; export const DEFAULT_LOCALE = 'en-IN';
export const DEFAULT_LANGUAGE = 'English'; export const DEFAULT_LANGUAGE = 'English';
export const DEFAULT_NUMBER_SERIES = {
SalesInvoice: 'SINV-',
PurchaseInvoice: 'PINV-',
Payment: 'PAY-',
JournalEntry: 'JV-',
Quotation: 'QTN-',
SalesOrder: 'SO-',
Fulfillment: 'OF-',
PurchaseOrder: 'PO-',
PurchaseReceipt: 'PREC-',
};

View File

@ -1,5 +1,6 @@
import { t } from 'frappe'; import { t } from 'frappe';
import model from 'frappe/model'; import model from 'frappe/model';
import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts';
import Quotation from '../Quotation/Quotation'; import Quotation from '../Quotation/Quotation';
export default model.extend(Quotation, { export default model.extend(Quotation, {
@ -11,5 +12,16 @@ export default model.extend(Quotation, {
fieldname: 'items', fieldname: 'items',
childtype: 'FulfillmentItem', childtype: 'FulfillmentItem',
}, },
{
fieldname: 'numberSeries',
label: t`Number Series`,
fieldtype: 'Link',
target: 'NumberSeries',
required: 1,
getFilters: () => {
return { referenceType: 'Fulfillment' };
},
default: DEFAULT_NUMBER_SERIES['FulFillment'],
},
], ],
}); });

View File

@ -1,6 +1,7 @@
import { t } from 'frappe'; import { t } from 'frappe';
import { DateTime } from 'luxon'; import { DateTime } from 'luxon';
import { ledgerLink } from '../../../accounting/utils'; import { ledgerLink } from '../../../accounting/utils';
import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts';
export default { export default {
label: t`Journal Entry`, label: t`Journal Entry`,
@ -72,6 +73,17 @@ export default {
default: 0, default: 0,
readOnly: 1, readOnly: 1,
}, },
{
fieldname: 'numberSeries',
label: t`Number Series`,
fieldtype: 'Link',
target: 'NumberSeries',
required: 1,
getFilters: () => {
return { referenceType: 'JournalEntry' };
},
default: DEFAULT_NUMBER_SERIES['JournalEntry'],
},
], ],
actions: [ledgerLink], actions: [ledgerLink],
}; };

View File

@ -1,5 +1,6 @@
import frappe, { t } from 'frappe'; import frappe, { t } from 'frappe';
import utils from '../../../accounting/utils'; import utils from '../../../accounting/utils';
import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts';
export default { export default {
name: 'Payment', name: 'Payment',
@ -81,6 +82,17 @@ export default {
} }
}, },
}, },
{
fieldname: 'numberSeries',
label: t`Number Series`,
fieldtype: 'Link',
target: 'NumberSeries',
required: 1,
getFilters: () => {
return { referenceType: 'Payment' };
},
default: DEFAULT_NUMBER_SERIES['Payment'],
},
{ {
fieldname: 'paymentMethod', fieldname: 'paymentMethod',
label: t`Payment Method`, label: t`Payment Method`,
@ -162,6 +174,7 @@ export default {
], ],
quickEditFields: [ quickEditFields: [
'numberSeries',
'party', 'party',
'date', 'date',
'paymentMethod', 'paymentMethod',

View File

@ -1,4 +1,5 @@
import { t } from 'frappe'; import { t } from 'frappe';
import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts';
import InvoiceTemplate from '../SalesInvoice/InvoiceTemplate.vue'; import InvoiceTemplate from '../SalesInvoice/InvoiceTemplate.vue';
import { getActions } from '../Transaction/Transaction'; import { getActions } from '../Transaction/Transaction';
import PurchaseInvoice from './PurchaseInvoiceDocument'; import PurchaseInvoice from './PurchaseInvoiceDocument';
@ -134,6 +135,17 @@ export default {
default: 0, default: 0,
readOnly: 1, readOnly: 1,
}, },
{
fieldname: 'numberSeries',
label: t`Number Series`,
fieldtype: 'Link',
target: 'NumberSeries',
required: 1,
getFilters: () => {
return { referenceType: 'PurchaseInvoice' };
},
default: DEFAULT_NUMBER_SERIES['PurchaseInvoice'],
},
], ],
actions: getActions('PurchaseInvoice'), actions: getActions('PurchaseInvoice'),

View File

@ -1,5 +1,6 @@
import { t } from 'frappe'; import { t } from 'frappe';
import model from 'frappe/model'; import model from 'frappe/model';
import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts';
import PurchaseInvoice from '../PurchaseInvoice/PurchaseInvoice'; import PurchaseInvoice from '../PurchaseInvoice/PurchaseInvoice';
export default model.extend( export default model.extend(
@ -13,6 +14,17 @@ export default model.extend(
fieldname: 'items', fieldname: 'items',
childtype: 'PurchaseOrderItem', childtype: 'PurchaseOrderItem',
}, },
{
fieldname: 'numberSeries',
label: t`Number Series`,
fieldtype: 'Link',
target: 'NumberSeries',
required: 1,
getFilters: () => {
return { referenceType: 'PurchaseOrder' };
},
default: DEFAULT_NUMBER_SERIES['PurchaseOrder'],
},
], ],
}, },
{ {

View File

@ -1,5 +1,6 @@
import { t } from 'frappe'; import { t } from 'frappe';
import model from 'frappe/model'; import model from 'frappe/model';
import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts';
import PurchaseOrder from '../PurchaseOrder/PurchaseOrder'; import PurchaseOrder from '../PurchaseOrder/PurchaseOrder';
export default model.extend(PurchaseOrder, { export default model.extend(PurchaseOrder, {
@ -11,5 +12,16 @@ export default model.extend(PurchaseOrder, {
fieldname: 'items', fieldname: 'items',
childtype: 'PurchaseReceiptItem', childtype: 'PurchaseReceiptItem',
}, },
{
fieldname: 'numberSeries',
label: t`Number Series`,
fieldtype: 'Link',
target: 'NumberSeries',
required: 1,
getFilters: () => {
return { referenceType: 'PurchaseReceipt' };
},
default: DEFAULT_NUMBER_SERIES['PurchaseReceipt'],
},
], ],
}); });

View File

@ -1,5 +1,6 @@
import { t } from 'frappe'; import { t } from 'frappe';
import model from 'frappe/model'; import model from 'frappe/model';
import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts';
import SalesInvoice from '../SalesInvoice/SalesInvoice'; import SalesInvoice from '../SalesInvoice/SalesInvoice';
const Quotation = model.extend( const Quotation = model.extend(
@ -13,6 +14,17 @@ const Quotation = model.extend(
fieldname: 'items', fieldname: 'items',
childtype: 'QuotationItem', childtype: 'QuotationItem',
}, },
{
fieldname: 'numberSeries',
label: t`Number Series`,
fieldtype: 'Link',
target: 'NumberSeries',
required: 1,
getFilters: () => {
return { referenceType: 'Quotation' };
},
default: DEFAULT_NUMBER_SERIES['Quotation'],
},
], ],
links: [], links: [],
}, },

View File

@ -1,4 +1,5 @@
import { t } from 'frappe'; import { t } from 'frappe';
import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts';
import { getActions } from '../Transaction/Transaction'; import { getActions } from '../Transaction/Transaction';
import InvoiceTemplate from './InvoiceTemplate.vue'; import InvoiceTemplate from './InvoiceTemplate.vue';
import SalesInvoice from './SalesInvoiceDocument'; import SalesInvoice from './SalesInvoiceDocument';
@ -134,6 +135,17 @@ export default {
default: 0, default: 0,
readOnly: 1, readOnly: 1,
}, },
{
fieldname: 'numberSeries',
label: t`Number Series`,
fieldtype: 'Link',
target: 'NumberSeries',
required: 1,
getFilters: () => {
return { referenceType: 'SalesInvoice' };
},
default: DEFAULT_NUMBER_SERIES['SalesInvoice'],
},
], ],
actions: getActions('SalesInvoice'), actions: getActions('SalesInvoice'),

View File

@ -1,5 +1,6 @@
import { t } from 'frappe'; import { t } from 'frappe';
import model from 'frappe/model'; import model from 'frappe/model';
import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts';
import Quotation from '../Quotation/Quotation'; import Quotation from '../Quotation/Quotation';
export default model.extend(Quotation, { export default model.extend(Quotation, {
@ -11,5 +12,16 @@ export default model.extend(Quotation, {
fieldname: 'items', fieldname: 'items',
childtype: 'SalesOrderItem', childtype: 'SalesOrderItem',
}, },
{
fieldname: 'numberSeries',
label: t`Number Series`,
fieldtype: 'Link',
target: 'NumberSeries',
required: 1,
getFilters: () => {
return { referenceType: 'SalesOrder' };
},
default: DEFAULT_NUMBER_SERIES['SalesOrder'],
},
], ],
}); });