mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 04:10:32 +00:00
fix: custom views tabs.
This commit is contained in:
@@ -1,21 +1,26 @@
|
||||
import { Model, mixin } from "objection";
|
||||
import TenantModel from "models/TenantModel";
|
||||
import ModelSetting from "./ModelSetting";
|
||||
import BillPaymentSettings from "./BillPayment.Settings";
|
||||
import { Model, mixin } from 'objection';
|
||||
import TenantModel from 'models/TenantModel';
|
||||
import ModelSetting from './ModelSetting';
|
||||
import BillPaymentSettings from './BillPayment.Settings';
|
||||
import CustomViewBaseModel from './CustomViewBaseModel';
|
||||
import { DEFAULT_VIEWS } from 'services/Sales/PaymentReceives/constants';
|
||||
|
||||
export default class BillPayment extends mixin(TenantModel, [ModelSetting]) {
|
||||
export default class BillPayment extends mixin(TenantModel, [
|
||||
ModelSetting,
|
||||
CustomViewBaseModel,
|
||||
]) {
|
||||
/**
|
||||
* Table name
|
||||
*/
|
||||
static get tableName() {
|
||||
return "bills_payments";
|
||||
return 'bills_payments';
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamps columns.
|
||||
*/
|
||||
get timestamps() {
|
||||
return ["createdAt", "updatedAt"];
|
||||
return ['createdAt', 'updatedAt'];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,18 +34,18 @@ export default class BillPayment extends mixin(TenantModel, [ModelSetting]) {
|
||||
* Relationship mapping.
|
||||
*/
|
||||
static get relationMappings() {
|
||||
const BillPaymentEntry = require("models/BillPaymentEntry");
|
||||
const AccountTransaction = require("models/AccountTransaction");
|
||||
const Vendor = require("models/Vendor");
|
||||
const Account = require("models/Account");
|
||||
const BillPaymentEntry = require('models/BillPaymentEntry');
|
||||
const AccountTransaction = require('models/AccountTransaction');
|
||||
const Vendor = require('models/Vendor');
|
||||
const Account = require('models/Account');
|
||||
|
||||
return {
|
||||
entries: {
|
||||
relation: Model.HasManyRelation,
|
||||
modelClass: BillPaymentEntry.default,
|
||||
join: {
|
||||
from: "bills_payments.id",
|
||||
to: "bills_payments_entries.billPaymentId",
|
||||
from: 'bills_payments.id',
|
||||
to: 'bills_payments_entries.billPaymentId',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -48,11 +53,11 @@ export default class BillPayment extends mixin(TenantModel, [ModelSetting]) {
|
||||
relation: Model.BelongsToOneRelation,
|
||||
modelClass: Vendor.default,
|
||||
join: {
|
||||
from: "bills_payments.vendorId",
|
||||
to: "contacts.id",
|
||||
from: 'bills_payments.vendorId',
|
||||
to: 'contacts.id',
|
||||
},
|
||||
filter(query) {
|
||||
query.where("contact_service", "vendor");
|
||||
query.where('contact_service', 'vendor');
|
||||
},
|
||||
},
|
||||
|
||||
@@ -60,8 +65,8 @@ export default class BillPayment extends mixin(TenantModel, [ModelSetting]) {
|
||||
relation: Model.BelongsToOneRelation,
|
||||
modelClass: Account.default,
|
||||
join: {
|
||||
from: "bills_payments.paymentAccountId",
|
||||
to: "accounts.id",
|
||||
from: 'bills_payments.paymentAccountId',
|
||||
to: 'accounts.id',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -69,13 +74,20 @@ export default class BillPayment extends mixin(TenantModel, [ModelSetting]) {
|
||||
relation: Model.HasManyRelation,
|
||||
modelClass: AccountTransaction.default,
|
||||
join: {
|
||||
from: "bills_payments.id",
|
||||
to: "accounts_transactions.referenceId",
|
||||
from: 'bills_payments.id',
|
||||
to: 'accounts_transactions.referenceId',
|
||||
},
|
||||
filter(builder) {
|
||||
builder.where("reference_type", "BillPayment");
|
||||
builder.where('reference_type', 'BillPayment');
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the default custom views, roles and columns.
|
||||
*/
|
||||
static get defaultViews() {
|
||||
return DEFAULT_VIEWS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,12 @@ import TenantModel from 'models/TenantModel';
|
||||
import { formatNumber } from 'utils';
|
||||
import ModelSetting from './ModelSetting';
|
||||
import ManualJournalSettings from './ManualJournal.Settings';
|
||||
|
||||
export default class ManualJournal extends mixin(TenantModel, [ModelSetting]) {
|
||||
import CustomViewBaseModel from './CustomViewBaseModel';
|
||||
import { DEFAULT_VIEWS } from 'services/ManualJournals/constants';
|
||||
export default class ManualJournal extends mixin(TenantModel, [
|
||||
ModelSetting,
|
||||
CustomViewBaseModel,
|
||||
]) {
|
||||
/**
|
||||
* Table name.
|
||||
*/
|
||||
@@ -104,4 +108,11 @@ export default class ManualJournal extends mixin(TenantModel, [ModelSetting]) {
|
||||
static get meta() {
|
||||
return ManualJournalSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the default custom views, roles and columns.
|
||||
*/
|
||||
static get defaultViews() {
|
||||
return DEFAULT_VIEWS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,13 @@ import { Model, mixin } from 'objection';
|
||||
import TenantModel from 'models/TenantModel';
|
||||
import ModelSetting from './ModelSetting';
|
||||
import PaymentReceiveSettings from './PaymentReceive.Settings';
|
||||
import CustomViewBaseModel from './CustomViewBaseModel';
|
||||
import { DEFAULT_VIEWS } from 'services/Sales/PaymentReceives/constants';
|
||||
|
||||
export default class PaymentReceive extends mixin(TenantModel, [ModelSetting]) {
|
||||
export default class PaymentReceive extends mixin(TenantModel, [
|
||||
ModelSetting,
|
||||
CustomViewBaseModel,
|
||||
]) {
|
||||
/**
|
||||
* Table name.
|
||||
*/
|
||||
@@ -44,7 +49,7 @@ export default class PaymentReceive extends mixin(TenantModel, [ModelSetting]) {
|
||||
},
|
||||
filter(query) {
|
||||
query.where('contact_service', 'customer');
|
||||
}
|
||||
},
|
||||
},
|
||||
depositAccount: {
|
||||
relation: Model.BelongsToOneRelation,
|
||||
@@ -67,19 +72,26 @@ export default class PaymentReceive extends mixin(TenantModel, [ModelSetting]) {
|
||||
modelClass: AccountTransaction.default,
|
||||
join: {
|
||||
from: 'payment_receives.id',
|
||||
to: 'accounts_transactions.referenceId'
|
||||
to: 'accounts_transactions.referenceId',
|
||||
},
|
||||
filter(builder) {
|
||||
builder.where('reference_type', 'PaymentReceive');
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
static get meta() {
|
||||
return PaymentReceiveSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the default custom views, roles and columns.
|
||||
*/
|
||||
static get defaultViews() {
|
||||
return DEFAULT_VIEWS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,3 +23,6 @@ export const CONTACTS_CONFIG = [
|
||||
assignRequired: true,
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
export const DEFAULT_VIEWS = [];
|
||||
@@ -12,3 +12,6 @@ export const ERRORS = {
|
||||
BILLS_NOT_OPENED_YET: 'BILLS_NOT_OPENED_YET',
|
||||
VENDOR_HAS_PAYMENTS: 'VENDOR_HAS_PAYMENTS'
|
||||
};
|
||||
|
||||
|
||||
export const DEFAULT_VIEWS = [];
|
||||
@@ -12,3 +12,6 @@ export const ERRORS = {
|
||||
PAYMENT_CUSTOMER_SHOULD_NOT_UPDATE: 'PAYMENT_CUSTOMER_SHOULD_NOT_UPDATE',
|
||||
CUSTOMER_HAS_PAYMENT_RECEIVES: 'CUSTOMER_HAS_PAYMENT_RECEIVES'
|
||||
};
|
||||
|
||||
|
||||
export const DEFAULT_VIEWS = [];
|
||||
Reference in New Issue
Block a user