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

fix: Set Party defaults

- Set default Account and Currency
- Reorder fields
This commit is contained in:
Faris Ansari 2019-12-16 18:04:10 +05:30
parent 6e97fe4ad5
commit 0277b7c0e7

View File

@ -1,3 +1,4 @@
const frappe = require('frappejs');
let { _ } = require('frappejs/utils');
module.exports = {
@ -17,7 +18,7 @@ module.exports = {
{
fieldname: 'image',
label: 'Image',
fieldtype: 'AttachImage',
fieldtype: 'AttachImage'
},
{
fieldname: 'customer',
@ -39,6 +40,14 @@ module.exports = {
isGroup: 0,
accountType: doc.customer ? 'Receivable' : 'Payable'
};
},
formula: doc => {
if (doc.customer) {
return 'Debtors';
}
if (doc.supplier) {
return 'Creditors';
}
}
},
{
@ -51,7 +60,8 @@ module.exports = {
label: 'Currency',
fieldtype: 'Link',
target: 'Currency',
placeholder: 'INR'
placeholder: 'INR',
formula: () => frappe.AccountingSettings.currency
},
{
fieldname: 'email',
@ -86,7 +96,7 @@ module.exports = {
}
],
quickEditFields: ['defaultAccount', 'currency', 'email', 'phone', 'address'],
quickEditFields: ['email', 'phone', 'address', 'defaultAccount', 'currency'],
getFormTitle(doc) {
if (doc.customer) return 'Customer';