2
0
mirror of https://github.com/frappe/books.git synced 2025-01-22 22:58:28 +00:00

add invoice settings

This commit is contained in:
Rushabh Mehta 2018-02-12 21:53:14 +05:30
parent cf5f029ea0
commit c7f3134f83
12 changed files with 366 additions and 133 deletions

View File

@ -1,6 +1,6 @@
# Sample app for frappe # Frappe Accounting
Sample To Do app for frappe Simple JS based app for personal and small businesses accounting
### Install ### Install

8
dist/css/style.css vendored
View File

@ -5737,9 +5737,11 @@ a.text-dark:hover, a.text-dark:focus {
html { html {
font-size: 14px; } font-size: 14px; }
.main { .main {
border-left: 1px solid #dee2e6; } border-left: 1px solid #dee2e6;
min-height: calc(100vh - 50px); }
.sidebar .list-group-item { .sidebar .list-group-item {
padding: 0.5rem 1rem; } padding: 0.5rem 1rem;
border: none; }
.sidebar .list-group-flush { .sidebar .list-group-flush {
margin: -1rem; } margin: -1rem; }
.hide { .hide {
@ -5760,6 +5762,8 @@ html {
margin-top: 1rem; } margin-top: 1rem; }
.list-row .checkbox { .list-row .checkbox {
margin-right: 0.5rem; } margin-right: 0.5rem; }
.list-row a, .list-row a:hover, .list-row a:visited, .list-row a:active {
color: #343a40; }
.dropdown-menu-right { .dropdown-menu-right {
right: 0; right: 0;
left: auto; } left: auto; }

428
dist/js/bundle.js vendored
View File

@ -231,17 +231,23 @@ var frappejs = {
async getDoc(doctype, name) { async getDoc(doctype, name) {
let doc = this.getDocFromCache(doctype, name); let doc = this.getDocFromCache(doctype, name);
if (!doc) { if (!doc) {
let controller_class = this.getControllerClass(doctype); let controllerClass = this.getControllerClass(doctype);
doc = new controller_class({doctype:doctype, name: name}); doc = new controllerClass({doctype:doctype, name: name});
await doc.load(); await doc.load();
this.addToCache(doc); this.addToCache(doc);
} }
return doc; return doc;
}, },
async getSingle(doctype) {
return await this.getDoc(doctype, doctype);
},
newDoc(data) { newDoc(data) {
let controller_class = this.getControllerClass(data.doctype); let controllerClass = this.getControllerClass(data.doctype);
return new controller_class(data); let doc = new controllerClass(data);
doc.setDefaults();
return doc;
}, },
getControllerClass(doctype) { getControllerClass(doctype) {
@ -255,8 +261,8 @@ var frappejs = {
async getNewDoc(doctype) { async getNewDoc(doctype) {
let doc = this.newDoc({doctype: doctype}); let doc = this.newDoc({doctype: doctype});
doc.setName();
doc._notInserted = true; doc._notInserted = true;
doc.name = this.getRandomName();
this.addToCache(doc); this.addToCache(doc);
return doc; return doc;
}, },
@ -282,7 +288,7 @@ var frappejs = {
}; };
var model = { var model = {
async get_series_next(prefix) { async getSeriesNext(prefix) {
let series; let series;
try { try {
series = await frappejs.getDoc('Number Series', prefix); series = await frappejs.getDoc('Number Series', prefix);
@ -360,6 +366,20 @@ var document$1 = class BaseDocument {
this.handlers[key].push(method || key); this.handlers[key].push(method || key);
} }
get meta() {
if (!this._meta) {
this._meta = frappejs.getMeta(this.doctype);
}
return this._meta;
}
async getSettings() {
if (!this._settings) {
this._settings = await frappejs.getSingle(this.meta.settings);
}
return this._settings;
}
get(fieldname) { get(fieldname) {
return this[fieldname]; return this[fieldname];
} }
@ -376,7 +396,24 @@ var document$1 = class BaseDocument {
} }
} }
setName() { async setName() {
if (this.name) {
return;
}
// name === doctype for Single
if (this.meta.isSingle) {
this.name = this.meta.name;
return;
}
if (this.meta.settings) {
const number_series = (await this.getSettings()).number_series;
if(number_series) {
this.name = await frappejs.model.getSeriesNext(number_series);
}
}
// assign a random name by default // assign a random name by default
// override this to set a name // override this to set a name
if (!this.name) { if (!this.name) {
@ -384,6 +421,14 @@ var document$1 = class BaseDocument {
} }
} }
setDefaults() {
for (let field of this.meta.fields) {
if (!this[field.fieldname] && field.default) {
this[field.fieldname] = field.default;
}
}
}
setKeywords() { setKeywords() {
let keywords = []; let keywords = [];
for (let fieldname of this.meta.getKeywordFields()) { for (let fieldname of this.meta.getKeywordFields()) {
@ -392,13 +437,6 @@ var document$1 = class BaseDocument {
this.keywords = keywords.join(', '); this.keywords = keywords.join(', ');
} }
get meta() {
if (!this._meta) {
this._meta = frappejs.getMeta(this.doctype);
}
return this._meta;
}
append(key, document) { append(key, document) {
if (!this[key]) { if (!this[key]) {
this[key] = []; this[key] = [];
@ -507,7 +545,7 @@ var document$1 = class BaseDocument {
async commit() { async commit() {
// re-run triggers // re-run triggers
this.setName(); await this.setName();
this.setStandardValues(); this.setStandardValues();
this.setKeywords(); this.setKeywords();
this.setChildIdx(); this.setChildIdx();
@ -638,15 +676,15 @@ var meta = class BaseMeta extends document$1 {
return this[fieldname]; return this[fieldname];
} }
getValidFields({ with_children = true } = {}) { getValidFields({ withChildren = true } = {}) {
if (!this._valid_fields) { if (!this._valid_fields) {
this._valid_fields = []; this._valid_fields = [];
this._valid_fields_with_children = []; this._valid_fields_withChildren = [];
const _add = (field) => { const _add = (field) => {
this._valid_fields.push(field); this._valid_fields.push(field);
this._valid_fields_with_children.push(field); this._valid_fields_withChildren.push(field);
}; };
const doctype_fields = this.fields.map((field) => field.fieldname); const doctype_fields = this.fields.map((field) => field.fieldname);
@ -658,7 +696,7 @@ var meta = class BaseMeta extends document$1 {
} }
} }
if (this.is_child) { if (this.isChild) {
// child fields // child fields
for (let field of frappejs.model.child_fields) { for (let field of frappejs.model.child_fields) {
if (frappejs.db.type_map[field.fieldtype] && !doctype_fields.includes(field.fieldname)) { if (frappejs.db.type_map[field.fieldtype] && !doctype_fields.includes(field.fieldname)) {
@ -682,22 +720,31 @@ var meta = class BaseMeta extends document$1 {
_add(field); _add(field);
} }
// include tables if (with_children = True) // include tables if (withChildren = True)
if (!include && field.fieldtype === 'Table') { if (!include && field.fieldtype === 'Table') {
this._valid_fields_with_children.push(field); this._valid_fields_withChildren.push(field);
} }
} }
} }
if (with_children) { if (withChildren) {
return this._valid_fields_with_children; return this._valid_fields_withChildren;
} else { } else {
return this._valid_fields; return this._valid_fields;
} }
} }
getKeywordFields() { getKeywordFields() {
return this.keyword_fields || this.meta.fields.filter(field => field.required).map(field => field.fieldname); if (!this._keywordFields) {
this._keywordFields = this.keywordFields;
if (!(this._keywordFields && this._keywordFields.length && this.fields)) {
this._keywordFields = this.fields.filter(field => field.required).map(field => field.fieldname);
}
if (!(this._keywordFields && this._keywordFields.length)) {
this._keywordFields = ['name'];
}
}
return this._keywordFields;
} }
validate_select(field, value) { validate_select(field, value) {
@ -2462,6 +2509,15 @@ class FloatControl extends base {
var float_1 = FloatControl; var float_1 = FloatControl;
class IntControl extends float_1 {
parse(value) {
value = parseInt(value);
return value===NaN ? 0 : value;
}
}
var int_1 = IntControl;
class CurrencyControl extends float_1 { class CurrencyControl extends float_1 {
parse(value) { parse(value) {
return frappejs.parse_number(value); return frappejs.parse_number(value);
@ -5208,7 +5264,6 @@ var CellManager = function () {
var _this2 = this; var _this2 = this;
var focusCell = function focusCell(direction) { var focusCell = function focusCell(direction) {
console.log(direction);
if (!_this2.$focusedCell || _this2.$editingCell) { if (!_this2.$focusedCell || _this2.$editingCell) {
return false; return false;
} }
@ -5540,6 +5595,8 @@ var CellManager = function () {
}, { }, {
key: 'activateEditing', key: 'activateEditing',
value: function activateEditing($cell) { value: function activateEditing($cell) {
this.focusCell($cell);
var _$$data6 = _dom2.default.data($cell), var _$$data6 = _dom2.default.data($cell),
rowIndex = _$$data6.rowIndex, rowIndex = _$$data6.rowIndex,
colIndex = _$$data6.colIndex; colIndex = _$$data6.colIndex;
@ -8263,7 +8320,7 @@ module.exports = {"name":"frappe-datatable","version":"0.0.1","description":"A m
/***/ }) /***/ })
/******/ ]); /******/ ]);
}); });
//# sourceMappingURL=frappe-datatable.js.map
}); });
unwrapExports(frappeDatatable); unwrapExports(frappeDatatable);
@ -25094,6 +25151,7 @@ class TableControl extends base {
return { return {
initValue: (value, rowIndex, column) => { initValue: (value, rowIndex, column) => {
column.activeControl = control;
control.parent_control = this; control.parent_control = this;
control.doc = this.doc[this.fieldname][rowIndex]; control.doc = this.doc[this.fieldname][rowIndex];
control.set_focus(); control.set_focus();
@ -25156,11 +25214,29 @@ class TableControl extends base {
return []; return [];
} }
if (!this.doc[this.fieldname]) { if (!this.doc[this.fieldname]) {
this.doc[this.fieldname] = [{}]; this.doc[this.fieldname] = [{idx: 0}];
} }
return this.doc[this.fieldname]; return this.doc[this.fieldname];
} }
checkValidity() {
let data = this.getTableData();
for (let rowIndex=0; rowIndex < data.length; rowIndex++) {
let row = data[rowIndex];
for (let column of this.datatable.datamanager.columns) {
if (column.field && column.field.required) {
let value = row[column.field.fieldname];
if (value==='' || value===undefined || value===null) {
let $cell = this.datatable.cellmanager.getCell$(column.colIndex, rowIndex);
this.datatable.cellmanager.activateEditing($cell);
return false;
}
}
}
}
return true;
}
} }
var table = TableControl; var table = TableControl;
@ -25171,6 +25247,7 @@ const control_classes = {
Select: select, Select: select,
Link: link, Link: link,
Float: float_1, Float: float_1,
Int: int_1,
Currency: currency, Currency: currency,
Password: password, Password: password,
Table: table Table: table
@ -25270,8 +25347,24 @@ var form = class BaseForm extends observable {
}); });
} }
checkValidity() {
let validity = this.form.checkValidity();
if (validity) {
for (let control of this.controlList) {
// check validity in table
if (control.fieldtype==='Table') {
validity = control.checkValidity();
if (!validity) {
break;
}
}
}
}
return validity;
}
async submit() { async submit() {
if (!this.form.checkValidity()) { if (!this.checkValidity()) {
this.form.classList.add('was-validated'); this.form.classList.add('was-validated');
return; return;
} }
@ -25551,15 +25644,15 @@ var client = {
var autoname = "hash"; var autoname = "hash";
var name = "ToDo"; var name = "ToDo";
var doctype = "DocType"; var doctype = "DocType";
var is_single = 0; var isSingle = 0;
var keyword_fields = ["subject","description"]; var keywordFields = ["subject","description"];
var fields = [{"fieldname":"subject","label":"Subject","fieldtype":"Data","required":1},{"fieldname":"status","label":"Status","fieldtype":"Select","options":["Open","Closed"],"default":"Open","required":1},{"fieldname":"description","label":"Description","fieldtype":"Text"}]; var fields = [{"fieldname":"subject","label":"Subject","fieldtype":"Data","required":1},{"fieldname":"status","label":"Status","fieldtype":"Select","options":["Open","Closed"],"default":"Open","required":1},{"fieldname":"description","label":"Description","fieldtype":"Text"}];
var todo = { var todo = {
autoname: autoname, autoname: autoname,
name: name, name: name,
doctype: doctype, doctype: doctype,
is_single: is_single, isSingle: isSingle,
keyword_fields: keyword_fields, keywordFields: keywordFields,
fields: fields fields: fields
}; };
@ -25567,8 +25660,8 @@ var todo$1 = Object.freeze({
autoname: autoname, autoname: autoname,
name: name, name: name,
doctype: doctype, doctype: doctype,
is_single: is_single, isSingle: isSingle,
keyword_fields: keyword_fields, keywordFields: keywordFields,
fields: fields, fields: fields,
default: todo default: todo
}); });
@ -25597,33 +25690,88 @@ var todo$2 = {
Meta: ToDoMeta Meta: ToDoMeta
}; };
var name$1 = "Account"; var name$1 = "Number Series";
var doctype$1 = "DocType"; var doctype$1 = "DocType";
var is_single$1 = 0; var isSingle$1 = 0;
var keyword_fields$1 = ["name","account_type"]; var isChild = 0;
var fields$1 = [{"fieldname":"name","label":"Account Name","fieldtype":"Data","required":1},{"fieldname":"parent_account","label":"Parent Account","fieldtype":"Link","target":"Account"},{"fieldname":"account_type","label":"Account Type","fieldtype":"Select","options":["Asset","Liability","Equity","Income","Expense"]}]; var keywordFields$1 = [];
var account = { var fields$1 = [{"fieldname":"name","label":"Name","fieldtype":"Data","required":1},{"fieldname":"current","label":"Current","fieldtype":"Int","required":1}];
var number_series = {
name: name$1, name: name$1,
doctype: doctype$1, doctype: doctype$1,
is_single: is_single$1, isSingle: isSingle$1,
keyword_fields: keyword_fields$1, isChild: isChild,
keywordFields: keywordFields$1,
fields: fields$1 fields: fields$1
}; };
var account$1 = Object.freeze({ var number_series$1 = Object.freeze({
name: name$1, name: name$1,
doctype: doctype$1, doctype: doctype$1,
is_single: is_single$1, isSingle: isSingle$1,
keyword_fields: keyword_fields$1, isChild: isChild,
keywordFields: keywordFields$1,
fields: fields$1, fields: fields$1,
default: number_series
});
var require$$0$5 = ( number_series$1 && number_series ) || number_series$1;
class NumberSeriesMeta extends meta {
setupMeta() {
Object.assign(this, require$$0$5);
}
}
class NumberSeries extends document$1 {
setup() {
this.addHandler('validate');
}
validate() {
if (this.current===null || this.current===undefined) {
this.current = 0;
}
}
async next() {
this.validate();
this.current++;
await this.update();
return this.current;
}
}
var number_series$2 = {
Document: NumberSeries,
Meta: NumberSeriesMeta
};
var name$2 = "Account";
var doctype$2 = "DocType";
var isSingle$2 = 0;
var keywordFields$2 = ["name","account_type"];
var fields$2 = [{"fieldname":"name","label":"Account Name","fieldtype":"Data","required":1},{"fieldname":"parent_account","label":"Parent Account","fieldtype":"Link","target":"Account"},{"fieldname":"account_type","label":"Account Type","fieldtype":"Select","options":["Asset","Liability","Equity","Income","Expense"]}];
var account = {
name: name$2,
doctype: doctype$2,
isSingle: isSingle$2,
keywordFields: keywordFields$2,
fields: fields$2
};
var account$1 = Object.freeze({
name: name$2,
doctype: doctype$2,
isSingle: isSingle$2,
keywordFields: keywordFields$2,
fields: fields$2,
default: account default: account
}); });
var require$$0$5 = ( account$1 && account ) || account$1; var require$$0$6 = ( account$1 && account ) || account$1;
class AccountMeta extends meta { class AccountMeta extends meta {
setupMeta() { setupMeta() {
Object.assign(this, require$$0$5); Object.assign(this, require$$0$6);
} }
} }
@ -25647,33 +25795,33 @@ var account$2 = {
Meta: AccountMeta Meta: AccountMeta
}; };
var name$2 = "Item"; var name$3 = "Item";
var doctype$2 = "DocType"; var doctype$3 = "DocType";
var is_single$2 = 0; var isSingle$3 = 0;
var keyword_fields$2 = ["name","description"]; var keywordFields$3 = ["name","description"];
var fields$2 = [{"fieldname":"name","label":"Item Name","fieldtype":"Data","required":1},{"fieldname":"description","label":"Description","fieldtype":"Text"},{"fieldname":"unit","label":"Unit","fieldtype":"Select","options":["No","Kg","Gram","Hour","Day"]},{"fieldname":"rate","label":"Rate","fieldtype":"Currency"}]; var fields$3 = [{"fieldname":"name","label":"Item Name","fieldtype":"Data","required":1},{"fieldname":"description","label":"Description","fieldtype":"Text"},{"fieldname":"unit","label":"Unit","fieldtype":"Select","options":["No","Kg","Gram","Hour","Day"]},{"fieldname":"rate","label":"Rate","fieldtype":"Currency"}];
var item$1 = { var item$1 = {
name: name$2, name: name$3,
doctype: doctype$2, doctype: doctype$3,
is_single: is_single$2, isSingle: isSingle$3,
keyword_fields: keyword_fields$2, keywordFields: keywordFields$3,
fields: fields$2 fields: fields$3
}; };
var item$2 = Object.freeze({ var item$2 = Object.freeze({
name: name$2, name: name$3,
doctype: doctype$2, doctype: doctype$3,
is_single: is_single$2, isSingle: isSingle$3,
keyword_fields: keyword_fields$2, keywordFields: keywordFields$3,
fields: fields$2, fields: fields$3,
default: item$1 default: item$1
}); });
var require$$0$6 = ( item$2 && item$1 ) || item$2; var require$$0$7 = ( item$2 && item$1 ) || item$2;
class ItemMeta extends meta { class ItemMeta extends meta {
setupMeta() { setupMeta() {
Object.assign(this, require$$0$6); Object.assign(this, require$$0$7);
} }
} }
@ -25685,36 +25833,36 @@ var item$3 = {
Meta: ItemMeta Meta: ItemMeta
}; };
var name$3 = "Customer"; var name$4 = "Customer";
var doctype$3 = "DocType"; var doctype$4 = "DocType";
var is_single$3 = 0; var isSingle$4 = 0;
var istable = 0; var istable = 0;
var keyword_fields$3 = ["name"]; var keywordFields$4 = ["name"];
var fields$3 = [{"fieldname":"name","label":"Name","fieldtype":"Data","required":1}]; var fields$4 = [{"fieldname":"name","label":"Name","fieldtype":"Data","required":1}];
var customer = { var customer = {
name: name$3, name: name$4,
doctype: doctype$3, doctype: doctype$4,
is_single: is_single$3, isSingle: isSingle$4,
istable: istable, istable: istable,
keyword_fields: keyword_fields$3, keywordFields: keywordFields$4,
fields: fields$3 fields: fields$4
}; };
var customer$1 = Object.freeze({ var customer$1 = Object.freeze({
name: name$3, name: name$4,
doctype: doctype$3, doctype: doctype$4,
is_single: is_single$3, isSingle: isSingle$4,
istable: istable, istable: istable,
keyword_fields: keyword_fields$3, keywordFields: keywordFields$4,
fields: fields$3, fields: fields$4,
default: customer default: customer
}); });
var require$$0$7 = ( customer$1 && customer ) || customer$1; var require$$0$8 = ( customer$1 && customer ) || customer$1;
class CustomerMeta extends meta { class CustomerMeta extends meta {
setupMeta() { setupMeta() {
Object.assign(this, require$$0$7); Object.assign(this, require$$0$8);
} }
} }
@ -25726,36 +25874,39 @@ var customer$2 = {
Meta: CustomerMeta Meta: CustomerMeta
}; };
var name$4 = "Invoice"; var name$5 = "Invoice";
var doctype$4 = "DocType"; var doctype$5 = "DocType";
var is_single$4 = 0; var isSingle$5 = 0;
var istable$1 = 0; var istable$1 = 0;
var keyword_fields$4 = []; var keywordFields$5 = [];
var fields$4 = [{"fieldname":"customer","label":"Customer","fieldtype":"Link","target":"Customer","required":1},{"fieldname":"items","label":"Items","fieldtype":"Table","childtype":"Invoice Item","required":true},{"fieldname":"total","label":"Total","fieldtype":"Currency","formula":"doc.getSum('items', 'amount')","required":true,"disabled":true}]; var settings = "Invoice Settings";
var fields$5 = [{"fieldname":"customer","label":"Customer","fieldtype":"Link","target":"Customer","required":1},{"fieldname":"items","label":"Items","fieldtype":"Table","childtype":"Invoice Item","required":true},{"fieldname":"total","label":"Total","fieldtype":"Currency","formula":"doc.getSum('items', 'amount')","required":true,"disabled":true}];
var invoice = { var invoice = {
name: name$4, name: name$5,
doctype: doctype$4, doctype: doctype$5,
is_single: is_single$4, isSingle: isSingle$5,
istable: istable$1, istable: istable$1,
keyword_fields: keyword_fields$4, keywordFields: keywordFields$5,
fields: fields$4 settings: settings,
fields: fields$5
}; };
var invoice$1 = Object.freeze({ var invoice$1 = Object.freeze({
name: name$4, name: name$5,
doctype: doctype$4, doctype: doctype$5,
is_single: is_single$4, isSingle: isSingle$5,
istable: istable$1, istable: istable$1,
keyword_fields: keyword_fields$4, keywordFields: keywordFields$5,
fields: fields$4, settings: settings,
fields: fields$5,
default: invoice default: invoice
}); });
var require$$0$8 = ( invoice$1 && invoice ) || invoice$1; var require$$0$9 = ( invoice$1 && invoice ) || invoice$1;
class InvoiceMeta extends meta { class InvoiceMeta extends meta {
setupMeta() { setupMeta() {
Object.assign(this, require$$0$8); Object.assign(this, require$$0$9);
} }
} }
@ -25767,36 +25918,36 @@ var invoice$2 = {
Meta: InvoiceMeta Meta: InvoiceMeta
}; };
var name$5 = "Invoice Item"; var name$6 = "Invoice Item";
var doctype$5 = "DocType"; var doctype$6 = "DocType";
var is_single$5 = 0; var isSingle$6 = 0;
var is_child = 1; var isChild$1 = 1;
var keyword_fields$5 = []; var keywordFields$6 = [];
var fields$5 = [{"fieldname":"item","label":"Item","fieldtype":"Link","target":"Item","required":1},{"fieldname":"description","label":"Description","fieldtype":"Text","formula":"doc.getFrom('Item', row.item, 'description')","required":1},{"fieldname":"quantity","label":"Quantity","fieldtype":"Float","required":1},{"fieldname":"rate","label":"Rate","fieldtype":"Currency","required":1},{"fieldname":"amount","label":"Amount","fieldtype":"Currency","disabled":1,"formula":"row.quantity * row.rate"}]; var fields$6 = [{"fieldname":"item","label":"Item","fieldtype":"Link","target":"Item","required":1},{"fieldname":"description","label":"Description","fieldtype":"Text","formula":"doc.getFrom('Item', row.item, 'description')","required":1},{"fieldname":"quantity","label":"Quantity","fieldtype":"Float","required":1},{"fieldname":"rate","label":"Rate","fieldtype":"Currency","required":1},{"fieldname":"amount","label":"Amount","fieldtype":"Currency","disabled":1,"formula":"row.quantity * row.rate"}];
var invoice_item = { var invoice_item = {
name: name$5, name: name$6,
doctype: doctype$5, doctype: doctype$6,
is_single: is_single$5, isSingle: isSingle$6,
is_child: is_child, isChild: isChild$1,
keyword_fields: keyword_fields$5, keywordFields: keywordFields$6,
fields: fields$5 fields: fields$6
}; };
var invoice_item$1 = Object.freeze({ var invoice_item$1 = Object.freeze({
name: name$5, name: name$6,
doctype: doctype$5, doctype: doctype$6,
is_single: is_single$5, isSingle: isSingle$6,
is_child: is_child, isChild: isChild$1,
keyword_fields: keyword_fields$5, keywordFields: keywordFields$6,
fields: fields$5, fields: fields$6,
default: invoice_item default: invoice_item
}); });
var require$$0$9 = ( invoice_item$1 && invoice_item ) || invoice_item$1; var require$$0$10 = ( invoice_item$1 && invoice_item ) || invoice_item$1;
class InvoiceItemMeta extends meta { class InvoiceItemMeta extends meta {
setupMeta() { setupMeta() {
Object.assign(this, require$$0$9); Object.assign(this, require$$0$10);
} }
} }
@ -25808,6 +25959,47 @@ var invoice_item$2 = {
Meta: InvoiceItemMeta Meta: InvoiceItemMeta
}; };
var name$7 = "Invoice Settings";
var doctype$7 = "DocType";
var isSingle$7 = 1;
var isChild$2 = 0;
var keywordFields$7 = [];
var fields$7 = [{"fieldname":"number_series","label":"Number Series","fieldtype":"Link","target":"Number Series","required":1}];
var invoice_settings = {
name: name$7,
doctype: doctype$7,
isSingle: isSingle$7,
isChild: isChild$2,
keywordFields: keywordFields$7,
fields: fields$7
};
var invoice_settings$1 = Object.freeze({
name: name$7,
doctype: doctype$7,
isSingle: isSingle$7,
isChild: isChild$2,
keywordFields: keywordFields$7,
fields: fields$7,
default: invoice_settings
});
var require$$0$11 = ( invoice_settings$1 && invoice_settings ) || invoice_settings$1;
class InvoiceSettingsMeta extends meta {
setupMeta() {
Object.assign(this, require$$0$11);
}
}
class InvoiceSettings extends document$1 {
}
var invoice_settings$2 = {
Document: InvoiceSettings,
Meta: InvoiceSettingsMeta
};
class ToDoList extends list { class ToDoList extends list {
getFields() { getFields() {
return ['name', 'subject', 'status']; return ['name', 'subject', 'status'];
@ -25857,11 +26049,13 @@ client.start({
// require modules // require modules
frappe.modules.todo = todo$2; frappe.modules.todo = todo$2;
frappe.modules.number_series = number_series$2;
frappe.modules.account = account$2; frappe.modules.account = account$2;
frappe.modules.item = item$3; frappe.modules.item = item$3;
frappe.modules.customer = customer$2; frappe.modules.customer = customer$2;
frappe.modules.invoice = invoice$2; frappe.modules.invoice = invoice$2;
frappe.modules.invoice_item = invoice_item$2; frappe.modules.invoice_item = invoice_item$2;
frappe.modules.invoice_settings = invoice_settings$2;
frappe.modules.todo_client = todo_client; frappe.modules.todo_client = todo_client;
frappe.modules.account_client = account_client; frappe.modules.account_client = account_client;

View File

@ -1,8 +1,8 @@
{ {
"name": "Account", "name": "Account",
"doctype": "DocType", "doctype": "DocType",
"is_single": 0, "isSingle": 0,
"keyword_fields": [ "keywordFields": [
"name", "name",
"account_type" "account_type"
], ],

View File

@ -1,9 +1,9 @@
{ {
"name": "Customer", "name": "Customer",
"doctype": "DocType", "doctype": "DocType",
"is_single": 0, "isSingle": 0,
"istable": 0, "istable": 0,
"keyword_fields": [ "keywordFields": [
"name" "name"
], ],
"fields": [ "fields": [

View File

@ -1,9 +1,10 @@
{ {
"name": "Invoice", "name": "Invoice",
"doctype": "DocType", "doctype": "DocType",
"is_single": 0, "isSingle": 0,
"istable": 0, "istable": 0,
"keyword_fields": [], "keywordFields": [],
"settings": "Invoice Settings",
"fields": [ "fields": [
{ {
"fieldname": "customer", "fieldname": "customer",

View File

@ -1,9 +1,9 @@
{ {
"name": "Invoice Item", "name": "Invoice Item",
"doctype": "DocType", "doctype": "DocType",
"is_single": 0, "isSingle": 0,
"is_child": 1, "isChild": 1,
"keyword_fields": [], "keywordFields": [],
"fields": [ "fields": [
{ {
"fieldname": "item", "fieldname": "item",

View File

@ -0,0 +1,16 @@
const BaseMeta = require('frappejs/model/meta');
const BaseDocument = require('frappejs/model/document');
class InvoiceSettingsMeta extends BaseMeta {
setupMeta() {
Object.assign(this, require('./invoice_settings.json'));
}
}
class InvoiceSettings extends BaseDocument {
}
module.exports = {
Document: InvoiceSettings,
Meta: InvoiceSettingsMeta
};

View File

@ -0,0 +1,16 @@
{
"name": "Invoice Settings",
"doctype": "DocType",
"isSingle": 1,
"isChild": 0,
"keywordFields": [],
"fields": [
{
"fieldname": "number_series",
"label": "Number Series",
"fieldtype": "Link",
"target": "Number Series",
"required": 1
}
]
}

View File

@ -1,8 +1,8 @@
{ {
"name": "Item", "name": "Item",
"doctype": "DocType", "doctype": "DocType",
"is_single": 0, "isSingle": 0,
"keyword_fields": [ "keywordFields": [
"name", "name",
"description" "description"
], ],

View File

@ -1,5 +1,5 @@
{ {
"name": "frappe-todo", "name": "frappe-accounting",
"version": "1.0.0", "version": "1.0.0",
"main": "index.js", "main": "index.js",
"license": "MIT", "license": "MIT",

View File

@ -8,11 +8,13 @@ client.start({
// require modules // require modules
frappe.modules.todo = require('frappejs/models/doctype/todo/todo.js'); frappe.modules.todo = require('frappejs/models/doctype/todo/todo.js');
frappe.modules.number_series = require('frappejs/models/doctype/number_series/number_series.js');
frappe.modules.account = require('../models/doctype/account/account.js'); frappe.modules.account = require('../models/doctype/account/account.js');
frappe.modules.item = require('../models/doctype/item/item.js'); frappe.modules.item = require('../models/doctype/item/item.js');
frappe.modules.customer = require('../models/doctype/customer/customer.js'); frappe.modules.customer = require('../models/doctype/customer/customer.js');
frappe.modules.invoice = require('../models/doctype/invoice/invoice.js'); frappe.modules.invoice = require('../models/doctype/invoice/invoice.js');
frappe.modules.invoice_item = require('../models/doctype/invoice_item/invoice_item.js'); frappe.modules.invoice_item = require('../models/doctype/invoice_item/invoice_item.js');
frappe.modules.invoice_settings = require('../models/doctype/invoice_settings/invoice_settings.js');
frappe.modules.todo_client = require('frappejs/models/doctype/todo/todo_client.js'); frappe.modules.todo_client = require('frappejs/models/doctype/todo/todo_client.js');
frappe.modules.account_client = require('../models/doctype/account/account_client.js'); frappe.modules.account_client = require('../models/doctype/account/account_client.js');