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

Merge pull request #236 from 18alantom/minor-fixes-payments

fix: minor changes and fixes to Payments
This commit is contained in:
Alan 2021-11-08 19:49:04 +05:30 committed by GitHub
commit ab97812239
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 184 additions and 122 deletions

View File

@ -24,48 +24,48 @@ export default {
'Excise Entry', 'Excise Entry',
'Write Off Entry', 'Write Off Entry',
'Opening Entry', 'Opening Entry',
'Depreciation Entry' 'Depreciation Entry',
], ],
required: 1 required: 1,
}, },
{ {
fieldname: 'date', fieldname: 'date',
label: 'Date', label: 'Date',
fieldtype: 'Date', fieldtype: 'Date',
default: DateTime.local().toISODate() default: () => DateTime.local().toISODate(),
}, },
{ {
fieldname: 'accounts', fieldname: 'accounts',
label: 'Account Entries', label: 'Account Entries',
fieldtype: 'Table', fieldtype: 'Table',
childtype: 'JournalEntryAccount', childtype: 'JournalEntryAccount',
required: true required: true,
}, },
{ {
fieldname: 'referenceNumber', fieldname: 'referenceNumber',
label: 'Reference Number', label: 'Reference Number',
fieldtype: 'Data' fieldtype: 'Data',
}, },
{ {
fieldname: 'referenceDate', fieldname: 'referenceDate',
label: 'Reference Date', label: 'Reference Date',
fieldtype: 'Date' fieldtype: 'Date',
}, },
{ {
fieldname: 'userRemark', fieldname: 'userRemark',
label: 'User Remark', label: 'User Remark',
fieldtype: 'Text', fieldtype: 'Text',
placeholder: 'User Remark' placeholder: 'User Remark',
} },
], ],
actions: [ actions: [
{ {
label: 'Revert', label: 'Revert',
condition: doc => doc.submitted, condition: (doc) => doc.submitted,
action(doc) { action(doc) {
doc.revert(); doc.revert();
} },
}, },
ledgerLink ledgerLink,
] ],
}; };

View File

@ -15,13 +15,13 @@ export default {
label: 'Party', label: 'Party',
fieldtype: 'Link', fieldtype: 'Link',
target: 'Party', target: 'Party',
required: 1 required: 1,
}, },
{ {
fieldname: 'date', fieldname: 'date',
label: 'Posting Date', label: 'Posting Date',
fieldtype: 'Date', fieldtype: 'Date',
default: new Date().toISOString() default: () => new Date().toISOString(),
}, },
{ {
fieldname: 'account', fieldname: 'account',
@ -37,14 +37,14 @@ export default {
return { accountType: ['in', ['Bank', 'Cash']], isGroup: 0 }; return { accountType: ['in', ['Bank', 'Cash']], isGroup: 0 };
} }
} }
} },
}, },
{ {
fieldname: 'paymentType', fieldname: 'paymentType',
label: 'Payment Type', label: 'Payment Type',
fieldtype: 'Select', fieldtype: 'Select',
options: ['', 'Receive', 'Pay'], options: ['', 'Receive', 'Pay'],
required: 1 required: 1,
}, },
{ {
fieldname: 'paymentAccount', fieldname: 'paymentAccount',
@ -62,11 +62,11 @@ export default {
} }
} }
}, },
formula: doc => { formula: (doc) => {
if (doc.paymentMethod === 'Cash') { if (doc.paymentMethod === 'Cash') {
return 'Cash'; return 'Cash';
} }
} },
}, },
{ {
fieldname: 'paymentMethod', fieldname: 'paymentMethod',
@ -74,37 +74,36 @@ export default {
placeholder: 'Payment Method', placeholder: 'Payment Method',
fieldtype: 'Select', fieldtype: 'Select',
options: ['', 'Cash', 'Cheque', 'Transfer'], options: ['', 'Cash', 'Cheque', 'Transfer'],
required: 1 required: 1,
}, },
{ {
fieldname: 'referenceId', fieldname: 'referenceId',
label: 'Ref. / Cheque No.', label: 'Ref. / Cheque No.',
placeholder: 'Ref. / Cheque No.', placeholder: 'Ref. / Cheque No.',
fieldtype: 'Data', fieldtype: 'Data',
required: 1 // TODO: UNIQUE required: (doc) => doc.paymentMethod !== 'Cash', // TODO: UNIQUE
}, },
{ {
fieldname: 'referenceDate', fieldname: 'referenceDate',
label: 'Ref. Date', label: 'Ref. Date',
placeholder: 'Ref. Date', placeholder: 'Ref. Date',
fieldtype: 'Date' fieldtype: 'Date',
}, },
{ {
fieldname: 'clearanceDate', fieldname: 'clearanceDate',
label: 'Clearance Date', label: 'Clearance Date',
placeholder: 'Clearance Date', placeholder: 'Clearance Date',
fieldtype: 'Date', fieldtype: 'Date',
hidden: doc => { hidden: (doc) => doc.paymentMethod === 'Cash',
return doc.paymentMethod === 'Cash' ? 1 : 0;
}
}, },
{ {
fieldname: 'amount', fieldname: 'amount',
label: 'Amount', label: 'Amount',
fieldtype: 'Currency', fieldtype: 'Currency',
required: 1, required: 1,
formula: doc => doc.getSum('for', 'amount'), formula: (doc) => doc.getSum('for', 'amount'),
validate(value, doc) { validate(value, doc) {
if (doc.for.length === 0) return;
const amount = doc.getSum('for', 'amount'); const amount = doc.getSum('for', 'amount');
if (value > amount) { if (value > amount) {
@ -119,24 +118,27 @@ export default {
} else if (value === 0) { } else if (value === 0) {
throw new frappe.errors.ValidationError( throw new frappe.errors.ValidationError(
frappe._( frappe._(
`Payment amount cannot be ${frappe.format(value, 'Currency')}. Amount has been reset to max viable amount.` `Payment amount cannot be ${frappe.format(
value,
'Currency'
)}. Amount has been reset to max viable amount.`
) )
); );
} }
} },
}, },
{ {
fieldname: 'writeoff', fieldname: 'writeoff',
label: 'Write Off / Refund', label: 'Write Off / Refund',
fieldtype: 'Currency' fieldtype: 'Currency',
}, },
{ {
fieldname: 'for', fieldname: 'for',
label: 'Payment For', label: 'Payment Reference',
fieldtype: 'Table', fieldtype: 'Table',
childtype: 'PaymentFor', childtype: 'PaymentFor',
required: 1 required: 0,
} },
], ],
quickEditFields: [ quickEditFields: [
@ -151,58 +153,68 @@ export default {
'clearanceDate', 'clearanceDate',
'amount', 'amount',
'writeoff', 'writeoff',
'for' 'for',
], ],
layout: [ layout: [
{ {
columns: [ columns: [
{ {
fields: ['party', 'account'] fields: ['party', 'account'],
}, },
{ {
fields: ['date', 'paymentAccount'] fields: ['date', 'paymentAccount'],
} },
] ],
}, },
{ {
columns: [ columns: [
{ {
fields: ['paymentMethod'] fields: ['paymentMethod'],
}, },
{ {
fields: ['paymentType'] fields: ['paymentType'],
}, },
{ {
fields: ['referenceId'] fields: ['referenceId'],
} },
] ],
}, },
{ {
columns: [ columns: [
{ {
fields: ['referenceDate'] fields: ['referenceDate'],
}, },
{ {
fields: ['clearanceDate'] fields: ['clearanceDate'],
} },
] ],
}, },
{ {
columns: [ columns: [
{ {
fields: ['for'] fields: ['for'],
} },
] ],
}, },
{ {
columns: [ columns: [
{ {
fields: ['amount', 'writeoff'] fields: ['amount', 'writeoff'],
} },
] ],
} },
],
actions: [
{
label: 'Revert',
condition: (doc) => doc.submitted,
action(doc) {
doc.revert();
},
},
utils.ledgerLink,
], ],
links: [utils.ledgerLink] links: [utils.ledgerLink],
}; };

View File

@ -20,8 +20,8 @@ export default class PaymentServer extends BaseDocument {
} }
async beforeSubmit() { async beforeSubmit() {
if (!this.for.length) { if (!this.for || !this.for.length) {
throw new Error(`No reference for the payment.`); return;
} }
for (let row of this.for) { for (let row of this.for) {
if (!['SalesInvoice', 'PurchaseInvoice'].includes(row.referenceType)) { if (!['SalesInvoice', 'PurchaseInvoice'].includes(row.referenceType)) {
@ -36,9 +36,14 @@ export default class PaymentServer extends BaseDocument {
outstandingAmount = baseGrandTotal; outstandingAmount = baseGrandTotal;
} }
if (this.amount <= 0 || this.amount > outstandingAmount) { if (this.amount <= 0 || this.amount > outstandingAmount) {
throw new Error( let message = frappe._(
`Payment amount (${this.amount}) should be greater than 0 and less than Outstanding amount (${outstandingAmount})` `Payment amount (${this.amount}) should be less than Outstanding amount (${outstandingAmount}).`
); );
if (this.amount <= 0) {
const amt = this.amount < 0 ? ` (${this.amount})` : '';
message = frappe._(`Payment amount${amt} should be greater than 0.`);
}
throw new frappe.errors.ValidationError(message);
} else { } else {
// update outstanding amounts in invoice and party // update outstanding amounts in invoice and party
let newOutstanding = outstandingAmount - this.amount; let newOutstanding = outstandingAmount - this.amount;
@ -61,4 +66,4 @@ export default class PaymentServer extends BaseDocument {
// Maybe revert outstanding amount of invoice too? // Maybe revert outstanding amount of invoice too?
} }
}; }

View File

@ -26,7 +26,7 @@ export default {
fieldname: 'date', fieldname: 'date',
label: 'Date', label: 'Date',
fieldtype: 'Date', fieldtype: 'Date',
default: new Date().toISOString().slice(0, 10) default: () => new Date().toISOString().slice(0, 10)
}, },
{ {
fieldname: 'supplier', fieldname: 'supplier',

View File

@ -19,20 +19,20 @@ export default {
fieldname: 'name', fieldname: 'name',
fieldtype: 'Data', fieldtype: 'Data',
required: 1, required: 1,
readOnly: 1 readOnly: 1,
}, },
{ {
fieldname: 'date', fieldname: 'date',
label: 'Date', label: 'Date',
fieldtype: 'Date', fieldtype: 'Date',
default: new Date().toISOString().slice(0, 10) default: () => new Date().toISOString().slice(0, 10),
}, },
{ {
fieldname: 'customer', fieldname: 'customer',
label: 'Customer', label: 'Customer',
fieldtype: 'Link', fieldtype: 'Link',
target: 'Customer', target: 'Customer',
required: 1 required: 1,
}, },
{ {
fieldname: 'account', fieldname: 'account',
@ -40,90 +40,90 @@ export default {
fieldtype: 'Link', fieldtype: 'Link',
target: 'Account', target: 'Account',
disableCreation: true, disableCreation: true,
formula: doc => doc.getFrom('Party', doc.customer, 'defaultAccount'), formula: (doc) => doc.getFrom('Party', doc.customer, 'defaultAccount'),
getFilters: () => { getFilters: () => {
return { return {
isGroup: 0, isGroup: 0,
accountType: 'Receivable' accountType: 'Receivable',
}; };
} },
}, },
{ {
fieldname: 'currency', fieldname: 'currency',
label: 'Customer Currency', label: 'Customer Currency',
fieldtype: 'Link', fieldtype: 'Link',
target: 'Currency', target: 'Currency',
formula: doc => doc.getFrom('Party', doc.customer, 'currency'), formula: (doc) => doc.getFrom('Party', doc.customer, 'currency'),
formulaDependsOn: ['customer'] formulaDependsOn: ['customer'],
}, },
{ {
fieldname: 'exchangeRate', fieldname: 'exchangeRate',
label: 'Exchange Rate', label: 'Exchange Rate',
fieldtype: 'Float', fieldtype: 'Float',
formula: doc => doc.getExchangeRate(), formula: (doc) => doc.getExchangeRate(),
readOnly: true readOnly: true,
}, },
{ {
fieldname: 'items', fieldname: 'items',
label: 'Items', label: 'Items',
fieldtype: 'Table', fieldtype: 'Table',
childtype: 'SalesInvoiceItem', childtype: 'SalesInvoiceItem',
required: true required: true,
}, },
{ {
fieldname: 'netTotal', fieldname: 'netTotal',
label: 'Net Total', label: 'Net Total',
fieldtype: 'Currency', fieldtype: 'Currency',
formula: doc => doc.getSum('items', 'amount'), formula: (doc) => doc.getSum('items', 'amount'),
readOnly: 1, readOnly: 1,
getCurrency: doc => doc.currency getCurrency: (doc) => doc.currency,
}, },
{ {
fieldname: 'baseNetTotal', fieldname: 'baseNetTotal',
label: 'Net Total (Company Currency)', label: 'Net Total (Company Currency)',
fieldtype: 'Currency', fieldtype: 'Currency',
formula: doc => doc.netTotal * doc.exchangeRate, formula: (doc) => doc.netTotal * doc.exchangeRate,
readOnly: 1 readOnly: 1,
}, },
{ {
fieldname: 'taxes', fieldname: 'taxes',
label: 'Taxes', label: 'Taxes',
fieldtype: 'Table', fieldtype: 'Table',
childtype: 'TaxSummary', childtype: 'TaxSummary',
formula: doc => doc.getTaxSummary(), formula: (doc) => doc.getTaxSummary(),
readOnly: 1 readOnly: 1,
}, },
{ {
fieldname: 'grandTotal', fieldname: 'grandTotal',
label: 'Grand Total', label: 'Grand Total',
fieldtype: 'Currency', fieldtype: 'Currency',
formula: doc => doc.getGrandTotal(), formula: (doc) => doc.getGrandTotal(),
readOnly: 1, readOnly: 1,
getCurrency: doc => doc.currency getCurrency: (doc) => doc.currency,
}, },
{ {
fieldname: 'baseGrandTotal', fieldname: 'baseGrandTotal',
label: 'Grand Total (Company Currency)', label: 'Grand Total (Company Currency)',
fieldtype: 'Currency', fieldtype: 'Currency',
formula: doc => doc.grandTotal * doc.exchangeRate, formula: (doc) => doc.grandTotal * doc.exchangeRate,
readOnly: 1 readOnly: 1,
}, },
{ {
fieldname: 'outstandingAmount', fieldname: 'outstandingAmount',
label: 'Outstanding Amount', label: 'Outstanding Amount',
fieldtype: 'Currency', fieldtype: 'Currency',
formula: doc => { formula: (doc) => {
if (doc.submitted) return; if (doc.submitted) return;
return doc.baseGrandTotal; return doc.baseGrandTotal;
}, },
readOnly: 1 readOnly: 1,
}, },
{ {
fieldname: 'terms', fieldname: 'terms',
label: 'Notes', label: 'Notes',
fieldtype: 'Text' fieldtype: 'Text',
} },
], ],
actions: getActions('SalesInvoice') actions: getActions('SalesInvoice'),
}; };

View File

@ -0,0 +1 @@
v0_0_3/makePaymentRefIdNullable

View File

@ -0,0 +1,28 @@
import frappe from 'frappejs';
export default async function execute() {
// Since sqlite has no ALTER TABLE to change column meta
// the table has to be _Prestiged_.
const tableInfo = await frappe.db.sql('pragma table_info("Payment")');
const referenceId = tableInfo.find(({ name }) => name === 'referenceId');
if (!referenceId || !referenceId.notnull) {
return;
}
await frappe.db.createTable('Payment', '__Payment');
await frappe.db.sql('insert into __Payment select * from Payment');
const mainCount = await frappe.db.knex
.table('Payment')
.count('name as count');
const replCount = await frappe.db.knex
.table('__Payment')
.count('name as count');
if (mainCount[0].count === replCount[0].count) {
await frappe.db.knex.schema.dropTable('Payment');
await frappe.db.knex.schema.renameTable('__Payment', 'Payment');
} else {
await frappe.db.knex.schema.dropTable('__Payment');
}
}

View File

@ -8,7 +8,8 @@
size="small" size="small"
:df="df" :df="df"
:value="doc[df.fieldname]" :value="doc[df.fieldname]"
@change="value => onChange(df, value)" :read-only="submitted"
@change="(value) => onChange(df, value)"
/> />
<template v-else> <template v-else>
<template v-if="inlineEditField === df && inlineEditDoc"> <template v-if="inlineEditField === df && inlineEditDoc">
@ -20,7 +21,7 @@
:column-ratio="columnRatio" :column-ratio="columnRatio"
:no-border="true" :no-border="true"
:focus-first-input="true" :focus-first-input="true"
@error="msg => $emit('error', msg)" @error="(msg) => $emit('error', msg)"
/> />
<div class="flex px-4 pb-2"> <div class="flex px-4 pb-2">
<Button <Button
@ -55,7 +56,7 @@
class="py-2 pr-4" class="py-2 pr-4"
@click="activateInlineEditing(df)" @click="activateInlineEditing(df)"
:class="{ :class="{
'pl-2': df.fieldtype === 'AttachImage' 'pl-2': df.fieldtype === 'AttachImage',
}" }"
> >
<FormControl <FormControl
@ -71,9 +72,10 @@
: doc[df.fieldname] : doc[df.fieldname]
" "
:class="{ 'p-2': df.fieldtype === 'Check' }" :class="{ 'p-2': df.fieldtype === 'Check' }"
@change="value => onChange(df, value)" :read-only="submitted"
@change="(value) => onChange(df, value)"
@focus="activateInlineEditing(df)" @focus="activateInlineEditing(df)"
@new-doc="newdoc => onChange(df, newdoc.name)" @new-doc="(newdoc) => onChange(df, newdoc.name)"
/> />
<div <div
class="text-sm text-red-600 mt-2 pl-2" class="text-sm text-red-600 mt-2 pl-2"
@ -101,10 +103,10 @@ let TwoColumnForm = {
autosave: Boolean, autosave: Boolean,
columnRatio: { columnRatio: {
type: Array, type: Array,
default: () => [1, 1] default: () => [1, 1],
}, },
noBorder: Boolean, noBorder: Boolean,
focusFirstInput: Boolean focusFirstInput: Boolean,
}, },
data() { data() {
return { return {
@ -112,20 +114,20 @@ let TwoColumnForm = {
inlineEditDoc: null, inlineEditDoc: null,
inlineEditFields: null, inlineEditFields: null,
inlineEditDisplayField: null, inlineEditDisplayField: null,
errors: {} errors: {},
}; };
}, },
provide() { provide() {
return { return {
doctype: this.doc.doctype, doctype: this.doc.doctype,
name: this.doc.name, name: this.doc.name,
doc: this.doc doc: this.doc,
}; };
}, },
components: { components: {
FormControl, FormControl,
Button, Button,
TwoColumnForm: () => TwoColumnForm TwoColumnForm: () => TwoColumnForm,
}, },
mounted() { mounted() {
if (this.focusFirstInput) { if (this.focusFirstInput) {
@ -135,8 +137,9 @@ let TwoColumnForm = {
methods: { methods: {
onChange(df, value) { onChange(df, value) {
if (value == null) { if (value == null) {
return; return
} }
let oldValue = this.doc.get(df.fieldname); let oldValue = this.doc.get(df.fieldname);
if (oldValue === value) { if (oldValue === value) {
@ -151,7 +154,7 @@ let TwoColumnForm = {
// reset error messages // reset error messages
this.$set(this.errors, df.fieldname, null); this.$set(this.errors, df.fieldname, null);
this.doc.set(df.fieldname, value).catch(e => { this.doc.set(df.fieldname, value).catch((e) => {
// set error message for this field // set error message for this field
this.$set(this.errors, df.fieldname, getErrorMessage(e, this.doc)); this.$set(this.errors, df.fieldname, getErrorMessage(e, this.doc));
}); });
@ -197,7 +200,7 @@ let TwoColumnForm = {
await this.doc.loadLinks(); await this.doc.loadLinks();
this.inlineEditField = null; this.inlineEditField = null;
} }
} },
}, },
computed: { computed: {
formFields() { formFields() {
@ -205,13 +208,16 @@ let TwoColumnForm = {
}, },
style() { style() {
let templateColumns = (this.columnRatio || [1, 1]) let templateColumns = (this.columnRatio || [1, 1])
.map(r => `${r}fr`) .map((r) => `${r}fr`)
.join(' '); .join(' ');
return { return {
'grid-template-columns': templateColumns 'grid-template-columns': templateColumns,
}; };
} },
} submitted() {
return Boolean(this.doc.meta.isSubmittable && this.doc.submitted);
},
},
}; };
export default TwoColumnForm; export default TwoColumnForm;

View File

@ -6,11 +6,11 @@ const requirePatch = require.context('../patches', true, /\w+\.(js)$/);
export default async function runMigrate() { export default async function runMigrate() {
let patchOrder = patchesTxt.split('\n'); let patchOrder = patchesTxt.split('\n');
let allPatches = {}; let allPatches = {};
requirePatch.keys().forEach(fileName => { requirePatch.keys().forEach((fileName) => {
if (fileName === './index.js') return; if (fileName === './index.js') return;
let method; let method;
try { try {
method = requirePatch(fileName); method = requirePatch(fileName).default;
} catch (error) { } catch (error) {
console.error(error); console.error(error);
method = null; method = null;

View File

@ -26,10 +26,10 @@
type="primary" type="primary"
v-if=" v-if="
meta && meta &&
meta.isSubmittable && meta.isSubmittable &&
doc && doc &&
!doc.submitted && !doc.submitted &&
!doc._notInserted !doc._notInserted
" "
class="ml-2 text-white text-xs" class="ml-2 text-white text-xs"
> >
@ -43,7 +43,7 @@
v-if="imageField" v-if="imageField"
:df="imageField" :df="imageField"
:value="doc[imageField.fieldname]" :value="doc[imageField.fieldname]"
@change="value => valueChange(imageField, value)" @change="(value) => valueChange(imageField, value)"
size="small" size="small"
class="mb-1" class="mb-1"
:letter-placeholder=" :letter-placeholder="
@ -57,7 +57,7 @@
v-if="titleField" v-if="titleField"
:df="titleField" :df="titleField"
:value="doc[titleField.fieldname]" :value="doc[titleField.fieldname]"
@change="value => valueChange(titleField, value)" @change="(value) => valueChange(titleField, value)"
@input="setTitleSize" @input="setTitleSize"
/> />
</div> </div>
@ -81,7 +81,11 @@ import Button from '@/components/Button';
import FormControl from '@/components/Controls/FormControl'; import FormControl from '@/components/Controls/FormControl';
import TwoColumnForm from '@/components/TwoColumnForm'; import TwoColumnForm from '@/components/TwoColumnForm';
import DropdownWithActions from '@/components/DropdownWithActions'; import DropdownWithActions from '@/components/DropdownWithActions';
import { openQuickEdit, getActionsForDocument } from '@/utils'; import {
openQuickEdit,
getActionsForDocument,
handleErrorWithDialog,
} from '@/utils';
export default { export default {
name: 'QuickEditForm', name: 'QuickEditForm',
@ -90,7 +94,7 @@ export default {
Button, Button,
FormControl, FormControl,
TwoColumnForm, TwoColumnForm,
DropdownWithActions DropdownWithActions,
}, },
provide() { provide() {
let vm = this; let vm = this;
@ -99,7 +103,7 @@ export default {
name: this.name, name: this.name,
get doc() { get doc() {
return vm.doc; return vm.doc;
} },
}; };
}, },
data() { data() {
@ -107,7 +111,7 @@ export default {
doc: null, doc: null,
titleField: null, titleField: null,
imageField: null, imageField: null,
statusText: null statusText: null,
}; };
}, },
async created() { async created() {
@ -120,7 +124,7 @@ export default {
fields() { fields() {
return this.meta return this.meta
.getQuickEditFields() .getQuickEditFields()
.filter(df => !(this.hideFields || []).includes(df.fieldname)); .filter((df) => !(this.hideFields || []).includes(df.fieldname));
}, },
actions() { actions() {
return getActionsForDocument(this.doc); return getActionsForDocument(this.doc);
@ -130,7 +134,7 @@ export default {
return null; return null;
} }
return this.meta.quickEditWidget(this.doc); return this.meta.quickEditWidget(this.doc);
} },
}, },
methods: { methods: {
async fetchMetaAndDoc() { async fetchMetaAndDoc() {
@ -165,7 +169,7 @@ export default {
this.doc.once('afterRename', () => { this.doc.once('afterRename', () => {
openQuickEdit({ openQuickEdit({
doctype: this.doctype, doctype: this.doctype,
name: this.doc.name name: this.doc.name,
}); });
}); });
this.doc.on('beforeUpdate', () => { this.doc.on('beforeUpdate', () => {
@ -186,8 +190,14 @@ export default {
insertDoc() { insertDoc() {
this.$refs.form.insert(); this.$refs.form.insert();
}, },
submitDoc() { async submitDoc() {
this.$refs.form.submit(); console.log(this.meta)
console.log(this.doc)
try {
await this.$refs.form.submit();
} catch (e) {
this.statusText = null;
}
}, },
routeToPrevious() { routeToPrevious() {
this.$router.back(); this.$router.back();
@ -202,7 +212,7 @@ export default {
} }
input.size = valueLength; input.size = valueLength;
} }
} },
} },
}; };
</script> </script>

View File

@ -33,7 +33,7 @@ function getInitializedPrintWindow() {
const printWindow = new BrowserWindow({ const printWindow = new BrowserWindow({
width: 595, width: 595,
height: 842, height: 842,
show: true, show: false,
webPreferences: { webPreferences: {
contextIsolation: false, contextIsolation: false,
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION, nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,