refactoring: retrieve resources fields.

fix: issue in create a new custom view.
This commit is contained in:
Ahmed Bouhuolia
2020-10-17 15:00:22 +02:00
parent 7397afe2a9
commit 27ec0e91fa
13 changed files with 228 additions and 83 deletions

View File

@@ -121,7 +121,7 @@ export default class Account extends TenantModel {
static get fields() {
return {
name: {
label: 'Name',
label: 'Account name',
column: 'name',
},
type: {
@@ -145,20 +145,25 @@ export default class Account extends TenantModel {
relationColumn: 'account_types.root_type',
},
created_at: {
label: 'Created at',
column: 'created_at',
columnType: 'date',
},
active: {
label: 'Active',
column: 'active',
},
balance: {
label: 'Balance',
column: 'amount',
columnType: 'number'
},
currency: {
label: 'Currency',
column: 'currency_code',
},
normal: {
label: 'Account normal',
column: 'account_type_id',
relation: 'account_types.id',
relationColumn: 'account_types.normal'

View File

@@ -4,7 +4,7 @@ import TenantModel from 'models/TenantModel';
export default class AccountType extends TenantModel {
/**
* Table name
* Table name.
*/
static get tableName() {
return 'account_types';
@@ -30,4 +30,26 @@ export default class AccountType extends TenantModel {
},
};
}
/**
* Accounts types labels.
*/
static get labels() {
return {
fixed_asset: 'Fixed asset',
current_asset: "Current asset",
long_term_liability: "Long term liability",
current_liability: "Current liability",
equity: "Equity",
expense: "Expense",
income: "Income",
accounts_receivable: "Accounts receivable",
accounts_payable: "Accounts payable",
other_expense: "Other expense",
other_income: "Other income",
cost_of_goods_sold: "Cost of goods sold (COGS)",
other_liability: "Other liability",
other_asset: 'Other asset',
};
}
}