2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 11:29:03 +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; return;
} }
if (fieldname === 'numberSeries' && !this._notInserted) {
return;
}
if (this[fieldname] !== value) { if (this[fieldname] !== value) {
this._dirty = true; this._dirty = true;
// if child is dirty, parent is dirty too // if child is dirty, parent is dirty too

View File

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

View File

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

View File

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