Skip to content

Commit

Permalink
fix: Read only tab when table is view.
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt committed Aug 28, 2024
1 parent 322a91f commit 4f9fa0a
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 43 deletions.
28 changes: 14 additions & 14 deletions src/components/ADempiere/DataTable/Components/ChangeRecord.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<!--
ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com
Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com
Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com https://github.com/EdwinBetanc0urt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https:www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https:www.gnu.org/licenses/>.
-->

<template>
Expand Down Expand Up @@ -72,7 +72,7 @@ export default defineComponent({
}
},

setup(props, { root }) {
setup(props) {
const recordUuid = computed(() => {
return store.getters.getUuidOfContainer(props.containerUuid)
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<!--
ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com
Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com https://github.com/EdwinBetanc0urt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com
Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com https://github.com/EdwinBetanc0urt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https:www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https:www.gnu.org/licenses/>.
-->

<template>
Expand Down Expand Up @@ -194,6 +194,10 @@ export default defineComponent({
})

const isDeleteRecord = computed(() => {
const { table } = tabAttributes.value
if (!isEmptyValue(table) && table.is_view) {
return false
}
if (isExistsChanges.value) {
return false
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<!--
ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com
Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com https://github.com/EdwinBetanc0urt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https:www.gnu.org/licenses/>.
ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com
Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com https://github.com/EdwinBetanc0urt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https:www.gnu.org/licenses/>.
-->

<template>
Expand Down Expand Up @@ -126,6 +126,10 @@ export default defineComponent({
})

const isCreateRecord = computed(() => {
const { table } = tabAttributes.value
if (!isEmptyValue(table) && table.is_view) {
return false
}
if (isSecondaryParentTab.value) {
return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ export default defineComponent({
})

const isSaveRecord = computed(() => {
const { table } = tabAttributes.value
if (!isEmptyValue(table) && table.is_view) {
return false
}
if (isEmptyValue(recordUuid.value) || recordUuid.value === 'create-new') {
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export default defineComponent({
})

const isUndoChanges = computed(() => {
const { table } = tabAttributes.value
if (!isEmptyValue(table) && table.is_view) {
return false
}
if (!isEmptyValue(recordUuid.value)) {
return isExistsChanges.value
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ import RefreshRecordButton from '@/components/ADempiere/TabManager/convenienceBu
import DeleteRecordButton from '@/components/ADempiere/TabManager/convenienceButtons/DeleteRecordButton.vue'
import OptionsSecuence from '@/components/ADempiere/TabManager/convenienceButtons/OptionsSecuence.vue'
import PrintProcess from '@/components/ADempiere/TabManager/convenienceButtons/PrintProcess.vue'

export default defineComponent({
name: 'ConvenienceButtons',

Expand Down
13 changes: 12 additions & 1 deletion src/utils/ADempiere/dictionary/window/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ export function isReadOnlyTab({ parentUuid, containerUuid }) {
if (isEmptyValue(storeTab)) {
return true
}
const { is_read_only, read_only_logic } = storeTab
const { table, is_read_only, read_only_logic } = storeTab
if (!isEmptyValue(table) && table.is_view) {
return true
}
// if tab is read only, all fields are read only
if (is_read_only) {
return true
Expand Down Expand Up @@ -206,6 +209,9 @@ export function evaluateDefaultFieldShowed({
if (!isParentTab && (link_column_name === column_name || parent_column_name === column_name)) {
return true
}
if (['Record_ID'].includes(column_name)) {
return true
}
if (is_document && [ORGANIZATION, WAREHOUSE].includes(column_name)) {
return true
}
Expand Down Expand Up @@ -547,6 +553,11 @@ export const undoChange = {
name: language.t('actionMenu.undo'),
type: 'undoModifyData',
enabled: ({ parentUuid, containerUuid }) => {
const storedTab = store.getters.getStoredTab(parentUuid, containerUuid)
const { table } = storedTab
if (!isEmptyValue(table) && table.is_view) {
return false
}
return isEmptyValue(
store.getters.getUuidOfContainer(containerUuid)
)
Expand Down

0 comments on commit 4f9fa0a

Please sign in to comment.