fix bugs in sales and purchases API.

This commit is contained in:
Ahmed Bouhuolia
2020-08-04 23:00:15 +02:00
parent db28cd2aef
commit ad772cf247
31 changed files with 420 additions and 819 deletions

View File

@@ -39,10 +39,11 @@ export default class BillPayment extends mixin(TenantModel, [CachableModel]) {
*/
static get relationMappings() {
const BillPaymentEntry = require('@/models/BillPaymentEntry');
const Vendor = require('@/models/Vendor');
return {
/**
* Account model may belongs to account type.
*
*/
entries: {
relation: Model.BelongsToOneRelation,
@@ -52,6 +53,17 @@ export default class BillPayment extends mixin(TenantModel, [CachableModel]) {
to: 'bills_payments_entries.billPaymentId',
},
},
/**
*
*/
vendor: {
relation: Model.BelongsToOneRelation,
modelClass: this.relationBindKnex(Vendor.default),
join: {
from: 'bills_payments.vendorId',
to: 'vendors.id',
},
}
};
}
}