mirror of
https://github.com/frappe/books.git
synced 2025-02-02 12:08:27 +00:00
incr: complete quick payment function
- fix quick view display update
This commit is contained in:
parent
bc909f630a
commit
759bedf764
@ -129,6 +129,13 @@ export abstract class Invoice extends Transactional {
|
|||||||
|
|
||||||
const party = (await this.fyo.doc.getDoc('Party', this.party!)) as Party;
|
const party = (await this.fyo.doc.getDoc('Party', this.party!)) as Party;
|
||||||
await party.updateOutstandingAmount();
|
await party.updateOutstandingAmount();
|
||||||
|
|
||||||
|
if (this.makeQuickPayment && this.quickPaymentAccount) {
|
||||||
|
const payment = this.getPayment();
|
||||||
|
await payment?.sync();
|
||||||
|
await payment?.submit();
|
||||||
|
await this.load();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async afterCancel() {
|
async afterCancel() {
|
||||||
@ -556,6 +563,11 @@ export abstract class Invoice extends Transactional {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (this.makeQuickPayment && this.quickPaymentAccount) {
|
||||||
|
const quickPaymentAccount = this.isSales ? 'paymentAccount' : 'account';
|
||||||
|
data[quickPaymentAccount] = this.quickPaymentAccount;
|
||||||
|
}
|
||||||
|
|
||||||
return this.fyo.doc.getNewDoc(ModelNameEnum.Payment, data) as Payment;
|
return this.fyo.doc.getNewDoc(ModelNameEnum.Payment, data) as Payment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,36 +35,54 @@ export default defineComponent({
|
|||||||
data() {
|
data() {
|
||||||
return { values: [] } as { values: { label: string; value: string }[] };
|
return { values: [] } as { values: { label: string; value: string }[] };
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
async name(v1, v2) {
|
||||||
|
if (v1 === v2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.setValues();
|
||||||
|
},
|
||||||
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
const fields: Field[] = (this.schema?.fields ?? []).filter(
|
await this.setValues();
|
||||||
(f) =>
|
},
|
||||||
f &&
|
methods: {
|
||||||
f.fieldtype !== 'Table' &&
|
async setValues() {
|
||||||
f.fieldtype !== 'AttachImage' &&
|
const fields: Field[] = (this.schema?.fields ?? []).filter(
|
||||||
f.fieldtype !== 'Attachment' &&
|
(f) =>
|
||||||
f.fieldname !== 'name' &&
|
f &&
|
||||||
!f.hidden &&
|
f.fieldtype !== 'Table' &&
|
||||||
!f.meta &&
|
f.fieldtype !== 'AttachImage' &&
|
||||||
!f.abstract
|
f.fieldtype !== 'Attachment' &&
|
||||||
);
|
f.fieldname !== 'name' &&
|
||||||
|
!f.hidden &&
|
||||||
|
!f.meta &&
|
||||||
|
!f.abstract &&
|
||||||
|
!f.computed
|
||||||
|
);
|
||||||
|
|
||||||
const data = (
|
const data = (
|
||||||
await this.fyo.db.getAll(this.schemaName, {
|
await this.fyo.db.getAll(this.schemaName, {
|
||||||
fields: fields.map((f) => f.fieldname),
|
fields: fields.map((f) => f.fieldname),
|
||||||
filters: { name: this.name },
|
filters: { name: this.name },
|
||||||
})
|
})
|
||||||
)[0];
|
)[0];
|
||||||
|
|
||||||
this.values = fields
|
this.values = fields
|
||||||
.map((f) => {
|
.map((f) => {
|
||||||
const value = data[f.fieldname];
|
const value = data[f.fieldname];
|
||||||
if (isFalsy(value)) {
|
if (isFalsy(value)) {
|
||||||
return { value: '', label: '' };
|
return { value: '', label: '' };
|
||||||
}
|
}
|
||||||
|
|
||||||
return { value: this.fyo.format(data[f.fieldname], f), label: f.label };
|
return {
|
||||||
})
|
value: this.fyo.format(data[f.fieldname], f),
|
||||||
.filter((i) => !!i.value);
|
label: f.label,
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.filter((i) => !!i.value);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
schema() {
|
schema() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user