2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 03:19:01 +00:00

fix: set numberSeries as readOnly after insert

This commit is contained in:
18alantom 2022-04-04 14:09:15 +05:30
parent 54628bb2d1
commit ceb45b58b7
4 changed files with 18 additions and 10 deletions

View File

@ -69,6 +69,10 @@ export default class Document extends Observable {
return;
}
if (fieldname === 'numberSeries' && !this._notInserted) {
return;
}
if (this[fieldname] !== value) {
this._dirty = true;
// if child is dirty, parent is dirty too

View File

@ -86,10 +86,10 @@
</div>
</template>
<script>
import frappe from 'frappe';
import FormControl from '@/components/Controls/FormControl';
import Button from '@/components/Button';
import { handleErrorWithDialog, getErrorMessage } from '../errorHandling';
import FormControl from '@/components/Controls/FormControl';
import frappe from 'frappe';
import { getErrorMessage, handleErrorWithDialog } from '../errorHandling';
let TwoColumnForm = {
name: 'TwoColumnForm',
@ -153,6 +153,10 @@ let TwoColumnForm = {
}
},
evaluateReadOnly(df) {
if (df.fieldname === 'numberSeries' && !this.doc._notInserted) {
return true;
}
if (this.submitted) {
return true;
}

View File

@ -109,7 +109,7 @@
:df="meta.getField('numberSeries')"
:value="doc.numberSeries"
@change="(value) => doc.set('numberSeries', value)"
:read-only="doc.submitted"
:read-only="!doc._notInserted || doc.submitted"
/>
</div>
</div>
@ -205,11 +205,11 @@ import DropdownWithActions from '@/components/DropdownWithActions';
import PageHeader from '@/components/PageHeader';
import StatusBadge from '@/components/StatusBadge';
import {
getActionsForDocument,
getInvoiceStatus,
openSettings,
routeTo,
showMessageDialog
getActionsForDocument,
getInvoiceStatus,
openSettings,
routeTo,
showMessageDialog,
} from '@/utils';
import frappe from 'frappe';
import { handleErrorWithDialog } from '../errorHandling';

View File

@ -84,7 +84,7 @@
:value="doc.numberSeries"
@change="(value) => doc.set('numberSeries', value)"
input-class="bg-gray-100 p-2 text-base"
:read-only="doc.submitted"
:read-only="!doc._notInserted || doc.submitted"
:class="doc.submitted && 'pointer-events-none'"
/>
</div>