mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
fix: sync contacts balance with journal entries.
fix: edit invoice amount that has payment transactions.
This commit is contained in:
@@ -20,7 +20,25 @@ export default class Contact extends TenantModel {
|
||||
* Defined virtual attributes.
|
||||
*/
|
||||
static get virtualAttributes() {
|
||||
return ['closingBalance'];
|
||||
return ['contactNormal', 'closingBalance'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the contact normal by the given contact type.
|
||||
*/
|
||||
static getContactNormalByType(contactType) {
|
||||
const types = {
|
||||
'vendor': 'credit',
|
||||
'customer': 'debit',
|
||||
};
|
||||
return types[contactType];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the contact noraml;
|
||||
*/
|
||||
get contactNormal() {
|
||||
return Contact.getContactNormalByType(this.contactService);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,7 +41,7 @@ export default class Customer extends TenantModel {
|
||||
* Defined virtual attributes.
|
||||
*/
|
||||
static get virtualAttributes() {
|
||||
return ['closingBalance'];
|
||||
return ['closingBalance', 'contactNormal'];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,6 +51,13 @@ export default class Customer extends TenantModel {
|
||||
return this.openingBalance + this.balance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the contact noraml;
|
||||
*/
|
||||
get contactNormal() {
|
||||
return 'debit';
|
||||
}
|
||||
|
||||
/**
|
||||
* Model modifiers.
|
||||
*/
|
||||
|
||||
@@ -40,7 +40,7 @@ export default class Vendor extends TenantModel {
|
||||
* Defined virtual attributes.
|
||||
*/
|
||||
static get virtualAttributes() {
|
||||
return ['closingBalance'];
|
||||
return ['closingBalance', 'contactNormal'];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,6 +50,13 @@ export default class Vendor extends TenantModel {
|
||||
return this.openingBalance + this.balance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the contact noraml;
|
||||
*/
|
||||
get contactNormal() {
|
||||
return 'debit';
|
||||
}
|
||||
|
||||
/**
|
||||
* Model modifiers.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user